I’m going through APACHE AGE repository and need to debug through the code to understand the workflow from querying to getting the result but I don’t know how to Connect AGE Code with GDB debugger
can someone please tell me the steps to do it.
>Solution :
1st step: Start database server using:
pg_ctl -D DatabaseClusterName start
2nd step: Run psql utlity using:
psql postgres
3rd step: Find PID(process Id) of postgre instance as shown in following screenshot. You can use any utility for example ps -ef | grep postgres. I have used system monitor(Linux).
So PID is 618131
Step 4: Run GDB in another terminal using:
Sudo GDB
Step 5: In the same terminal use command:
attach 618131
to attach the PostgreSQL server to GDB.
Step 6: Attach the directory of AGE repository to GDB, so that GDB can find the code of AGE using:
For example:
dir /home/kamleshk/age_installation/age
Step 7: 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.
You can further look into step by step guide at the this link.
