GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

Click on the “Kernel Path“, select “Top/Star Public Account

Valuable Benefits, Delivered First-Hand!

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

1. GDB Debugging Postgres Kernel

GDB debugging of the Postgres kernel can generally be divided into three main categories.

  • Debugging the initialization process of the Postgres kernel postmaster daemon
  • Debugging the initialization implementation of the Postgres kernel backend process
  • Debugging the implementation of the backend process handling client DQL, DML, etc.

As shown in the figure below:

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)
GDB Debugging Postgres Kernel Categories

1.1 Debugging Postmaster

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(1) GDB debugging effect

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

1.2 Debugging Backend Process

  • Debugging Steps
GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)
GDB Debugging Backend Process

(1) Start the postmaster service

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(2) Get the postmaster process PID

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(3) gdb -p postmaster-PID

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(4) psql login to the postgres database

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

1.3 Debugging Backend Process Handling User DQL, DML, etc.

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(1) psql login to the postgres database

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(2) Get the PID of the psql program

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(3) gdb -p psql-PID

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)

(4) Execute a DML

GDB Debugging Postgres Kernel (Postmaster + Backend + Client DQL/DML Handling)
GDB Debugging DML Language (CREATE DATABASE)

Thank you for your attention, more exciting content in the next issue.

Like, bookmark, and share with one click

– The End –

Leave a Comment