DEV Community

Muhammad Farooq
Muhammad Farooq

Posted on

process to connect AGE code to GDB debugger in linux

1. go to the directory where you have installed postgres from source code.

2. start the server using following command:
bin/pg_ctl -D [db cluster name] -l [logfile (optional)] start
for example
bin/pg_ctl -D demo -l logfile start

3.now run psql utility using command:
bin/psql [db name]
for example
bin/psql demodb

4. now find the pid (process id) of the running postgres instance.

  • use system monitor and search for postgres as show in the fig below

Image description

  • or use command: ps -ef | grep postgres

5. open new terminal and run command: sudo gdb

6. now use command attach [pid] pid is process id for postgres that you have found in step 4

for example attach 8024

7. Attach the directory of AGE repository to GDB, so that GDB can find the code of AGE using:

For example:

dir /home/ununtu/age_installation/age

8. Now you can add breakpoints at required functions using:
for example:

b parse_cypher

Now when you pass a query through psql to postgres server, the query will stop at the breakpoints and you can move around the code using standard GDB commands.

I hope you have learnt something from this
if you have any question you can ask.

Visit for more about Apache AGE:

official website: https://age.apache.org/

Github: https://github.com/apache/age/

Top comments (0)