8

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?

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I got confused by the fact that the message "removed" the (gdb) prompt. I didn't realise I could continue debugging.
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.
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.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.