This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [03/16] Get rid of current_gdbarch in dwarf2{-frame, loc}.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Mon, 08 Oct 2007 10:17:22 +0200
- Subject: [rfc] [03/16] Get rid of current_gdbarch in dwarf2{-frame, loc}.c
Hi,
this patch gets rid of some of the current_gdbarch's in dwarf2{-frame, loc}.c
ChangeLog:
* dwarf2-frame.c (read_reg, execute_cfa_program, dwarf2_frame_cache)
(dwarf2_frame_default_init_reg, dwarf2_frame_prev_register): Replace
current_gdbarch by gdbarch.
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Likewise.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/dwarf2-frame.c dev/gdb/dwarf2-frame.c
--- src/gdb/dwarf2-frame.c 2007-08-23 20:08:28.000000000 +0200
+++ dev/gdb/dwarf2-frame.c 2007-10-08 07:37:35.000000000 +0200
@@ -235,7 +235,7 @@ read_reg (void *baton, int reg)
int regnum;
gdb_byte *buf;
- regnum = gdbarch_dwarf2_reg_to_regnum (current_gdbarch, reg);
+ regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg);
buf = alloca (register_size (gdbarch, regnum));
frame_unwind_register (next_frame, regnum, buf);
@@ -338,9 +338,8 @@ execute_cfa_program (gdb_byte *insn_ptr,
incomplete CFI data; DW_CFA_restore unspecified\n\
register %s (#%d) at 0x%s"),
gdbarch_register_name
- (current_gdbarch, gdbarch_dwarf2_reg_to_regnum
- (current_gdbarch, reg)),
- gdbarch_dwarf2_reg_to_regnum (current_gdbarch, reg),
+ (gdbarch, gdbarch_dwarf2_reg_to_regnum (gdbarch, reg)),
+ gdbarch_dwarf2_reg_to_regnum (gdbarch, reg),
paddr (fs->pc));
}
else
@@ -647,9 +646,9 @@ dwarf2_frame_default_init_reg (struct gd
(e.g. IBM S/390 and zSeries). Those architectures should provide
their own architecture-specific initialization function. */
- if (regnum == gdbarch_pc_regnum (current_gdbarch))
+ if (regnum == gdbarch_pc_regnum (gdbarch))
reg->how = DWARF2_FRAME_REG_RA;
- else if (regnum == gdbarch_sp_regnum (current_gdbarch))
+ else if (regnum == gdbarch_sp_regnum (gdbarch))
reg->how = DWARF2_FRAME_REG_CFA;
}
@@ -809,8 +808,8 @@ dwarf2_frame_cache (struct frame_info *n
{
struct cleanup *old_chain;
struct gdbarch *gdbarch = get_frame_arch (next_frame);
- const int num_regs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
+ const int num_regs = gdbarch_num_regs (gdbarch)
+ + gdbarch_num_pseudo_regs (gdbarch);
struct dwarf2_frame_cache *cache;
struct dwarf2_frame_state *fs;
struct dwarf2_fde *fde;
@@ -909,7 +908,7 @@ dwarf2_frame_cache (struct frame_info *n
for (column = 0; column < fs->regs.num_regs; column++)
{
/* Use the GDB register number as the destination index. */
- int regnum = gdbarch_dwarf2_reg_to_regnum (current_gdbarch, column);
+ int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, column);
/* If there's no corresponding GDB register, ignore it. */
if (regnum < 0 || regnum >= num_regs)
@@ -1068,7 +1067,7 @@ dwarf2_frame_prev_register (struct frame
*lvalp = lval_register;
*addrp = 0;
*realnump = gdbarch_dwarf2_reg_to_regnum
- (current_gdbarch, cache->reg[regnum].loc.reg);
+ (gdbarch, cache->reg[regnum].loc.reg);
if (valuep)
frame_unwind_register (next_frame, (*realnump), valuep);
break;
@@ -1163,7 +1162,7 @@ dwarf2_frame_prev_register (struct frame
CORE_ADDR pc = cache->reg[regnum].loc.offset;
regnum = gdbarch_dwarf2_reg_to_regnum
- (current_gdbarch, cache->retaddr_reg.loc.reg);
+ (gdbarch, cache->retaddr_reg.loc.reg);
pc += frame_unwind_register_unsigned (next_frame, regnum);
pack_long (valuep, register_type (gdbarch, regnum), pc);
}
diff -urpN src/gdb/dwarf2loc.c dev/gdb/dwarf2loc.c
--- src/gdb/dwarf2loc.c 2007-09-17 16:53:05.000000000 +0200
+++ dev/gdb/dwarf2loc.c 2007-10-08 07:37:36.000000000 +0200
@@ -230,7 +230,7 @@ dwarf2_evaluate_loc_desc (struct symbol
{
bfd_byte regval[MAX_REGISTER_SIZE];
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum
- (current_gdbarch, p->value);
+ (arch, p->value);
get_frame_register (frame, gdb_regnum, regval);
memcpy (contents + offset, regval, p->size);
}
@@ -245,7 +245,7 @@ dwarf2_evaluate_loc_desc (struct symbol
{
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum
- (current_gdbarch, dwarf_regnum);
+ (arch, dwarf_regnum);
retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
}
else