DEV Community

Bhaskar Sharma
Bhaskar Sharma

Posted on

1

Debugging Apache AGE

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 using sudo gdb
  • Attach the process ID that you found earlier using attach [ID here]
  • Next step is to tell gdb where the files are located. Do it using the dir command dir /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.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay