This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc] [09/09] Get rid of current_gdbarch (gdbarch parameter to legacy_virtual_frame_pointer)


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




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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]