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.
This commit is contained in:
Ulrich Weigand 2007-06-09 13:49:20 +00:00
parent c9f4d5725d
commit bf6ae4641c
16 changed files with 70 additions and 49 deletions

View file

@ -1,3 +1,24 @@
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.

View file

@ -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 *) &regs[ARM_PC_REGNUM]);
}
@ -290,7 +291,8 @@ fetch_regs (struct regcache *regcache)
regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) &regs[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 *) &regs[ARM_PC_REGNUM]);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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! */

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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));

View file

@ -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)

View file

@ -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);

View file

@ -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 ();

View file

@ -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"));

View file

@ -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)
{

View file

@ -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