jrgemignani opened a new issue, #313:
URL: https://github.com/apache/age/issues/313

   This task is to help you become familiar with the GDB debugger and how a 
command is processed in PostgreSQL.
   
   GDB is a full featured debugger with lots of capabilities. But, for most 
tasks, you only need to know a few commands and a basic instruction of how to 
use it. The GDB documentation is available online and if you have any 
questions. You can also comment here or message us if you have any questions.
   
   To debug a PostgreSQL session  -
   
   1. You will need to make sure that when you configured and built PostgreSQL, 
you did so with any debugging flags enabled.
   2. PostgreSQL needs to be running.
   3. The PostgreSQL session that you want to debug needs to be open.
   4. Your GDB session needs to be in the **bin** directory for the PostgreSQL 
distribution that you are using.
   5. You need to know the process of the **session** that you will be 
debugging.
   6. You can then execute the command `gdb -tui postgres the_pid_number`
   7. You will need to set one, or more, breakpoints (b) and then tell GDB to 
continue (c)
   
   The basic GDB commands are -
   
   - **b** for breakpoint, fx, `b exec_simple_query` or `b 930` 
   - **c** for continue - continues to the next breakpoint
   - **n** for next line
   - **s** for step into
   - **p** for print, fx, `p *node` 
   - **d** for delete all breakpoints
   - **q** for quit
   
   A good breakpoint for the start of a PostgreSQL session is 
`exec_simple_query`. Unless you know of a specific area or function that you 
need to look at. For this task, `exec_simple_query` is a good start.
   
   In this task you will use the debugger to trace the `SELECT 1;` statement 
from beginning to end (output). You do **not** need to worry about the planner 
(you'll know it when you see it). You do **not** need to worry about the 
details, just the general flow. It is **not** expected that you will completely 
understand most of what you see. However, it will help you get used to the 
debugger and a bit of how PostgreSQL processes commands.
   
   An example, to get you started -
   
   
![Image](https://user-images.githubusercontent.com/1505136/193316271-f119e8b2-1249-4383-b485-63c20918e5d8.png)
   
   The session will look something like the following -
   
   
![Image](https://user-images.githubusercontent.com/1505136/193317211-68092f26-275e-407a-ab24-392b7edaf4b9.png)
   
   From there you would enter in a break point and tell it to continue -
   
![Image](https://user-images.githubusercontent.com/1505136/193317100-22f102cc-2ad4-46eb-97ad-d5aae22f51a2.png)
   
   From your session enter the command `SELECT 1;` which is a good, and 
relatively simple one, to follow -
   
   
![Image](https://user-images.githubusercontent.com/1505136/193318651-f6d48359-169d-4541-936c-3605b4bee308.png)
   
   The debugger session will then break at `exec_simple_query ` -
   
   
![Image](https://user-images.githubusercontent.com/1505136/193318491-f0357b2a-0f31-4f10-a09d-2f8e30346abb.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to