7

I am debugging a piece of software for an ARM32. I have been able to programmatically call functions in GDB using call, or even print. The problem is that I cannot seem to be able to set a breakpoint on a function, and then call it programmatically. For example, if I do:

break test_function
call test_function()

then I get the error message

The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function. When the function is done executing, GDB will silently stop.

Is there a way to programmatically call a function using GDB and step through it?

Randomblue
  • 112,777
  • 145
  • 353
  • 547

1 Answers1

6

then I get the error message

The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function. When the function is done executing, GDB will silently stop.

This isn't an error. This is exactly what you wanted to happen: a breakpoint fired, and you are now ready to debug.

Community
  • 1
  • 1
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Thanks. I got confused by the fact that the message "removed" the `(gdb)` prompt. I didn't realise I could continue debugging. – Randomblue Apr 26 '12 at 14:15
  • 1
    This is considered an error. When you run gdb in `-batch` mode this scenario triggers an error and exits gdb. Sure, when debugging manually, this message can be ignored, but I could not find a way to suppress this when running gdb scripts. – lead-free Jan 06 '22 at 23:56
  • I would also like to suppress this message when letting gdb automatically execute commands from a gdb script file. In interactive mode this message is presented as a informational note. In scripted mode, this message is interpreted as an error. Which I think is not nice. At least not for my use case. – Yunus King Jun 21 '22 at 10:24