4

I am having a problem using a statically compiled QEMU arm version. I am trying to debug an application from an embedded device. Everything seems to work fine except breakpoints on other threads. I am using IDAs remote gdb function to debug. Instead of breaking here enter image description here

it gives me a SIGTRAP and goes to here enter image description here Using hardware breakpoints also doesn't do the trick.

Edit: The problem doesn't seem to be IDA itself. I was using qemu-arm-static version 2.0.0. IDA seems to have the bug I mentioned above. Using commandline gdb-multiarch to try and debug it I get the following error after hitting the breakpoint:

Program received signal SIGTRAP, Trace/breakpoint trap.
0xf67c523c in ?? ()
(gdb) info registers
/build/buildd/gdb-7.7.1/gdb/findvar.c:292: internal-error: value_of_register_lazy: Assertion `frame_id_p (get_frame_id (frame))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

/build/buildd/gdb-7.7.1/gdb/findvar.c:292: internal-error: value_of_register_lazy: Assertion `frame_id_p (get_frame_id (frame))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

This happens with the 2.0.0 qemu version as well as the 2.8.0 version I got from here

5
  • This may be an IDA related issue. Please consider crossposting to their support channels as well.
    – Nordwald
    Mar 26, 2017 at 13:13
  • @Nordwald Do you mean contacting their support?
    – VegaRoXas
    Mar 26, 2017 at 13:21
  • @Nordwald I think this isn't an IDA related issue. It is either a QEMU issue or a gdb issue. I have edited my question above.
    – VegaRoXas
    Mar 27, 2017 at 21:07
  • In that case, is any of these reports related? sourceware.org/bugzilla/show_bug.cgi?id=17700 sourceware.org/bugzilla/show_bug.cgi?id=17379
    – Nordwald
    Mar 28, 2017 at 5:23
  • @Nordwald the first one might be related since the web server probably handles the requests in a new thread. My application also is a webserver but also not really. It doesn't get files from the filesystem it just creates some defined responses
    – VegaRoXas
    Mar 28, 2017 at 6:38

1 Answer 1

3

QEMU user-mode emulation (e.g. qemu-arm, qemu-arm-static) does not support debugging multiple threads simultaneously.

You must use qemu-arm-system and run an entire ARM kernel.

Separately, your QEMU and GDB are very out-of-date. I recommend updating:

  • QEMU / qemu-static. The latest version is 2.10.1. QEMU 2.0.0 is over three years old.
  • gdb / gdb-multiarch / gdbserver. The latest version is 8.0.1. GDB 7.7 is over three years old.

Finally, if you do not need to debug multiple threads simultaneously, you can attach to the "appropriate" thread by using

  • set detach-on-fork off
  • set follow-fork-mode [parent|child] as appropriate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.