diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-05-07 19:21:13 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-05-07 19:21:13 +0000 |
commit | f6684c317073868d91f0659501fe08215784ab9d (patch) | |
tree | fc1df2d7ada9293c1901b48f662cff97f8908c3a /gdb | |
parent | 0f3538e70eb350657bc4431329ad6a51ce9503da (diff) | |
download | gdb-f6684c317073868d91f0659501fe08215784ab9d.zip gdb-f6684c317073868d91f0659501fe08215784ab9d.tar.gz gdb-f6684c317073868d91f0659501fe08215784ab9d.tar.bz2 |
Index: gdb/ChangeLog
2003-05-07 Andrew Cagney <cagney@redhat.com>
* d10v-tdep.c (remote_d10v_translate_xfer_address): Add
"regcache".
(d10v_print_registers_info): Update.
(d10v_dmap_register, d10v_imap_register): Delete functions.
(struct gdbarch_tdep): Add "regcache" parameter to "dmap_register"
and "imap_register".
(d10v_ts2_dmap_register, d10v_ts2_imap_register): Add "regcache".
(d10v_ts3_dmap_register, d10v_ts3_imap_register): Add "regcache".
* arch-utils.c (generic_remote_translate_xfer_address): Add
"regcache" and "gdbarch" parameters.
* gdbarch.sh (REMOTE_TRANSLATE_XFER_ADDRESS): Add "regcache"
parameter. Change class to multi-arch.
* gdbarch.h, gdbarch.c: Re-generate.
* remote.c (remote_xfer_memory): Use
gdbarch_remote_translate_xfer_address.
Index: include/gdb/ChangeLog
2003-05-07 Andrew Cagney <cagney@redhat.com>
* sim-d10v.h (sim_d10v_translate_addr): Add regcache parameter.
(sim_d10v_translate_imap_addr): Add regcache parameter.
(sim_d10v_translate_dmap_addr): Ditto.
Index: sim/d10v/ChangeLog
2003-05-07 Andrew Cagney <cagney@redhat.com>
* interp.c (sim_d10v_translate_addr): Add "regcache" parameter.
(sim_d10v_translate_imap_addr): Ditto.
(sim_d10v_translate_dmap_addr): Ditto.
(xfer_mem): Pass NULL regcache to sim_d10v_translate_addr.
(dmem_addr): Pass NULL regcache to sim_d10v_translate_dmap_addr.
(dmap_register, imap_register): Add "regcache" parameter.
(imem_addr): Pass NULL regcache to sim_d10v_translate_imap_addr.
(sim_fetch_register): Pass NULL regcache to imap_register and
dmap_register.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 18 | ||||
-rw-r--r-- | gdb/arch-utils.c | 4 | ||||
-rw-r--r-- | gdb/d10v-tdep.c | 63 | ||||
-rw-r--r-- | gdb/gdbarch.c | 20 | ||||
-rw-r--r-- | gdb/gdbarch.h | 17 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 2 | ||||
-rw-r--r-- | gdb/remote.c | 5 |
7 files changed, 66 insertions, 63 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0088c24..12eae51 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2003-05-07 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (remote_d10v_translate_xfer_address): Add + "regcache". + (d10v_print_registers_info): Update. + (d10v_dmap_register, d10v_imap_register): Delete functions. + (struct gdbarch_tdep): Add "regcache" parameter to "dmap_register" + and "imap_register". + (d10v_ts2_dmap_register, d10v_ts2_imap_register): Add "regcache". + (d10v_ts3_dmap_register, d10v_ts3_imap_register): Add "regcache". + * arch-utils.c (generic_remote_translate_xfer_address): Add + "regcache" and "gdbarch" parameters. + * gdbarch.sh (REMOTE_TRANSLATE_XFER_ADDRESS): Add "regcache" + parameter. Change class to multi-arch. + * gdbarch.h, gdbarch.c: Re-generate. + * remote.c (remote_xfer_memory): Use + gdbarch_remote_translate_xfer_address. + 2003-05-07 Jeff Johnston <jjohnstn@redhat.com> * infrun.c (prev_pc): Move declaration ahead of proceed(). diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index fad8ed1..2f555ff 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -191,7 +191,9 @@ LONGEST legacy_call_dummy_words[1]; int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words); void -generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len, +generic_remote_translate_xfer_address (struct gdbarch *gdbarch, + struct regcache *regcache, + CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR * rem_addr, int *rem_len) { *rem_addr = gdb_addr; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 348e9f4..32e60f1 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -51,8 +51,8 @@ struct gdbarch_tdep { int a0_regnum; int nr_dmap_regs; - unsigned long (*dmap_register) (int nr); - unsigned long (*imap_register) (int nr); + unsigned long (*dmap_register) (void *regcache, int nr); + unsigned long (*imap_register) (void *regcache, int nr); }; /* These are the addresses the D10V-EVA board maps data and @@ -236,7 +236,7 @@ d10v_ts3_register_name (int reg_nr) one of the segments. */ static unsigned long -d10v_ts2_dmap_register (int reg_nr) +d10v_ts2_dmap_register (void *regcache, int reg_nr) { switch (reg_nr) { @@ -244,40 +244,38 @@ d10v_ts2_dmap_register (int reg_nr) case 1: return 0x2000; case 2: - return read_register (TS2_DMAP_REGNUM); + { + ULONGEST reg; + regcache_cooked_read_unsigned (regcache, TS2_DMAP_REGNUM, ®); + return reg; + } default: return 0; } } static unsigned long -d10v_ts3_dmap_register (int reg_nr) -{ - return read_register (TS3_DMAP0_REGNUM + reg_nr); -} - -static unsigned long -d10v_dmap_register (int reg_nr) -{ - return gdbarch_tdep (current_gdbarch)->dmap_register (reg_nr); -} - -static unsigned long -d10v_ts2_imap_register (int reg_nr) +d10v_ts3_dmap_register (void *regcache, int reg_nr) { - return read_register (TS2_IMAP0_REGNUM + reg_nr); + ULONGEST reg; + regcache_cooked_read_unsigned (regcache, TS3_DMAP0_REGNUM + reg_nr, ®); + return reg; } static unsigned long -d10v_ts3_imap_register (int reg_nr) +d10v_ts2_imap_register (void *regcache, int reg_nr) { - return read_register (TS3_IMAP0_REGNUM + reg_nr); + ULONGEST reg; + regcache_cooked_read_unsigned (regcache, TS2_IMAP0_REGNUM + reg_nr, ®); + return reg; } static unsigned long -d10v_imap_register (int reg_nr) +d10v_ts3_imap_register (void *regcache, int reg_nr) { - return gdbarch_tdep (current_gdbarch)->imap_register (reg_nr); + ULONGEST reg; + regcache_cooked_read_unsigned (regcache, TS3_IMAP0_REGNUM + reg_nr, ®); + return reg; } /* MAP GDB's internal register numbering (determined by the layout fo @@ -804,6 +802,7 @@ static void d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all) { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (regnum >= 0) { default_print_registers_info (gdbarch, file, frame, regnum, all); @@ -847,16 +846,19 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { if (a > 0) fprintf_filtered (file, " "); - fprintf_filtered (file, "IMAP%d %04lx", a, d10v_imap_register (a)); + fprintf_filtered (file, "IMAP%d %04lx", a, + tdep->imap_register (current_regcache, a)); } if (nr_dmap_regs (gdbarch) == 1) /* Registers DMAP0 and DMAP1 are constant. Just return dmap2. */ - fprintf_filtered (file, " DMAP %04lx\n", d10v_dmap_register (2)); + fprintf_filtered (file, " DMAP %04lx\n", + tdep->dmap_register (current_regcache, 2)); else { for (a = 0; a < nr_dmap_regs (gdbarch); a++) { - fprintf_filtered (file, " DMAP%d %04lx", a, d10v_dmap_register (a)); + fprintf_filtered (file, " DMAP%d %04lx", a, + tdep->dmap_register (current_regcache, a)); } fprintf_filtered (file, "\n"); } @@ -1100,15 +1102,16 @@ d10v_extract_return_value (struct type *type, struct regcache *regcache, VM system works, we just call that to do the translation. */ static void -remote_d10v_translate_xfer_address (CORE_ADDR memaddr, int nr_bytes, +remote_d10v_translate_xfer_address (struct gdbarch *gdbarch, + struct regcache *regcache, + CORE_ADDR memaddr, int nr_bytes, CORE_ADDR *targ_addr, int *targ_len) { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); long out_addr; long out_len; - out_len = sim_d10v_translate_addr (memaddr, nr_bytes, - &out_addr, - d10v_dmap_register, - d10v_imap_register); + out_len = sim_d10v_translate_addr (memaddr, nr_bytes, &out_addr, regcache, + tdep->dmap_register, tdep->imap_register); *targ_addr = out_addr; *targ_len = out_len; } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 667dbe0..db9e76e 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -402,7 +402,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - 0, + generic_remote_translate_xfer_address, 0, 0, 0, @@ -2184,20 +2184,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->reg_struct_has_addr /*REG_STRUCT_HAS_ADDR ()*/); #endif -#ifdef REMOTE_TRANSLATE_XFER_ADDRESS -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len)", - XSTRING (REMOTE_TRANSLATE_XFER_ADDRESS (gdb_addr, gdb_len, rem_addr, rem_len))); -#endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: REMOTE_TRANSLATE_XFER_ADDRESS = <0x%08lx>\n", - (long) current_gdbarch->remote_translate_xfer_address - /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/); -#endif + "gdbarch_dump: remote_translate_xfer_address = 0x%08lx\n", + (long) current_gdbarch->remote_translate_xfer_address); #ifdef RETURN_VALUE_ON_STACK fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4766,7 +4756,7 @@ set_gdbarch_function_start_offset (struct gdbarch *gdbarch, } void -gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len) +gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len) { gdb_assert (gdbarch != NULL); if (gdbarch->remote_translate_xfer_address == 0) @@ -4774,7 +4764,7 @@ gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_ad "gdbarch: gdbarch_remote_translate_xfer_address invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n"); - gdbarch->remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len); + gdbarch->remote_translate_xfer_address (gdbarch, regcache, gdb_addr, gdb_len, rem_addr, rem_len); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index aeb704b..10404a0 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2261,22 +2261,9 @@ extern void set_gdbarch_function_start_offset (struct gdbarch *gdbarch, CORE_ADD #endif #endif -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REMOTE_TRANSLATE_XFER_ADDRESS) -#define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (generic_remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len)) -#endif - -typedef void (gdbarch_remote_translate_xfer_address_ftype) (CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); -extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); +typedef void (gdbarch_remote_translate_xfer_address_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); +extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); extern void set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REMOTE_TRANSLATE_XFER_ADDRESS) -#error "Non multi-arch definition of REMOTE_TRANSLATE_XFER_ADDRESS" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REMOTE_TRANSLATE_XFER_ADDRESS) -#define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (gdbarch_remote_translate_xfer_address (current_gdbarch, gdb_addr, gdb_len, rem_addr, rem_len)) -#endif -#endif extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch); extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 3a8e164..47271f9 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -606,7 +606,7 @@ v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1 f:2:PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0 v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1 # -f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0 +m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0 # v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 diff --git a/gdb/remote.c b/gdb/remote.c index 902cb5f..8a7451e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3973,7 +3973,10 @@ remote_xfer_memory (CORE_ADDR mem_addr, char *buffer, int mem_len, int targ_len; int res; - REMOTE_TRANSLATE_XFER_ADDRESS (mem_addr, mem_len, &targ_addr, &targ_len); + /* Should this be the selected frame? */ + gdbarch_remote_translate_xfer_address (current_gdbarch, current_regcache, + mem_addr, mem_len, + &targ_addr, &targ_len); if (targ_len <= 0) return 0; |