Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [rfc] [04/09] Get rid of current_gdbarch  (SIZEOF_FRAME_SAVED_REGS  macro)
Date: Mon, 05 Nov 2007 12:23:00 -0000	[thread overview]
Message-ID: <472F0AC9.7030700@de.ibm.com> (raw)

[-- 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.  */




             reply	other threads:[~2007-11-05 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 12:23 Markus Deuling [this message]
2007-11-05 13:44 ` Mark Kettenis
2007-11-05 14:00   ` Daniel Jacobowitz
2007-11-05 15:14     ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472F0AC9.7030700@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox