public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: n.sherlock@gmail.com (Nicholas Sherlock)
Cc: gdb@sourceware.org
Subject: Re: ARM EABI Linux, breakpoints cause SIGILL and target dies
Date: Fri, 20 Jan 2012 10:45:00 -0000	[thread overview]
Message-ID: <201201201044.q0KAimIE006755@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <CADwwazYxTvu4Qf=a+x2Ot4nXBuJNxOCdKw7mZcNHtgCZLtUZzw@mail.gmail.com> from "Nicholas Sherlock" at Jan 20, 2012 03:45:11 PM

Nicholas Sherlock wrote:

> Running a.out alone or with GDB works fine, but any operation that
> causes GDB to set a breakpoint results in the target being killed by
> SIGILL:
[snip]
> So I would expect that this would work. Another piece of the puzzle, I
> have a different phone here running a different Linux kernel, but the
> same Ubuntu usermode binaries, where GDB breakpoints work perfectly:
[snip]
> How do I begin to debug this problem? I have the source code available
> for both kernels if there is something to investigate there.

So there's two issues here:

- The kernel is supposed to recognize the special undefined instructions
  use to implement breakpoints, and deliver SIGTRAP instead of SIGILL if
  execution hits one of those.  It may be that the older of the two kernels
  does not properly handle this, in particular for Thumb-2 breakpoints
  which were added only recently.

  If you have the kernel sources, you might want to compare the routines
  installed via register_undef_hook in arch/arm/kernel/ptrace.c.

- Even on old kernels that return SIGILL, there is apparently some code
  in GDB that tries to recognize breakpoints anyway.  It may well be
  that this code does not (any longer) work correctly; it is never
  exercised on recent kernels, so a bug might have crept in ...

  Can you do a run with "set debug infrun 1" in the case where you
  get the SIGILL?


Bye,
Ulrich


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

  reply	other threads:[~2012-01-20 10:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADwwazYuWuicgqL=4JyxbdoN+6MmVg354bD6UTzC=Ew-po8JzA@mail.gmail.com>
2012-01-20  2:45 ` Nicholas Sherlock
2012-01-20 10:45   ` Ulrich Weigand [this message]
2012-01-22 23:34     ` Nicholas Sherlock
2012-01-23  1:29       ` Nicholas Sherlock
2012-01-23 13:29         ` Ulrich Weigand
2012-01-24  2:44           ` Nicholas Sherlock
2012-01-24  3:02             ` Nicholas Sherlock
2012-01-24 13:37               ` 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=201201201044.q0KAimIE006755@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb@sourceware.org \
    --cc=n.sherlock@gmail.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).