public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch] Fix linux-ia64 on SIGILL for deleted breakpoint
Date: Tue, 20 Jul 2010 13:29:00 -0000	[thread overview]
Message-ID: <201007201428.59184.pedro@codesourcery.com> (raw)
In-Reply-To: <20100719085817.GA24395@host1.dyn.jankratochvil.net>

On Monday 19 July 2010 09:58:17, Jan Kratochvil wrote:
> Hi,
> 
> in some cases ia64 can generate SIGILL instead of SIGTRAP.  Guessing it is
> a CPU bug instead of Linux kernel bug (but I may be wrong).
> 	https://bugzilla.redhat.com/show_bug.cgi?id=615538
> 	http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/ia64-sigill.c?cvsroot=systemtap
> 
> Anyway FSF GDB already contains code for handling such cases (and not only
> SIGILL).  Just the time it gets executed the breakpoint which generated the
> signal may be already deleted and GDB stops with:
> 	Program received signal SIGILL, Illegal instruction.
> 
> I do not think it can be solved fully target-independent.  linux-nat.c already
> does some postponing of signals using
> 	kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
> and the moment linux-nat.c will read back such postponed signal its breakpoint
> may be already deleted (and thus it will never get to target-independent parts
> of GDB such as infrun.c).

That's a general problem with "real" SIGTRAP breakpoints as well.  linux-nat.c
handles this by "cancelling" the breakpoint, so that it is hit again later
on resume.  "cancelling" just means something like:

 Since we're not reporting the event to the user right now, just ignore
 it.  If the breakpoint is still inserted later,
 the next time we ask the target for an event (on resume), the inferior
 will trap on the same breakpoint again; we'll report it then, if so.

I don't see why this can't be extended to handle SIGILL breakpoints too
(with the difference that there's no PC adjustment required, you just
discard the signal).

Simply swapping SIGILL for SIGTRAP without accounting for the PC
adjustment that GDB will try to do on the SIGTRAP (thinking it was a real
SIGTRAP) makes me a bit nervous.

-- 
Pedro Alves

  parent reply	other threads:[~2010-07-20 13:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19  8:58 Jan Kratochvil
2010-07-19  9:04 ` Tristan Gingold
2010-07-19  9:20   ` Jan Kratochvil
2010-07-19  9:50     ` Tristan Gingold
2010-07-20 13:29 ` Pedro Alves [this message]
2010-07-23 22:19   ` Jan Kratochvil
2010-07-24 22:26     ` Pedro Alves
2010-07-25 18:52       ` Jan Kratochvil
2010-07-25 18:55         ` [patch] Fix linux-ia64 on SIGILL for deleted breakpoint [cleanup] Jan Kratochvil
2010-07-27 11:59           ` Pedro Alves
2010-07-27 21:22             ` Jan Kratochvil
2010-07-27 11:43         ` [patch] Fix linux-ia64 on SIGILL for deleted breakpoint Pedro Alves
2010-07-27 20:55           ` Jan Kratochvil

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=201007201428.59184.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).