11

I tried to debug a program with gdb in Raspbian, but all I get is:

Program received signal SIGILL, Illegal instruction.
0xb6fe8acc in ?? () from /lib/ld-linux-armhf.so.3

It doesn't help to set the SIGILL handle to nostop (handle SIGILL nostop):

Program received signal SIGILL, Illegal instruction.

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.

All backtrace I get is:

#0  0xb6fe8acc in ?? () from /lib/ld-linux-armhf.so.3
#1  0x00000000 in ?? ()

If I start the program outside of gdb, I get a normal C++ exception (that I would like to debug).

All software were updated to latest version from the raspbian repositories. Further I tried the raspberry pi foundation kernel "3.18.9+" and also the raspbain kernel "3.18.0-trunk-rpi" (I need some custom kernel modules). I can debug the same program on my main machine without any problems.

Update: Debugging works as expected with kernel "3.12-1-rpi".

What is causing this error?

someonr
  • 253
  • 1
  • 2
  • 9
  • Did you tried handle SIGILL pass nostop ? – mpromonet Mar 25 '15 at 18:31
  • @mpromonet Since pass is by default set, it shouldn't make a difference, and it didn't make any. Same result as with handle SIGILL nostop – someonr Mar 25 '15 at 18:34
  • And there's no meaningful backtrace (bt)? I think you need to think about providing more context here if you seriously expect someone to explain "What is causing this error?" based only on an illegal instruction in the linker/loader (ld-linux-armhf). – goldilocks Mar 25 '15 at 18:47
  • I couldn't get any meaningful backtrace (see edited question). I'll try to create a small example. Also, I'm confused that I don't get an illegal opcode without gdb. – someonr Mar 25 '15 at 19:01
  • Running inside a debugger sometimes does change things up a bit, which can be pretty frustrating on occasion. I don't know why this is. Did you compile -g? You might get something instead of ?? in the backtrace. – goldilocks Mar 25 '15 at 19:17
  • 1
    stack seems smashed, valgrind could helps ? – mpromonet Mar 25 '15 at 19:20
  • I compiled with "-g". I never used valgrind before, I might take a look at it. I just tested with "3.12-1-rpi" kernel and could debug. This is really strange (for me). – someonr Mar 25 '15 at 20:46
  • valgrind is awesome, you're going to love it once you get what it does. It will spot memory violations (e.g., buffer overflows), which can be the cause of all manner of grief. You may have to connect the dots (violation to problem) yourself, but since you don't want any violations, just plain getting rid of them may magically solve problems that appeared magically earlier. – goldilocks Mar 25 '15 at 21:01

1 Answers1

5

This looks exactly the same as this issue: https://github.com/raspberrypi/linux/issues/766

Fixed four days ago.

Doug Edey
  • 194
  • 5