Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: dan@codesourcery.com (Daniel Jacobowitz)
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: Updates support for breakpoints that generate SIGILL
Date: Mon, 08 Feb 2010 19:35:00 -0000	[thread overview]
Message-ID: <201002081935.o18JZIMA023833@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20100128215914.GB2813@caradoc.them.org> from "Daniel Jacobowitz" at Jan 28, 2010 04:59:14 PM

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


  parent reply	other threads:[~2010-02-08 19:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 21:59 Daniel Jacobowitz
2010-01-29  4:10 ` Joel Brobecker
2010-01-29 15:40   ` Daniel Jacobowitz
2010-02-08 19:35 ` Ulrich Weigand [this message]
2010-02-08 19:45   ` Daniel Jacobowitz
2010-02-08 19:51     ` Ulrich Weigand

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=201002081935.o18JZIMA023833@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=dan@codesourcery.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