diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-09 13:49:20 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-09 13:49:20 +0000 |
commit | bf6ae4641c04121071734f45fd22b2ee2533d3b1 (patch) | |
tree | f6862b215882e0410306eb5e626c366836ea1c2f | |
parent | c9f4d5725ddd4daae3866469aaa6293f1b58a404 (diff) | |
download | gdb-bf6ae4641c04121071734f45fd22b2ee2533d3b1.zip gdb-bf6ae4641c04121071734f45fd22b2ee2533d3b1.tar.gz gdb-bf6ae4641c04121071734f45fd22b2ee2533d3b1.tar.bz2 |
2007-06-09 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (ADDR_BITS_REMOVE): Replace by gdbarch_addr_bits_remove.
* value.c (value_as_address): Likewise (comment).
* remote-mips.c (common_breakpoint): Likewise.
* regcache.c (read_pc_pid): Likewise.
* printcmd.c (do_one_display): Likewise.
* monitor.c (monitor_write_memory, monitor_read_memory)
(monitor_insert_breakpoint): Likewise.
* mips-tdep.c (heuristic_proc_start): Likewise.
* infrun.c (insert_step_resume_breakpoint_at_frame)
(insert_step_resume_breakpoint_at_caller): Likewise.
* buildsym.c (record_line): Likewise.
* arm-tdep.c (arm_scan_prologue, thumb_get_next_pc)
(arm_get_next_pc): Likewise.
* armnbsd-nat.c (arm_supply_gregset, fetch_register, store_register)
(store_regs): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
* arm-linux-nat.c (fetch_register, fetch_regs): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/arm-linux-nat.c | 6 | ||||
-rw-r--r-- | gdb/arm-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 20 | ||||
-rw-r--r-- | gdb/armnbsd-nat.c | 22 | ||||
-rw-r--r-- | gdb/buildsym.c | 2 | ||||
-rw-r--r-- | gdb/gdbarch.c | 6 | ||||
-rw-r--r-- | gdb/gdbarch.h | 10 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 6 | ||||
-rw-r--r-- | gdb/infrun.c | 6 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 2 | ||||
-rw-r--r-- | gdb/monitor.c | 6 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/regcache.c | 2 | ||||
-rw-r--r-- | gdb/remote-mips.c | 2 | ||||
-rw-r--r-- | gdb/value.c | 4 |
16 files changed, 70 insertions, 49 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c320780..d3afbd9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,26 @@ 2007-06-09 Markus Deuling <deuling@de.ibm.com> + * gdbarch.sh (ADDR_BITS_REMOVE): Replace by gdbarch_addr_bits_remove. + * value.c (value_as_address): Likewise (comment). + * remote-mips.c (common_breakpoint): Likewise. + * regcache.c (read_pc_pid): Likewise. + * printcmd.c (do_one_display): Likewise. + * monitor.c (monitor_write_memory, monitor_read_memory) + (monitor_insert_breakpoint): Likewise. + * mips-tdep.c (heuristic_proc_start): Likewise. + * infrun.c (insert_step_resume_breakpoint_at_frame) + (insert_step_resume_breakpoint_at_caller): Likewise. + * buildsym.c (record_line): Likewise. + * arm-tdep.c (arm_scan_prologue, thumb_get_next_pc) + (arm_get_next_pc): Likewise. + * armnbsd-nat.c (arm_supply_gregset, fetch_register, store_register) + (store_regs): Likewise. + * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. + * arm-linux-nat.c (fetch_register, fetch_regs): Likewise. + * gdbarch.c, gdbarch.h: Regenerate. + +2007-06-09 Markus Deuling <deuling@de.ibm.com> + * gdbarch.sh (REGISTER_NAME): Replace by gdbarch_register_name. * tracepoint.c (scope_info): Likewise. * target.c (debug_print_register): Likewise. diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 49114fa..85be4d9 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -255,7 +255,8 @@ fetch_register (struct regcache *regcache, int regno) if (ARM_PC_REGNUM == regno) { - regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]); + regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove + (current_gdbarch, regs[ARM_PC_REGNUM]); regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) ®s[ARM_PC_REGNUM]); } @@ -290,7 +291,8 @@ fetch_regs (struct regcache *regcache) regcache_raw_supply (regcache, ARM_PS_REGNUM, (char *) ®s[ARM_PC_REGNUM]); - regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]); + regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove + (current_gdbarch, regs[ARM_PC_REGNUM]); regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) ®s[ARM_PC_REGNUM]); } diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index c9b5296..95ca4f3 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -393,7 +393,7 @@ arm_linux_supply_gregset (const struct regset *regset, reg_pc = extract_unsigned_integer (gregs + INT_REGISTER_SIZE * ARM_PC_REGNUM, INT_REGISTER_SIZE); - reg_pc = ADDR_BITS_REMOVE (reg_pc); + reg_pc = gdbarch_addr_bits_remove (current_gdbarch, reg_pc); store_unsigned_integer (pc_buf, INT_REGISTER_SIZE, reg_pc); regcache_raw_supply (regcache, ARM_PC_REGNUM, pc_buf); } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7205471..45240f1 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -724,7 +724,8 @@ arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cac return; else { - prologue_start = ADDR_BITS_REMOVE (return_value) - 8; + prologue_start = gdbarch_addr_bits_remove + (current_gdbarch, return_value) - 8; prologue_end = prologue_start + 64; /* See above. */ } } @@ -1623,7 +1624,7 @@ thumb_get_next_pc (CORE_ADDR pc) offset = bitcount (bits (inst1, 0, 7)) * DEPRECATED_REGISTER_SIZE; sp = read_register (ARM_SP_REGNUM); nextpc = (CORE_ADDR) read_memory_unsigned_integer (sp + offset, 4); - nextpc = ADDR_BITS_REMOVE (nextpc); + nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc); if (nextpc == pc) error (_("Infinite loop detected")); } @@ -1654,7 +1655,7 @@ thumb_get_next_pc (CORE_ADDR pc) else nextpc = read_register (bits (inst1, 3, 6)); - nextpc = ADDR_BITS_REMOVE (nextpc); + nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc); if (nextpc == pc) error (_("Infinite loop detected")); } @@ -1704,7 +1705,8 @@ arm_get_next_pc (CORE_ADDR pc) { rn = bits (this_instr, 0, 3); result = (rn == 15) ? pc_val + 8 : read_register (rn); - nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result); + nextpc = (CORE_ADDR) gdbarch_addr_bits_remove + (current_gdbarch, result); if (nextpc == pc) error (_("Infinite loop detected")); @@ -1785,7 +1787,8 @@ arm_get_next_pc (CORE_ADDR pc) result = ~operand2; break; } - nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result); + nextpc = (CORE_ADDR) gdbarch_addr_bits_remove + (current_gdbarch, result); if (nextpc == pc) error (_("Infinite loop detected")); @@ -1828,7 +1831,7 @@ arm_get_next_pc (CORE_ADDR pc) nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base, 4); - nextpc = ADDR_BITS_REMOVE (nextpc); + nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc); if (nextpc == pc) error (_("Infinite loop detected")); @@ -1865,7 +1868,8 @@ arm_get_next_pc (CORE_ADDR pc) + offset), 4); } - nextpc = ADDR_BITS_REMOVE (nextpc); + nextpc = gdbarch_addr_bits_remove + (current_gdbarch, nextpc); if (nextpc == pc) error (_("Infinite loop detected")); } @@ -1881,7 +1885,7 @@ arm_get_next_pc (CORE_ADDR pc) if (bits (this_instr, 28, 31) == INST_NV) nextpc |= bit (this_instr, 24) << 1; - nextpc = ADDR_BITS_REMOVE (nextpc); + nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc); if (nextpc == pc) error (_("Infinite loop detected")); break; diff --git a/gdb/armnbsd-nat.c b/gdb/armnbsd-nat.c index 6f6bd77..e8febd3 100644 --- a/gdb/armnbsd-nat.c +++ b/gdb/armnbsd-nat.c @@ -52,7 +52,7 @@ arm_supply_gregset (struct regcache *regcache, struct reg *gregset) regcache_raw_supply (regcache, ARM_LR_REGNUM, (char *) &gregset->r_lr); /* This is ok: we're running native... */ - r_pc = ADDR_BITS_REMOVE (gregset->r_pc); + r_pc = gdbarch_addr_bits_remove (current_gdbarch, gregset->r_pc); regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc); if (arm_apcs_32) @@ -105,7 +105,8 @@ fetch_register (struct regcache *regcache, int regno) case ARM_PC_REGNUM: /* This is ok: we're running native... */ - inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc); + inferior_registers.r_pc = gdbarch_addr_bits_remove + (current_gdbarch, inferior_registers.r_pc); regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &inferior_registers.r_pc); break; @@ -249,9 +250,10 @@ store_register (const struct regcache *regcache, int regno) regcache_raw_collect (regcache, ARM_PC_REGNUM, (char *) &pc_val); - pc_val = ADDR_BITS_REMOVE (pc_val); - inferior_registers.r_pc - ^= ADDR_BITS_REMOVE (inferior_registers.r_pc); + pc_val = gdbarch_addr_bits_remove (current_gdbarch, pc_val); + inferior_registers.r_pc ^= gdbarch_addr_bits_remove + (current_gdbarch, + inferior_registers.r_pc); inferior_registers.r_pc |= pc_val; } break; @@ -267,8 +269,10 @@ store_register (const struct regcache *regcache, int regno) regcache_raw_collect (regcache, ARM_PS_REGNUM, (char *) &psr_val); - psr_val ^= ADDR_BITS_REMOVE (psr_val); - inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc); + psr_val ^= gdbarch_addr_bits_remove (current_gdbarch, psr_val); + inferior_registers.r_pc = gdbarch_addr_bits_remove + (current_gdbarch, + inferior_registers.r_pc); inferior_registers.r_pc |= psr_val; } break; @@ -320,8 +324,8 @@ store_regs (const struct regcache *regcache) regcache_raw_collect (regcache, ARM_PS_REGNUM, (char *) &psr_val); - pc_val = ADDR_BITS_REMOVE (pc_val); - psr_val ^= ADDR_BITS_REMOVE (psr_val); + pc_val = gdbarch_addr_bits_remove (current_gdbarch, pc_val); + psr_val ^= gdbarch_addr_bits_remove (current_gdbarch, psr_val); inferior_registers.r_pc = pc_val | psr_val; } diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 69d11e5..2a7a352 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -756,7 +756,7 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc) e = subfile->line_vector->item + subfile->line_vector->nitems++; e->line = line; - e->pc = ADDR_BITS_REMOVE(pc); + e->pc = gdbarch_addr_bits_remove (current_gdbarch, pc); } /* Needed in order to sort line tables from IBM xcoff files. Sigh! */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index b9a049d..7d2bf68 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -661,12 +661,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: addr_bit = %s\n", paddr_d (current_gdbarch->addr_bit)); -#ifdef ADDR_BITS_REMOVE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "ADDR_BITS_REMOVE(addr)", - XSTRING (ADDR_BITS_REMOVE (addr))); -#endif fprintf_unfiltered (file, "gdbarch_dump: addr_bits_remove = <0x%lx>\n", (long) current_gdbarch->addr_bits_remove); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 4d60ade..37b72e4 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -877,7 +877,7 @@ extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdb /* On some machines there are bits in addresses which are not really part of the address, but are used by the kernel, the hardware, etc. - for special purposes. ADDR_BITS_REMOVE takes out any such bits so + for special purposes. gdbarch_addr_bits_remove takes out any such bits so we get a "real" address such as one would find in a symbol table. This is used only for addresses of instructions, and even then I'm not sure it's used in all contexts. It exists to deal with there @@ -888,15 +888,9 @@ extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdb typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (CORE_ADDR addr); extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr); extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove); -#if !defined (GDB_TM_FILE) && defined (ADDR_BITS_REMOVE) -#error "Non multi-arch definition of ADDR_BITS_REMOVE" -#endif -#if !defined (ADDR_BITS_REMOVE) -#define ADDR_BITS_REMOVE(addr) (gdbarch_addr_bits_remove (current_gdbarch, addr)) -#endif /* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into - ADDR_BITS_REMOVE. */ + gdbarch_addr_bits_remove. */ typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr); extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a811f7b..4df1da6 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -588,16 +588,16 @@ v::int:frame_red_zone_size m::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ::convert_from_func_ptr_addr_identity::0 # On some machines there are bits in addresses which are not really # part of the address, but are used by the kernel, the hardware, etc. -# for special purposes. ADDR_BITS_REMOVE takes out any such bits so +# for special purposes. gdbarch_addr_bits_remove takes out any such bits so # we get a "real" address such as one would find in a symbol table. # This is used only for addresses of instructions, and even then I'm # not sure it's used in all contexts. It exists to deal with there # being a few stray bits in the PC which would mislead us, not as some # sort of generic thing to handle alignment or segmentation (it's # possible it should be in TARGET_READ_PC instead). -f:=:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 +f::CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 # It is not at all clear why SMASH_TEXT_ADDRESS is not folded into -# ADDR_BITS_REMOVE. +# gdbarch_addr_bits_remove. f:=:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0 # FIXME/cagney/2001-01-18: This should be split in two. A target method that diff --git a/gdb/infrun.c b/gdb/infrun.c index dc6d894..c6da7467 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2808,7 +2808,8 @@ insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame) init_sal (&sr_sal); /* initialize to zeros */ - sr_sal.pc = ADDR_BITS_REMOVE (get_frame_pc (return_frame)); + sr_sal.pc = gdbarch_addr_bits_remove + (current_gdbarch, get_frame_pc (return_frame)); sr_sal.section = find_pc_overlay (sr_sal.pc); insert_step_resume_breakpoint_at_sal (sr_sal, get_frame_id (return_frame)); @@ -2840,7 +2841,8 @@ insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) init_sal (&sr_sal); /* initialize to zeros */ - sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (next_frame)); + sr_sal.pc = gdbarch_addr_bits_remove + (current_gdbarch, frame_pc_unwind (next_frame)); sr_sal.section = find_pc_overlay (sr_sal.pc); insert_step_resume_breakpoint_at_sal (sr_sal, frame_unwind_id (next_frame)); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index f0ef475..db1c198 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2245,7 +2245,7 @@ heuristic_proc_start (CORE_ADDR pc) int instlen; int seen_adjsp = 0; - pc = ADDR_BITS_REMOVE (pc); + pc = gdbarch_addr_bits_remove (current_gdbarch, pc); start_pc = pc; fence = start_pc - heuristic_fence_post; if (start_pc == 0) diff --git a/gdb/monitor.c b/gdb/monitor.c index 550f8af..30493f4 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1388,7 +1388,7 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len) monitor_debug ("MON write %d %s\n", len, paddr (memaddr)); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) - memaddr = ADDR_BITS_REMOVE (memaddr); + memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr); /* Use memory fill command for leading 0 bytes. */ @@ -1787,7 +1787,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len) paddr_nz (memaddr), (long) myaddr, len); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) - memaddr = ADDR_BITS_REMOVE (memaddr); + memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr); if (current_monitor->flags & MO_GETMEM_READ_SINGLE) return monitor_read_memory_single (memaddr, myaddr, len); @@ -2013,7 +2013,7 @@ monitor_insert_breakpoint (struct bp_target_info *bp_tgt) error (_("No set_break defined for this monitor")); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) - addr = ADDR_BITS_REMOVE (addr); + addr = gdbarch_addr_bits_remove (current_gdbarch, addr); /* Determine appropriate breakpoint size for this address. */ bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 94d31e4..e156d84 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1519,7 +1519,7 @@ do_one_display (struct display *d) val = evaluate_expression (d->exp); addr = value_as_address (val); if (d->format.format == 'i') - addr = ADDR_BITS_REMOVE (addr); + addr = gdbarch_addr_bits_remove (current_gdbarch, addr); annotate_display_value (); diff --git a/gdb/regcache.c b/gdb/regcache.c index e545dfa..8a535e1 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -900,7 +900,7 @@ read_pc_pid (ptid_t ptid) else if (PC_REGNUM >= 0) { CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid); - pc_val = ADDR_BITS_REMOVE (raw_val); + pc_val = gdbarch_addr_bits_remove (current_gdbarch, raw_val); } else internal_error (__FILE__, __LINE__, _("read_pc_pid: Unable to find PC")); diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 38c5e2a..c01cae0 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2404,7 +2404,7 @@ common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type) int rpid, rerrflg, rresponse, rlen; int nfields; - addr = ADDR_BITS_REMOVE (addr); + addr = gdbarch_addr_bits_remove (current_gdbarch, addr); if (mips_monitor == MON_LSI) { diff --git a/gdb/value.c b/gdb/value.c index 6b7aae6..e20a6ee 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -962,10 +962,10 @@ value_as_address (struct value *val) /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure whether we want this to be true eventually. */ #if 0 - /* ADDR_BITS_REMOVE is wrong if we are being called for a + /* gdbarch_addr_bits_remove is wrong if we are being called for a non-address (e.g. argument to "signal", "info break", etc.), or for pointers to char, in which the low bits *are* significant. */ - return ADDR_BITS_REMOVE (value_as_long (val)); + return gdbarch_addr_bits_remove (current_gdbarch, value_as_long (val)); #else /* There are several targets (IA-64, PowerPC, and others) which |