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]

Re: RFC: Updates support for breakpoints that generate SIGILL


Daniel Jacobowitz wrote:

> 2010-01-28  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* infrun.c (prepare_to_proceed): Handle other signals which might
> 	match a breakpoint.
> 	(handle_inferior_event): Move the check for unusual breakpoint
> 	signals earlier.


Unfortunately this change broke Cell/B.E. debugging.

The problem is that with the change, handle_inferior_event will now
*always* look up a regcache, even when the process has exited.

Before the patch, the code has always taken care to avoid that; while
some targets don't mind, others will break (in particular, the Cell/B.E.
multi-arch target does).

The patch below changes this to only look up the regcache when needed
(in particular, this implies the process is still there).

Tested on Cell/B.E. (ppc32 and ppc64) with no regressions.

Does this look OK to you?

Bye,
Ulricu


ChangeLog:

	* infrun.c (handle_inferior_event): Do not look up regcache
	for exited processes.

Index: gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.428
diff -u -p -r1.428 infrun.c
--- gdb/infrun.c	29 Jan 2010 15:40:21 -0000	1.428
+++ gdb/infrun.c	8 Feb 2010 18:03:29 -0000
@@ -2664,7 +2664,6 @@ handle_inferior_event (struct execution_
 {
   struct frame_info *frame;
   struct gdbarch *gdbarch;
-  struct regcache *regcache;
   int sw_single_step_trap_p = 0;
   int stopped_by_watchpoint;
   int stepped_after_stopped_by_watchpoint = 0;
@@ -2735,18 +2734,21 @@ handle_inferior_event (struct execution_
      non-executable stack.  This happens for call dummy breakpoints
      for architectures like SPARC that place call dummies on the
      stack.  */
-  regcache = get_thread_regcache (ecs->ptid);
   if (ecs->ws.kind == TARGET_WAITKIND_STOPPED
       && (ecs->ws.value.sig == TARGET_SIGNAL_ILL
 	  || ecs->ws.value.sig == TARGET_SIGNAL_SEGV
-	  || ecs->ws.value.sig == TARGET_SIGNAL_EMT)
-      && breakpoint_inserted_here_p (get_regcache_aspace (regcache),
-				     regcache_read_pc (regcache)))
+	  || ecs->ws.value.sig == TARGET_SIGNAL_EMT))
     {
-      if (debug_infrun)
-	fprintf_unfiltered (gdb_stdlog,
-			    "infrun: Treating signal as SIGTRAP\n");
-      ecs->ws.value.sig = TARGET_SIGNAL_TRAP;
+      struct regcache *regcache = get_thread_regcache (ecs->ptid);
+
+      if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
+				      regcache_read_pc (regcache)))
+	{
+	  if (debug_infrun)
+	    fprintf_unfiltered (gdb_stdlog,
+				"infrun: Treating signal as SIGTRAP\n");
+	  ecs->ws.value.sig = TARGET_SIGNAL_TRAP;
+	}
     }
 
   /* Mark the non-executing threads accordingly.  In all-stop, all

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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