From: Yao Qi Date: Thu, 28 Apr 2011 04:59:21 +0000 (+0000) Subject: 2011-04-28 Yao Qi X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ff120b4bf4d280ada76df69764a06cde85f9c6e;p=binutils-gdb.git 2011-04-28 Yao Qi * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d6e58354165..c688ecdab26 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,65 @@ +2011-04-28 Yao Qi + + * arm-tdep.c (copy_unmodified): Rename to ... + (arm_copy_unmodified): .. this. New. + (copy_preload): Move common part to ... + (install_preload): .. this. New. + (arm_copy_preload): New. + (copy_preload_reg): Move common part to ... + (install_preload_reg): ... this. New. + (arm_copy_preload_reg): New. + (copy_b_bl_blx): Move common part to ... + (install_b_bl_blx): .. this. New. + (arm_copy_b_bl_blx): New. + (copy_bx_blx_reg): Move common part to ... + (install_bx_blx_reg): ... this. New. + (arm_copy_bx_blx_reg): New. + (copy_alu_reg): Move common part to ... + (install_alu_reg): ... this. New. + (arm_copy_alu_reg): New. + (copy_alu_shifted_reg): Move common part to ... + (install_alu_shifted_reg): ... this. New. + (copy_ldr_str_ldrb_strb): Move common part to ... + (install_ldr_str_ldrb_strb): ... this. New. + (arm_copy_ldr_str_ldrb_strb): New. + (copy_copro_load_store): Move some common part to ... + (install_copy_copro_load_store): ... this. New. + (arm_copy_copro_load_store): New. + (copy_svc): Delete. + (arm_copy_svc): Renamed from copy_svc. + (copy_undef): Delete. + (arm_copy_undef): Renamed from copy_undef. + (decode_ext_reg_ld_st): Delete. + (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. + (decode_svc_copro): Delete. + (arm_decode_svc_copro): Renamed from decode_svc_copro. + (copy_copro_load_store, copy_alu_imm): update callers. + (copy_extra_ld_st, copy_block_xfer): Likewise. + (decode_misc_memhint_neon, decode_unconditional): Likewise. + (decode_miscellaneous, decode_dp_misc): Likewise. + (decode_ld_st_word_ubyte, decode_media): Likewise. + (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. + (decode_svc_copro, decode_misc_memhint_neon): Likewise. + (decode_unconditional, decode_miscellaneous): Likewise. + (decode_media, decode_b_bl_ldmstm): Likewise. + (arm_process_displaced_insn): Likewise.. + (decode_misc_memhint_neon): Delete. + (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. + (decode_miscellaneous): Delete. + (arm_decode_miscellaneous): Renamed from decode_miscellaneous. + (decode_dp_misc): Delete. + (arm_decode_dp_misc): Renamed from decode_dp_misc. + (decode_ld_st_word_ubyte): Delete. + (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. + (decode_media): Delete. + (arm_decode_media): Renamed from decode_media. + (decode_b_bl_ldmstm): Delete. + (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. + (decode_ext_reg_ld_st): Delete. + (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. + (decode_unconditional): Delete. + (arm_decode_unconditional): Renamed from decode_unconditional. + 2011-04-27 Jan Kratochvil Case insensitive lookups implementation. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 9153ac42edf..2dd8c9e4be3 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -5327,8 +5327,8 @@ insn_references_pc (uint32_t insn, uint32_t bitmask) matter what address they are executed at: in those cases, use this. */ static int -copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, - const char *iname, struct displaced_step_closure *dsc) +arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn, + const char *iname, struct displaced_step_closure *dsc) { if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.8lx, " @@ -5351,20 +5351,11 @@ cleanup_preload (struct gdbarch *gdbarch, displaced_write_reg (regs, dsc, 1, dsc->tmp[1], CANNOT_WRITE_PC); } -static int -copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, - struct displaced_step_closure *dsc) +static void +install_preload (struct gdbarch *gdbarch, struct regcache *regs, + struct displaced_step_closure *dsc, unsigned int rn) { - unsigned int rn = bits (insn, 16, 19); ULONGEST rn_val; - - if (!insn_references_pc (insn, 0x000f0000ul)) - return copy_unmodified (gdbarch, insn, "preload", dsc); - - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: copying preload insn %.8lx\n", - (unsigned long) insn); - /* Preload instructions: {pli/pld} [rn, #+/-imm] @@ -5374,34 +5365,40 @@ copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, dsc->tmp[0] = displaced_read_reg (regs, dsc, 0); rn_val = displaced_read_reg (regs, dsc, rn); displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC); - dsc->u.preload.immed = 1; - dsc->modinsn[0] = insn & 0xfff0ffff; - dsc->cleanup = &cleanup_preload; - - return 0; } -/* Preload instructions with register offset. */ - static int -copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, - struct regcache *regs, +arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs, struct displaced_step_closure *dsc) { unsigned int rn = bits (insn, 16, 19); - unsigned int rm = bits (insn, 0, 3); - ULONGEST rn_val, rm_val; - if (!insn_references_pc (insn, 0x000f000ful)) - return copy_unmodified (gdbarch, insn, "preload reg", dsc); + if (!insn_references_pc (insn, 0x000f0000ul)) + return arm_copy_unmodified (gdbarch, insn, "preload", dsc); if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: copying preload insn %.8lx\n", (unsigned long) insn); + dsc->modinsn[0] = insn & 0xfff0ffff; + + install_preload (gdbarch, regs, dsc, rn); + + return 0; +} + +/* Preload instructions with register offset. */ + +static void +install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs, + struct displaced_step_closure *dsc, unsigned int rn, + unsigned int rm) +{ + ULONGEST rn_val, rm_val; + /* Preload register-offset instructions: {pli/pld} [rn, rm {, shift}] @@ -5414,13 +5411,30 @@ copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, rm_val = displaced_read_reg (regs, dsc, rm); displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC); displaced_write_reg (regs, dsc, 1, rm_val, CANNOT_WRITE_PC); - dsc->u.preload.immed = 0; - dsc->modinsn[0] = (insn & 0xfff0fff0) | 0x1; - dsc->cleanup = &cleanup_preload; +} + +static int +arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn, + struct regcache *regs, + struct displaced_step_closure *dsc) +{ + unsigned int rn = bits (insn, 16, 19); + unsigned int rm = bits (insn, 0, 3); + + + if (!insn_references_pc (insn, 0x000f000ful)) + return arm_copy_unmodified (gdbarch, insn, "preload reg", dsc); + + if (debug_displaced) + fprintf_unfiltered (gdb_stdlog, "displaced: copying preload insn %.8lx\n", + (unsigned long) insn); + dsc->modinsn[0] = (insn & 0xfff0fff0) | 0x1; + + install_preload_reg (gdbarch, regs, dsc, rn, rm); return 0; } @@ -5439,21 +5453,13 @@ cleanup_copro_load_store (struct gdbarch *gdbarch, displaced_write_reg (regs, dsc, dsc->u.ldst.rn, rn_val, LOAD_WRITE_PC); } -static int -copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn, - struct regcache *regs, - struct displaced_step_closure *dsc) +static void +install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, + struct displaced_step_closure *dsc, + int writeback, unsigned int rn) { - unsigned int rn = bits (insn, 16, 19); ULONGEST rn_val; - if (!insn_references_pc (insn, 0x000f0000ul)) - return copy_unmodified (gdbarch, insn, "copro load/store", dsc); - - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: copying coprocessor " - "load/store insn %.8lx\n", (unsigned long) insn); - /* Coprocessor load/store instructions: {stc/stc2} [, #+/-imm] (and other immediate addressing modes) @@ -5466,12 +5472,29 @@ copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn, rn_val = displaced_read_reg (regs, dsc, rn); displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC); - dsc->u.ldst.writeback = bit (insn, 25); + dsc->u.ldst.writeback = writeback; dsc->u.ldst.rn = rn; + dsc->cleanup = &cleanup_copro_load_store; +} + +static int +arm_copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn, + struct regcache *regs, + struct displaced_step_closure *dsc) +{ + unsigned int rn = bits (insn, 16, 19); + + if (!insn_references_pc (insn, 0x000f0000ul)) + return arm_copy_unmodified (gdbarch, insn, "copro load/store", dsc); + + if (debug_displaced) + fprintf_unfiltered (gdb_stdlog, "displaced: copying coprocessor " + "load/store insn %.8lx\n", (unsigned long) insn); + dsc->modinsn[0] = insn & 0xfff0ffff; - dsc->cleanup = &cleanup_copro_load_store; + install_copro_load_store (gdbarch, regs, dsc, bit (insn, 25), rn); return 0; } @@ -5510,29 +5533,43 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs, /* Copy B/BL/BLX instructions with immediate destinations. */ +static void +install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs, + struct displaced_step_closure *dsc, + unsigned int cond, int exchange, int link, long offset) +{ + /* Implement "BL