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] Replace current_gdbarch in stack.c
Date: Tue, 20 Nov 2007 13:33:00 -0000	[thread overview]
Message-ID: <4742E1C6.2010709@de.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

Hi,

this patch removes the last occurences of current_gdbarch in stack.c.

Tested on x86. Ok ?

ChangeLog:

	* stack.c (print_args_stub): Use get_frame_arch to get at the current
	architecture and replace current_gdbarch.
	(frame_info): Likewise.

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


[-- Attachment #2: diff-stack --]
[-- Type: text/plain, Size: 1800 bytes --]

diff -urpN src/gdb/stack.c dev/gdb/stack.c
--- src/gdb/stack.c	2007-11-09 21:38:58.000000000 +0100
+++ dev/gdb/stack.c	2007-11-20 13:49:32.000000000 +0100
@@ -409,11 +409,12 @@ static int
 print_args_stub (void *args)
 {
   struct print_args_args *p = args;
+  struct gdbarch *gdbarch = get_frame_arch (p->frame);
   int numargs;
 
-  if (gdbarch_frame_num_args_p (current_gdbarch))
+  if (gdbarch_frame_num_args_p (gdbarch))
     {
-      numargs = gdbarch_frame_num_args (current_gdbarch, p->frame);
+      numargs = gdbarch_frame_num_args (gdbarch, p->frame);
       gdb_assert (numargs >= 0);
     }
   else
@@ -893,15 +894,15 @@ frame_info (char *addr_exp, int from_tty
   struct gdbarch *gdbarch;
 
   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
+  gdbarch = get_frame_arch (fi);
 
   /* Name of the value returned by get_frame_pc().  Per comments, "pc"
      is not a good name.  */
-  if (gdbarch_pc_regnum (current_gdbarch) >= 0)
+  if (gdbarch_pc_regnum (gdbarch) >= 0)
     /* OK, this is weird.  The gdbarch_pc_regnum hardware register's value can
        easily not match that of the internal value returned by
        get_frame_pc().  */
-    pc_regname = gdbarch_register_name (current_gdbarch,
-					gdbarch_pc_regnum (current_gdbarch));
+    pc_regname = gdbarch_register_name (gdbarch, gdbarch_pc_regnum (gdbarch));
   else
     /* But then, this is weird to.  Even without gdbarch_pc_regnum, an
        architectures will often have a hardware register called "pc",
@@ -910,7 +911,6 @@ frame_info (char *addr_exp, int from_tty
     pc_regname = "pc";
 
   find_frame_sal (fi, &sal);
-  gdbarch = get_frame_arch (fi);
   func = get_frame_function (fi);
   /* FIXME: cagney/2002-11-28: Why bother?  Won't sal.symtab contain
      the same value?  */

             reply	other threads:[~2007-11-20 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 13:33 Markus Deuling [this message]
2007-11-20 22:25 ` Ulrich Weigand
2007-11-21  6:03   ` Markus Deuling

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=4742E1C6.2010709@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