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?
To call a function in the program, GDB has to temporarily modify the state of the inferior. This has potentially undesired side effects. Also, having GDB call nested functions is likely to be erroneous and may even crash the program being debugged.
A backtrace is a summary of how your program got where it is. It shows one line per frame, for many frames, starting with the currently executing frame (frame zero), followed by its caller (frame one), and on up the stack.
You can also set breakpoints on function names. To do this, just type "break [functionname]". gdb will stop your program just before that function is called. Breakpoints stay set when your program ends, so you do not have to reset them unless you quit gdb and restart it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With