I used this tutorial from dev.to to setup and use the debugger. Refer to section 3, hope this will be helpful: -
https://dev.to/moeedk/set-up-apache-age-for-development-installing-and-modifying-the-source-5889
Once you're done attaching the process, you need to update the search path of gdb to tell it where the files are.
dir /path/to/age
GDB commands for debugging: -
b for breakpoint, (b )
c for continue - continues to the next breakpoint
n for next line
s for step into
p for print, (p *) for pointers
bt for call stack
d for delete all breakpoints
list for context
q for quit
To set up a breakpoint for a function write: -
b <function_name>
When the breakpoint is set, run the query.
But since you've attached the process to GDB, the code should go into a blocked state.
Press c
(continue) to continue the code until the breakpoint.
finish
will run the code till the end of the function.
command bt
(backtrace) can be used to checkout the stack so far.
list
can tell you where you are in the code.
Check the link for more detailed example.