* [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer)
@ 2007-11-05 12:23 Markus Deuling
2007-11-05 16:08 ` Ulrich Weigand
0 siblings, 1 reply; 5+ messages in thread
From: Markus Deuling @ 2007-11-05 12:23 UTC (permalink / raw)
To: GDB Patches; +Cc: Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
Hi,
this patchs adds gdbarch parameter to legacy_virtual_frame_pointer and updates its
sole implementation in arch-utils.
Tested by building and running testsuite on x86. Ok to commit?
ChangeLog:
* gdbarch.sh (legacy_virtual_frame_pointer): Add gdbarch parameter.
* gdbarch.{c,h}: Regenerate.
* arch-utils.c (legacy_virtual_frame_pointer): Add gdbarch parameter.
Replace current_gdbarch by gdbarch.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: diff-frame-ptr --]
[-- Type: text/plain, Size: 4244 bytes --]
diff -urpN src/gdb/arch-utils.c dev3/gdb/arch-utils.c
--- src/gdb/arch-utils.c 2007-10-13 02:06:52.000000000 +0200
+++ dev3/gdb/arch-utils.c 2007-11-05 11:42:54.000000000 +0100
@@ -135,7 +135,8 @@ cannot_register_not (int regnum)
raw. */
void
-legacy_virtual_frame_pointer (CORE_ADDR pc,
+legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
+ CORE_ADDR pc,
int *frame_regnum,
LONGEST *frame_offset)
{
@@ -144,14 +145,14 @@ legacy_virtual_frame_pointer (CORE_ADDR
register and an offset can determine this. I think it should
instead generate a byte code expression as that would work better
with things like Dwarf2's CFI. */
- if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0
- && gdbarch_deprecated_fp_regnum (current_gdbarch)
- < gdbarch_num_regs (current_gdbarch))
- *frame_regnum = gdbarch_deprecated_fp_regnum (current_gdbarch);
- else if (gdbarch_sp_regnum (current_gdbarch) >= 0
- && gdbarch_sp_regnum (current_gdbarch)
- < gdbarch_num_regs (current_gdbarch))
- *frame_regnum = gdbarch_sp_regnum (current_gdbarch);
+ if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0
+ && gdbarch_deprecated_fp_regnum (gdbarch)
+ < gdbarch_num_regs (gdbarch))
+ *frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch);
+ else if (gdbarch_sp_regnum (gdbarch) >= 0
+ && gdbarch_sp_regnum (gdbarch)
+ < gdbarch_num_regs (gdbarch))
+ *frame_regnum = gdbarch_sp_regnum (gdbarch);
else
/* Should this be an internal error? I guess so, it is reflecting
an architectural limitation in the current design. */
diff -urpN src/gdb/gdbarch.c dev3/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-11-05 05:32:21.000000000 +0100
+++ dev3/gdb/gdbarch.c 2007-11-05 11:39:57.000000000 +0100
@@ -266,7 +266,7 @@ struct gdbarch startup_gdbarch =
1, /* char_signed */
0, /* read_pc */
0, /* write_pc */
- 0, /* virtual_frame_pointer */
+ legacy_virtual_frame_pointer, /* virtual_frame_pointer */
0, /* pseudo_register_read */
0, /* pseudo_register_write */
0, /* num_regs */
@@ -1366,7 +1366,7 @@ gdbarch_virtual_frame_pointer (struct gd
gdb_assert (gdbarch->virtual_frame_pointer != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
- gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset);
+ gdbarch->virtual_frame_pointer (gdbarch, pc, frame_regnum, frame_offset);
}
void
diff -urpN src/gdb/gdbarch.h dev3/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-11-05 05:32:21.000000000 +0100
+++ dev3/gdb/gdbarch.h 2007-11-05 11:39:16.000000000 +0100
@@ -160,7 +160,7 @@ extern void set_gdbarch_write_pc (struct
whole scheme for dealing with "frames" and "frame pointers" needs a
serious shakedown. */
-typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
+typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
diff -urpN src/gdb/gdbarch.sh dev3/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-11-05 05:32:21.000000000 +0100
+++ dev3/gdb/gdbarch.sh 2007-11-05 11:38:50.000000000 +0100
@@ -392,7 +392,7 @@ F:void:write_pc:struct regcache *regcach
# Function for getting target's idea of a frame pointer. FIXME: GDB's
# whole scheme for dealing with "frames" and "frame pointers" needs a
# serious shakedown.
-f:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0
+m:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0
#
M:void:pseudo_register_read:struct regcache *regcache, int cookednum, gdb_byte *buf:regcache, cookednum, buf
M:void:pseudo_register_write:struct regcache *regcache, int cookednum, const gdb_byte *buf:regcache, cookednum, buf
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) 2007-11-05 12:23 [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) Markus Deuling @ 2007-11-05 16:08 ` Ulrich Weigand 2007-11-06 12:03 ` Markus Deuling 0 siblings, 1 reply; 5+ messages in thread From: Ulrich Weigand @ 2007-11-05 16:08 UTC (permalink / raw) To: Markus Deuling; +Cc: GDB Patches Markus Deuling wrote: > this patchs adds gdbarch parameter to legacy_virtual_frame_pointer and updates its > sole implementation in arch-utils. Huh? There are three further instances of gdbarch_virtual_frame_pointer (in m32c-tdep.c, mips-tdep.c, spu-tdep.c). The patch as-is would break those platforms ... I guess if those are fixed it would be OK to convert the function for now; however, in the long run, the virtual_frame_pointer function needs to be eliminated -- the tracepoint framework should really be getting this data from the debug information. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) 2007-11-05 16:08 ` Ulrich Weigand @ 2007-11-06 12:03 ` Markus Deuling 2007-11-06 17:46 ` Ulrich Weigand 0 siblings, 1 reply; 5+ messages in thread From: Markus Deuling @ 2007-11-06 12:03 UTC (permalink / raw) To: Ulrich Weigand; +Cc: GDB Patches [-- Attachment #1: Type: text/plain, Size: 1177 bytes --] Hi, Ulrich Weigand schrieb: > Markus Deuling wrote: > >> this patchs adds gdbarch parameter to legacy_virtual_frame_pointer and updates its >> sole implementation in arch-utils. > > Huh? There are three further instances of gdbarch_virtual_frame_pointer > (in m32c-tdep.c, mips-tdep.c, spu-tdep.c). The patch as-is would break > those platforms ... > > I guess if those are fixed it would be OK to convert the function for now; > however, in the long run, the virtual_frame_pointer function needs to be > eliminated -- the tracepoint framework should really be getting this data > from the debug information. hm, sorry. No idea why I've overseen them. Here is a new patch tested by gdb_mbuild. Ok to commit? ChangeLog: * gdbarch.sh (legacy_virtual_frame_pointer): Add gdbarch parameter. * gdbarch.{c,h}: Regenerate. * arch-utils.c (legacy_virtual_frame_pointer): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mips-tdep.c (mips_virtual_frame_pointer): Likewise. * spu-tdep.c (spu_virtual_frame_pointer): Likewise. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com [-- Attachment #2: diff-frame-ptr --] [-- Type: text/plain, Size: 6606 bytes --] diff -urpN src/gdb/arch-utils.c dev/gdb/arch-utils.c --- src/gdb/arch-utils.c 2007-10-13 02:06:52.000000000 +0200 +++ dev/gdb/arch-utils.c 2007-11-06 09:02:44.000000000 +0100 @@ -135,7 +135,8 @@ cannot_register_not (int regnum) raw. */ void -legacy_virtual_frame_pointer (CORE_ADDR pc, +legacy_virtual_frame_pointer (struct gdbarch *gdbarch, + CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { @@ -144,14 +145,14 @@ legacy_virtual_frame_pointer (CORE_ADDR register and an offset can determine this. I think it should instead generate a byte code expression as that would work better with things like Dwarf2's CFI. */ - if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0 - && gdbarch_deprecated_fp_regnum (current_gdbarch) - < gdbarch_num_regs (current_gdbarch)) - *frame_regnum = gdbarch_deprecated_fp_regnum (current_gdbarch); - else if (gdbarch_sp_regnum (current_gdbarch) >= 0 - && gdbarch_sp_regnum (current_gdbarch) - < gdbarch_num_regs (current_gdbarch)) - *frame_regnum = gdbarch_sp_regnum (current_gdbarch); + if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0 + && gdbarch_deprecated_fp_regnum (gdbarch) + < gdbarch_num_regs (gdbarch)) + *frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch); + else if (gdbarch_sp_regnum (gdbarch) >= 0 + && gdbarch_sp_regnum (gdbarch) + < gdbarch_num_regs (gdbarch)) + *frame_regnum = gdbarch_sp_regnum (gdbarch); else /* Should this be an internal error? I guess so, it is reflecting an architectural limitation in the current design. */ diff -urpN src/gdb/gdbarch.c dev/gdb/gdbarch.c --- src/gdb/gdbarch.c 2007-11-05 05:32:21.000000000 +0100 +++ dev/gdb/gdbarch.c 2007-11-06 09:02:44.000000000 +0100 @@ -266,7 +266,7 @@ struct gdbarch startup_gdbarch = 1, /* char_signed */ 0, /* read_pc */ 0, /* write_pc */ - 0, /* virtual_frame_pointer */ + legacy_virtual_frame_pointer, /* virtual_frame_pointer */ 0, /* pseudo_register_read */ 0, /* pseudo_register_write */ 0, /* num_regs */ @@ -1366,7 +1366,7 @@ gdbarch_virtual_frame_pointer (struct gd gdb_assert (gdbarch->virtual_frame_pointer != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n"); - gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset); + gdbarch->virtual_frame_pointer (gdbarch, pc, frame_regnum, frame_offset); } void diff -urpN src/gdb/gdbarch.h dev/gdb/gdbarch.h --- src/gdb/gdbarch.h 2007-11-05 05:32:21.000000000 +0100 +++ dev/gdb/gdbarch.h 2007-11-06 09:02:44.000000000 +0100 @@ -160,7 +160,7 @@ extern void set_gdbarch_write_pc (struct whole scheme for dealing with "frames" and "frame pointers" needs a serious shakedown. */ -typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); +typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer); diff -urpN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh --- src/gdb/gdbarch.sh 2007-11-05 05:32:21.000000000 +0100 +++ dev/gdb/gdbarch.sh 2007-11-06 09:02:44.000000000 +0100 @@ -392,7 +392,7 @@ F:void:write_pc:struct regcache *regcach # Function for getting target's idea of a frame pointer. FIXME: GDB's # whole scheme for dealing with "frames" and "frame pointers" needs a # serious shakedown. -f:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0 +m:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0 # M:void:pseudo_register_read:struct regcache *regcache, int cookednum, gdb_byte *buf:regcache, cookednum, buf M:void:pseudo_register_write:struct regcache *regcache, int cookednum, const gdb_byte *buf:regcache, cookednum, buf diff -urpN src/gdb/m32c-tdep.c dev/gdb/m32c-tdep.c --- src/gdb/m32c-tdep.c 2007-11-05 05:32:22.000000000 +0100 +++ dev/gdb/m32c-tdep.c 2007-11-06 09:10:19.000000000 +0100 @@ -2525,7 +2525,7 @@ m32c_m16c_pointer_to_address (struct typ } void -m32c_virtual_frame_pointer (CORE_ADDR pc, +m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { @@ -2534,12 +2534,12 @@ m32c_virtual_frame_pointer (CORE_ADDR pc struct m32c_prologue p; struct regcache *regcache = get_current_regcache (); - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!find_pc_partial_function (pc, &name, &func_addr, &func_end)) internal_error (__FILE__, __LINE__, _("No virtual frame pointer available")); - m32c_analyze_prologue (current_gdbarch, func_addr, pc, &p); + m32c_analyze_prologue (gdbarch, func_addr, pc, &p); switch (p.kind) { case prologue_with_frame_ptr: @@ -2556,7 +2556,7 @@ m32c_virtual_frame_pointer (CORE_ADDR pc break; } /* Sanity check */ - if (*frame_regnum > gdbarch_num_regs (current_gdbarch)) + if (*frame_regnum > gdbarch_num_regs (gdbarch)) internal_error (__FILE__, __LINE__, _("No virtual frame pointer available")); } diff -urpN src/gdb/mips-tdep.c dev/gdb/mips-tdep.c --- src/gdb/mips-tdep.c 2007-11-05 05:32:22.000000000 +0100 +++ dev/gdb/mips-tdep.c 2007-11-06 09:08:46.000000000 +0100 @@ -5040,7 +5040,8 @@ mips_integer_to_address (struct gdbarch an assertion failure. */ static void -mips_virtual_frame_pointer (CORE_ADDR pc, int *reg, LONGEST *offset) +mips_virtual_frame_pointer (struct gdbarch *gdbarch, + CORE_ADDR pc, int *reg, LONGEST *offset) { *reg = MIPS_SP_REGNUM; *offset = 0; diff -urpN src/gdb/spu-tdep.c dev/gdb/spu-tdep.c --- src/gdb/spu-tdep.c 2007-11-05 05:32:22.000000000 +0100 +++ dev/gdb/spu-tdep.c 2007-11-06 09:08:20.000000000 +0100 @@ -708,7 +708,8 @@ spu_skip_prologue (CORE_ADDR pc) /* Return the frame pointer in use at address PC. */ static void -spu_virtual_frame_pointer (CORE_ADDR pc, int *reg, LONGEST *offset) +spu_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, + int *reg, LONGEST *offset) { struct spu_prologue_data data; spu_analyze_prologue (pc, (CORE_ADDR)-1, &data); ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) 2007-11-06 12:03 ` Markus Deuling @ 2007-11-06 17:46 ` Ulrich Weigand 2007-11-07 7:00 ` Markus Deuling 0 siblings, 1 reply; 5+ messages in thread From: Ulrich Weigand @ 2007-11-06 17:46 UTC (permalink / raw) To: Markus Deuling; +Cc: GDB Patches Markus Deuling wrote: > * gdbarch.sh (legacy_virtual_frame_pointer): Add gdbarch parameter. > * gdbarch.{c,h}: Regenerate. > * arch-utils.c (legacy_virtual_frame_pointer): Add gdbarch parameter. > Replace current_gdbarch by gdbarch. > * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. > * mips-tdep.c (mips_virtual_frame_pointer): Likewise. > * spu-tdep.c (spu_virtual_frame_pointer): Likewise. This is OK. Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) 2007-11-06 17:46 ` Ulrich Weigand @ 2007-11-07 7:00 ` Markus Deuling 0 siblings, 0 replies; 5+ messages in thread From: Markus Deuling @ 2007-11-07 7:00 UTC (permalink / raw) To: GDB Patches; +Cc: Ulrich Weigand Ulrich Weigand schrieb: > Markus Deuling wrote: > >> * gdbarch.sh (legacy_virtual_frame_pointer): Add gdbarch parameter. >> * gdbarch.{c,h}: Regenerate. >> * arch-utils.c (legacy_virtual_frame_pointer): Add gdbarch parameter. >> Replace current_gdbarch by gdbarch. >> * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. >> * mips-tdep.c (mips_virtual_frame_pointer): Likewise. >> * spu-tdep.c (spu_virtual_frame_pointer): Likewise. > > This is OK. > > Thanks, > Ulrich > Thank you very much. Committed as well. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-07 7:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-11-05 12:23 [rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer) Markus Deuling 2007-11-05 16:08 ` Ulrich Weigand 2007-11-06 12:03 ` Markus Deuling 2007-11-06 17:46 ` Ulrich Weigand 2007-11-07 7:00 ` Markus Deuling
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox