ARM EABI Linux, breakpoints cause SIGILL and target dies

Ulrich Weigand uweigand@de.ibm.com
Fri Jan 20 10:45:00 GMT 2012


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



More information about the Gdb mailing list