Introduction
This blog-post is aimed at introducing the user with using gdb
to debug AGE. To know how to install PostgreSQL or Apache AGE for debugging, the reader is advised to check the previous blogposts.
Steps to debug
- First, load the AGE extension in your database.
- Once done with that, open a new terminal window and run the following command to get the
process ID
of PostgreSQL database server.ps -ef | grep postgres
- This will give you a lot of ids, however, check for the one that says
postgres: username postgres [local] idle
- Next start
gdb
usingsudo gdb
- Attach the
process ID
that you found earlier usingattach [ID here]
- Next step is to tell
gdb
where the files are located. Do it using thedir
commanddir /home/capnspek/Downloads/age/
GDB commands:
b is for breakpoint
c is for continue - continues to the next breakpoint
n is for next line
s is for step into
p is for print
bt is for backtrace (call stack)
d is for delete all breakpoints
list is for context
q is for quit
- You can set a break point at any function or line that you like (that you're debugging), for example
b parse_cypher
The above command will set a break point on parse_cypher function.
If you run any query in AGE now, it will go into a paused state once the execution hits the function. Then you can continue the execution, or step it line by line using gdb terminal.
Top comments (0)