Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] [04/09] Get rid of current_gdbarch  (SIZEOF_FRAME_SAVED_REGS  macro)
@ 2007-11-05 12:23 Markus Deuling
  2007-11-05 13:44 ` Mark Kettenis
  0 siblings, 1 reply; 4+ 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: 520 bytes --]

Hi,

this patch replaces SIZEOF_FRAME_SAVED_REGS macro by its expression.

Tested by gdb_mbuild with alpha target. Is this ok to commit?

ChangeLog: 


	* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Replace
	SIZEOF_FRAME_SAVED_REGS by its expression. Use get_frame_arch to get at
	the current architecture by frame_info.
	* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
	* frame.h (SIZEOF_FRAME_SAVED_REGS): Remove.

-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com





[-- Attachment #2: diff-frame --]
[-- Type: text/plain, Size: 2873 bytes --]

diff -urpN src/gdb/alpha-mdebug-tdep.c dev2/gdb/alpha-mdebug-tdep.c
--- src/gdb/alpha-mdebug-tdep.c	2007-10-17 15:36:43.000000000 +0200
+++ dev2/gdb/alpha-mdebug-tdep.c	2007-11-05 09:00:20.000000000 +0100
@@ -180,6 +180,7 @@ static struct alpha_mdebug_unwind_cache 
 alpha_mdebug_frame_unwind_cache (struct frame_info *next_frame, 
 				 void **this_prologue_cache)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct alpha_mdebug_unwind_cache *info;
   struct mdebug_extra_func_info *proc_desc;
   ULONGEST vfp;
@@ -201,7 +202,9 @@ alpha_mdebug_frame_unwind_cache (struct 
   info->proc_desc = proc_desc;
   gdb_assert (proc_desc != NULL);
 
-  info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
+  info->saved_regs = frame_obstack_zalloc (sizeof (CORE_ADDR) *
+		       (gdbarch_num_regs (gdbarch)
+			+ gdbarch_num_pseudo_regs (gdbarch)));
 
   /* The VFP of the frame is at FRAME_REG+FRAME_OFFSET.  */
   vfp = frame_unwind_register_unsigned (next_frame, PROC_FRAME_REG (proc_desc));
diff -urpN src/gdb/alpha-tdep.c dev2/gdb/alpha-tdep.c
--- src/gdb/alpha-tdep.c	2007-11-05 05:32:21.000000000 +0100
+++ dev2/gdb/alpha-tdep.c	2007-11-05 09:01:50.000000000 +0100
@@ -999,6 +999,7 @@ alpha_heuristic_frame_unwind_cache (stru
 				    void **this_prologue_cache,
 				    CORE_ADDR start_pc)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct alpha_heuristic_unwind_cache *info;
   ULONGEST val;
   CORE_ADDR limit_pc, cur_pc;
@@ -1009,7 +1010,9 @@ alpha_heuristic_frame_unwind_cache (stru
 
   info = FRAME_OBSTACK_ZALLOC (struct alpha_heuristic_unwind_cache);
   *this_prologue_cache = info;
-  info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
+  info->saved_regs = frame_obstack_zalloc (sizeof (CORE_ADDR) *
+		       (gdbarch_num_regs (gdbarch)
+			+ gdbarch_num_pseudo_regs (gdbarch)));
 
   limit_pc = frame_pc_unwind (next_frame);
   if (start_pc == 0)
diff -urpN src/gdb/frame.h dev2/gdb/frame.h
--- src/gdb/frame.h	2007-11-05 05:32:21.000000000 +0100
+++ dev2/gdb/frame.h	2007-11-05 09:02:29.000000000 +0100
@@ -569,18 +569,6 @@ enum print_what
     LOC_AND_ADDRESS 
   };
 
-/* Allocate additional space for appendices to a struct frame_info.
-   NOTE: Much of GDB's code works on the assumption that the allocated
-   saved_regs[] array is the size specified below.  If you try to make
-   that array smaller, GDB will happily walk off its end.  */
-
-#ifdef SIZEOF_FRAME_SAVED_REGS
-#error "SIZEOF_FRAME_SAVED_REGS can not be re-defined"
-#endif
-#define SIZEOF_FRAME_SAVED_REGS \
-        (sizeof (CORE_ADDR) * (gdbarch_num_regs (current_gdbarch)\
-			       + gdbarch_num_pseudo_regs (current_gdbarch)))
-
 /* Allocate zero initialized memory from the frame cache obstack.
    Appendices to the frame info (such as the unwind cache) should
    allocate memory using this method.  */




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-05 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-05 12:23 [rfc] [04/09] Get rid of current_gdbarch (SIZEOF_FRAME_SAVED_REGS macro) Markus Deuling
2007-11-05 13:44 ` Mark Kettenis
2007-11-05 14:00   ` Daniel Jacobowitz
2007-11-05 15:14     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox