Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [rfc][2/13] Eliminate read_register: read_register in cris/frv_stopped_data_address
Date: Thu, 07 Jun 2007 20:57:00 -0000	[thread overview]
Message-ID: <200706072057.l57KvhvK019504@d12av02.megacenter.de.ibm.com> (raw)

Hello,

frv-tdep.c has an implementation of frv_stopped_data_address that accesses
the current register set (using read_register) to find out watchpoint state.
cris-tdep.c similarly has cris_stopped_data_address, although this is
currently nowhere used.

This patch replaces read_register in those instances by reading registers
from the current frame, which should have the same effect at the location
in infrun.c where the stopped_data_address callback is invoked.


Longer term, I think these routines should go away.  They are only used
for the remote debugging case; and the remote protocol now has a proper
mechanism to implement watchpoints ...

For now this patch will allow me to complete the read_register
elimination process.


Bye,
Ulrich


ChangeLog:

	* cris-tdep.c (cris_stopped_data_address): Read register values
	from current frame instead of calling read_register.
	* frv-tdep.c (frv_stopped_data_address): Likewise.


diff -urNp gdb-orig/gdb/cris-tdep.c gdb-head/gdb/cris-tdep.c
--- gdb-orig/gdb/cris-tdep.c	2007-05-14 17:01:20.000000000 +0200
+++ gdb-head/gdb/cris-tdep.c	2007-05-15 20:18:09.083020084 +0200
@@ -535,7 +535,7 @@ CORE_ADDR
 cris_stopped_data_address (void)
 {
   CORE_ADDR eda;
-  eda = read_register (EDA_REGNUM);
+  eda = get_frame_register_unsigned (get_current_frame (), EDA_REGNUM);
   return eda;
 }
 
diff -urNp gdb-orig/gdb/frv-tdep.c gdb-head/gdb/frv-tdep.c
--- gdb-orig/gdb/frv-tdep.c	2007-05-14 17:01:20.000000000 +0200
+++ gdb-head/gdb/frv-tdep.c	2007-05-15 20:18:09.126013913 +0200
@@ -1291,13 +1291,14 @@ frv_check_watch_resources (int type, int
 int
 frv_stopped_data_address (CORE_ADDR *addr_p)
 {
+  struct frame_info *frame = get_current_frame ();
   CORE_ADDR brr, dbar0, dbar1, dbar2, dbar3;
 
-  brr = read_register (brr_regnum);
-  dbar0 = read_register (dbar0_regnum);
-  dbar1 = read_register (dbar1_regnum);
-  dbar2 = read_register (dbar2_regnum);
-  dbar3 = read_register (dbar3_regnum);
+  brr = get_frame_register_unsigned (frame, brr_regnum);
+  dbar0 = get_frame_register_unsigned (frame, dbar0_regnum);
+  dbar1 = get_frame_register_unsigned (frame, dbar1_regnum);
+  dbar2 = get_frame_register_unsigned (frame, dbar2_regnum);
+  dbar3 = get_frame_register_unsigned (frame, dbar3_regnum);
 
   if (brr & (1<<11))
     *addr_p = dbar0;
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


                 reply	other threads:[~2007-06-07 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200706072057.l57KvhvK019504@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /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