Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc][2/13] Eliminate read_register: read_register in cris/frv_stopped_data_address
@ 2007-06-07 20:57 Ulrich Weigand
  0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2007-06-07 20:57 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-07 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-07 20:57 [rfc][2/13] Eliminate read_register: read_register in cris/frv_stopped_data_address Ulrich Weigand

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