This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch rfc] Eliminate write_sp()


Hello,

It turns out that there is only one call to write_sp() in core GDB, found in hand_function_call(). Since that call is made redundant by push_dummy_call(), I think it should be removed / deprecated. This is just a tiny step - replace it with the underlying TARGET_WRITE_SP().

I'll commit in a day or so,
Andrew
2003-03-26  Andrew Cagney  <cagney at redhat dot com>

	* regcache.c (write_sp): Delete function and references.
	* inferior.h (write_sp): Delete declaration.
	* valops.c (hand_function_call): Replace write_sp with
	TARGET_WRITE_SP.
	* sparc-tdep.c (sparc_push_dummy_frame): Ditto.
	(sparc_pop_frame): Ditto.
	
Index: doc/ChangeLog
2003-03-26  Andrew Cagney  <cagney at redhat dot com>

	* gdbint.texinfo (Target Architecture Definition): Remove
	references to write_sp.
	
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.43
diff -u -r1.43 inferior.h
--- inferior.h	25 Mar 2003 18:54:15 -0000	1.43
+++ inferior.h	27 Mar 2003 01:54:07 -0000
@@ -178,8 +178,6 @@
 
 extern CORE_ADDR generic_target_read_sp (void);
 
-extern void write_sp (CORE_ADDR);
-
 extern void generic_target_write_sp (CORE_ADDR);
 
 extern CORE_ADDR read_fp (void);
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.73
diff -u -r1.73 regcache.c
--- regcache.c	12 Mar 2003 20:50:13 -0000	1.73
+++ regcache.c	27 Mar 2003 01:54:09 -0000
@@ -1328,16 +1328,16 @@
 }
 
 
-/* read_pc, write_pc, read_sp, write_sp, read_fp, etc.  Special
-   handling for registers PC, SP, and FP.  */
+/* read_pc, write_pc, read_sp, read_fp, etc.  Special handling for
+   registers PC, SP, and FP.  */
 
 /* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(),
    read_pc_pid(), read_pc(), generic_target_write_pc(),
    write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(),
-   generic_target_write_sp(), write_sp(), generic_target_read_fp() and
-   read_fp(), will eventually be moved out of the reg-cache into
-   either frame.[hc] or to the multi-arch framework.  The are not part
-   of the raw register cache.  */
+   generic_target_write_sp(), generic_target_read_fp() and read_fp(),
+   will eventually be moved out of the reg-cache into either
+   frame.[hc] or to the multi-arch framework.  The are not part of the
+   raw register cache.  */
 
 /* This routine is getting awfully cluttered with #if's.  It's probably
    time to turn this into READ_PC and define it in the tm.h file.
@@ -1454,12 +1454,6 @@
 #endif
   internal_error (__FILE__, __LINE__,
 		  "generic_target_write_sp");
-}
-
-void
-write_sp (CORE_ADDR val)
-{
-  TARGET_WRITE_SP (val);
 }
 
 CORE_ADDR
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.78
diff -u -r1.78 sparc-tdep.c
--- sparc-tdep.c	26 Mar 2003 22:39:52 -0000	1.78
+++ sparc-tdep.c	27 Mar 2003 01:54:18 -0000
@@ -1040,7 +1040,7 @@
 
   sp -= DUMMY_STACK_SIZE;
 
-  write_sp (sp);
+  TARGET_WRITE_SP (sp);
 
   write_memory (sp + DUMMY_REG_SAVE_OFFSET, &register_temp[0],
 		DUMMY_STACK_REG_BUF_SIZE);
@@ -1310,7 +1310,7 @@
 			read_memory_integer (fsr[O0_REGNUM + 7],
 					     SPARC_INTREG_SIZE));
 
-      write_sp (get_frame_base (frame));
+      TARGET_WRITE_SP (get_frame_base (frame));
     }
   else if (fsr[I0_REGNUM])
     {
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.99
diff -u -r1.99 valops.c
--- valops.c	26 Mar 2003 22:39:52 -0000	1.99
+++ valops.c	27 Mar 2003 01:54:23 -0000
@@ -1697,7 +1697,7 @@
      frame), and none of the code following that code adjusts the
      stack-pointer value, the below call is entirely redundant.  */
   if (!gdbarch_push_dummy_call_p (current_gdbarch))
-    write_sp (sp);
+    TARGET_WRITE_SP (sp);
 
   if (SAVE_DUMMY_FRAME_TOS_P ())
     SAVE_DUMMY_FRAME_TOS (sp);
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.135
diff -u -r1.135 gdbint.texinfo
--- doc/gdbint.texinfo	26 Mar 2003 22:39:53 -0000	1.135
+++ doc/gdbint.texinfo	27 Mar 2003 01:54:33 -0000
@@ -3894,12 +3894,11 @@
 @findex read_pc
 @findex write_pc
 @findex read_sp
- at findex write_sp
 @findex read_fp
 These change the behavior of @code{read_pc}, @code{write_pc},
- at code{read_sp}, @code{write_sp} and @code{read_fp}.  For most targets,
-these may be left undefined.  @value{GDBN} will call the read and write
-register functions with the relevant @code{_REGNUM} argument.
+ at code{read_sp} and @code{read_fp}.  For most targets, these may be left
+undefined.  @value{GDBN} will call the read and write register functions
+with the relevant @code{_REGNUM} argument.
 
 These macros are useful when a target keeps one of these registers in a
 hard to get at place; for example, part in a segment register and part

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]