This is the mail archive of the gdb-patches@sourceware.org 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]

[rfc] [3/8] Remove macro DECR_PC_AFTER_BREAK


Hello,

this patch removes DECR_PC_AFTER_BREAK macro from gdbarch.sh


ChangeLog:


	* gdbarch.sh (DECR_PC_AFTER_BREAK): Replace by
	gdbarch_decr_pc_after_break.
	* tracepoint.c (trace_dump_command): Likewise.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Likewise.
	* linux-thread-db.c (check_event): Likewise.
	* linux-nat.c (cancel_breakpoints_callback): Likewise.
	* infrun.c (adjust_pc_after_break, normal_stop): Likewise.
	* frame.h: Likewise (comment).
	* dummy-frame.c (deprecated_pc_in_call_dummy): Likewise.
	* aix-thread.c (aix_thread_wait): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.



Is this ok to commit?

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






diff -urN src_neu/gdb/aix-thread.c dev_neu/gdb/aix-thread.c
--- src_neu/gdb/aix-thread.c	2007-05-11 21:55:19.000000000 +0200
+++ dev_neu/gdb/aix-thread.c	2007-06-08 06:59:10.000000000 +0200
@@ -1013,8 +1013,9 @@
 
   /* Check whether libpthdebug might be ready to be initialized.  */
   if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED &&
-      status->value.sig == TARGET_SIGNAL_TRAP &&
-      read_pc_pid (ptid) - DECR_PC_AFTER_BREAK == pd_brk_addr)
+      status->value.sig == TARGET_SIGNAL_TRAP
+      && read_pc_pid (ptid)
+	 - gdbarch_decr_pc_after_break (current_gdbarch) == pd_brk_addr)
     return pd_activate (0);
 
   return pd_update (0);
diff -urN src_neu/gdb/dummy-frame.c dev_neu/gdb/dummy-frame.c
--- src_neu/gdb/dummy-frame.c	2007-01-09 18:58:50.000000000 +0100
+++ dev_neu/gdb/dummy-frame.c	2007-06-08 06:59:10.000000000 +0200
@@ -52,7 +52,7 @@
 /* Function: deprecated_pc_in_call_dummy (pc)
 
    Return non-zero if the PC falls in a dummy frame created by gdb for
-   an inferior call.  The code below which allows DECR_PC_AFTER_BREAK
+   an inferior call.  The code below which allows gdbarch_decr_pc_after_break
    is for infrun.c, which may give the function a PC without that
    subtracted out.
 
@@ -75,7 +75,8 @@
        dummyframe = dummyframe->next)
     {
       if ((pc >= dummyframe->id.code_addr)
-	  && (pc <= dummyframe->id.code_addr + DECR_PC_AFTER_BREAK))
+	  && (pc <= dummyframe->id.code_addr
+		    + gdbarch_decr_pc_after_break (current_gdbarch)))
 	return 1;
     }
   return 0;
diff -urN src_neu/gdb/frame.h dev_neu/gdb/frame.h
--- src_neu/gdb/frame.h	2007-05-31 19:31:37.000000000 +0200
+++ dev_neu/gdb/frame.h	2007-06-08 06:59:10.000000000 +0200
@@ -709,7 +709,7 @@
 extern struct frame_info *create_new_frame (CORE_ADDR base, CORE_ADDR pc);
 
 /* FIXME: cagney/2002-12-06: Has the PC in the current frame changed?
-   "infrun.c", Thanks to DECR_PC_AFTER_BREAK, can change the PC after
+   "infrun.c", Thanks to gdbarch_decr_pc_after_break, can change the PC after
    the initial frame create.  This puts things back in sync.
 
    This replaced: frame->pc = ....; */
diff -urN src_neu/gdb/gdbarch.c dev_neu/gdb/gdbarch.c
--- src_neu/gdb/gdbarch.c	2007-06-08 05:38:50.000000000 +0200
+++ dev_neu/gdb/gdbarch.c	2007-06-08 07:02:52.000000000 +0200
@@ -778,11 +778,6 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: convert_register_p = <0x%lx>\n",
                       (long) current_gdbarch->convert_register_p);
-#ifdef DECR_PC_AFTER_BREAK
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
-                      XSTRING (DECR_PC_AFTER_BREAK));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: decr_pc_after_break = 0x%s\n",
                       paddr_nz (current_gdbarch->decr_pc_after_break));
@@ -1198,12 +1193,6 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: read_pc = <0x%lx>\n",
                       (long) current_gdbarch->read_pc);
-#ifdef REGISTER_NAME
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "REGISTER_NAME(regnr)",
-                      XSTRING (REGISTER_NAME (regnr)));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: register_name = <0x%lx>\n",
                       (long) current_gdbarch->register_name);
diff -urN src_neu/gdb/gdbarch.h dev_neu/gdb/gdbarch.h
--- src_neu/gdb/gdbarch.h	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/gdbarch.h	2007-06-08 06:59:10.000000000 +0200
@@ -718,12 +718,6 @@
 
 extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
 extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
-#if !defined (GDB_TM_FILE) && defined (DECR_PC_AFTER_BREAK)
-#error "Non multi-arch definition of DECR_PC_AFTER_BREAK"
-#endif
-#if !defined (DECR_PC_AFTER_BREAK)
-#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch))
-#endif
 
 /* A function can be addressed by either it's "pointer" (possibly a
    descriptor address) or "entry point" (first executable instruction).
diff -urN src_neu/gdb/gdbarch.sh dev_neu/gdb/gdbarch.sh
--- src_neu/gdb/gdbarch.sh	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/gdbarch.sh	2007-06-08 06:59:10.000000000 +0200
@@ -547,7 +547,7 @@
 M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
 f:=:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0
 f:=:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0
-v:=:CORE_ADDR:decr_pc_after_break:::0:::0
+v::CORE_ADDR:decr_pc_after_break:::0:::0
 
 # A function can be addressed by either it's "pointer" (possibly a
 # descriptor address) or "entry point" (first executable instruction).
diff -urN src_neu/gdb/infrun.c dev_neu/gdb/infrun.c
--- src_neu/gdb/infrun.c	2007-06-08 05:38:50.000000000 +0200
+++ dev_neu/gdb/infrun.c	2007-06-08 07:01:52.000000000 +0200
@@ -1148,29 +1148,29 @@
 
   /* If this target does not decrement the PC after breakpoints, then
      we have nothing to do.  */
-  if (DECR_PC_AFTER_BREAK == 0)
+  if (gdbarch_decr_pc_after_break (current_gdbarch) == 0)
     return;
 
   /* If we've hit a breakpoint, we'll normally be stopped with SIGTRAP.  If
      we aren't, just return.
 
      We assume that waitkinds other than TARGET_WAITKIND_STOPPED are not
-     affected by DECR_PC_AFTER_BREAK.  Other waitkinds which are implemented
-     by software breakpoints should be handled through the normal breakpoint
-     layer.
+     affected by gdbarch_decr_pc_after_break.  Other waitkinds which are
+     implemented by software breakpoints should be handled through the normal
+     breakpoint layer.
 
      NOTE drow/2004-01-31: On some targets, breakpoints may generate
      different signals (SIGILL or SIGEMT for instance), but it is less
      clear where the PC is pointing afterwards.  It may not match
-     DECR_PC_AFTER_BREAK.  I don't know any specific target that generates
-     these signals at breakpoints (the code has been in GDB since at least
-     1992) so I can not guess how to handle them here.
+     gdbarch_decr_pc_after_break.  I don't know any specific target that
+     generates these signals at breakpoints (the code has been in GDB since at
+     least 1992) so I can not guess how to handle them here.
 
      In earlier versions of GDB, a target with 
      gdbarch_have_nonsteppable_watchpoint would have the PC after hitting a
-     watchpoint affected by DECR_PC_AFTER_BREAK.  I haven't found any target
-     with both of these set in GDB history, and it seems unlikely to be correct,
-     so gdbarch_have_nonsteppable_watchpoint is not checked here.  */
+     watchpoint affected by gdbarch_decr_pc_after_break.  I haven't found any
+     target with both of these set in GDB history, and it seems unlikely to be
+     correct, so gdbarch_have_nonsteppable_watchpoint is not checked here.  */
 
   if (ecs->ws.kind != TARGET_WAITKIND_STOPPED)
     return;
@@ -1180,7 +1180,8 @@
 
   /* Find the location where (if we've hit a breakpoint) the
      breakpoint would be.  */
-  breakpoint_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK;
+  breakpoint_pc = read_pc_pid (ecs->ptid) - gdbarch_decr_pc_after_break
+					    (current_gdbarch);
 
   if (SOFTWARE_SINGLE_STEP_P ())
     {
@@ -3081,12 +3082,12 @@
   /* NOTE drow/2004-01-17: Is this still necessary?  */
   /* Make sure that the current_frame's pc is correct.  This
      is a correction for setting up the frame info before doing
-     DECR_PC_AFTER_BREAK */
+     gdbarch_decr_pc_after_break */
   if (target_has_execution)
     /* FIXME: cagney/2002-12-06: Has the PC changed?  Thanks to
-       DECR_PC_AFTER_BREAK, the program counter can change.  Ask the
+       gdbarch_decr_pc_after_break, the program counter can change.  Ask the
        frame code to check for this and sort out any resultant mess.
-       DECR_PC_AFTER_BREAK needs to just go away.  */
+       gdbarch_decr_pc_after_break needs to just go away.  */
     deprecated_update_frame_pc_hack (get_current_frame (), read_pc ());
 
   if (target_has_execution && breakpoints_inserted)
diff -urN src_neu/gdb/linux-nat.c dev_neu/gdb/linux-nat.c
--- src_neu/gdb/linux-nat.c	2007-05-10 23:36:00.000000000 +0200
+++ dev_neu/gdb/linux-nat.c	2007-06-08 07:06:44.000000000 +0200
@@ -1767,7 +1767,8 @@
   if (lp->status != 0
       && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
       && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
-				     DECR_PC_AFTER_BREAK))
+				     gdbarch_decr_pc_after_break
+				       (current_gdbarch)))
     {
       if (debug_linux_nat)
 	fprintf_unfiltered (gdb_stdlog,
@@ -1775,8 +1776,10 @@
 			    target_pid_to_str (lp->ptid));
 
       /* Back up the PC if necessary.  */
-      if (DECR_PC_AFTER_BREAK)
-	write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid);
+      if (gdbarch_decr_pc_after_break (current_gdbarch))
+	write_pc_pid (read_pc_pid (lp->ptid) - gdbarch_decr_pc_after_break
+						 (current_gdbarch),
+		      lp->ptid);
 
       /* Throw away the SIGTRAP.  */
       lp->status = 0;
diff -urN src_neu/gdb/linux-thread-db.c dev_neu/gdb/linux-thread-db.c
--- src_neu/gdb/linux-thread-db.c	2007-05-14 18:52:12.000000000 +0200
+++ dev_neu/gdb/linux-thread-db.c	2007-06-08 06:59:10.000000000 +0200
@@ -804,7 +804,7 @@
   int loop = 0;
 
   /* Bail out early if we're not at a thread event breakpoint.  */
-  stop_pc = read_pc_pid (ptid) - DECR_PC_AFTER_BREAK;
+  stop_pc = read_pc_pid (ptid) - gdbarch_decr_pc_after_break (current_gdbarch);
   if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr)
     return;
 
diff -urN src_neu/gdb/solib-sunos.c dev_neu/gdb/solib-sunos.c
--- src_neu/gdb/solib-sunos.c	2007-01-09 18:58:58.000000000 +0100
+++ dev_neu/gdb/solib-sunos.c	2007-06-08 06:59:10.000000000 +0200
@@ -777,9 +777,9 @@
      the PC as necessary after a breakpoint, disable the breakpoint, and
      add any shared libraries that were mapped in. */
 
-  if (DECR_PC_AFTER_BREAK)
+  if (gdbarch_decr_pc_after_break (current_gdbarch))
     {
-      stop_pc -= DECR_PC_AFTER_BREAK;
+      stop_pc -= gdbarch_decr_pc_after_break (current_gdbarch);
       write_register (PC_REGNUM, stop_pc);
     }
 
diff -urN src_neu/gdb/tracepoint.c dev_neu/gdb/tracepoint.c
--- src_neu/gdb/tracepoint.c	2007-06-08 06:33:09.000000000 +0200
+++ dev_neu/gdb/tracepoint.c	2007-06-08 07:07:08.000000000 +0200
@@ -2584,7 +2584,8 @@
      to the tracepoint PC.  If not, then the current frame was
      collected during single-stepping.  */
 
-  stepping_frame = (t->address != (read_pc () - DECR_PC_AFTER_BREAK));
+  stepping_frame = (t->address != (read_pc () - gdbarch_decr_pc_after_break
+						  (current_gdbarch)));
 
   for (action = t->actions; action; action = action->next)
     {



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