PostgreSQL源码1:select 1

/opt/pg18d/bin/psql -p 5435

postgres=# select pg_backend_pid();

pg_backend_pid


2543087

(1 row)

postgres=#

gdb postgres 2543087

gdb postgres 2543087

GNU gdb (Red Hat Enterprise Linux) 16.3-2.0.1.el9

Copyright (C) 2024 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html\>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Type "show copying" and "show warranty" for details.

This GDB was configured as "x86_64-redhat-linux-gnu".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<https://www.gnu.org/software/gdb/bugs/\>.

Find the GDB manual and other documentation resources online at:

<http://www.gnu.org/software/gdb/documentation/\>.

For help, type "help".

Type "apropos word" to search for commands related to "word"...

postgres: No such file or directory.

Attaching to process 2543087

Reading symbols from /opt/pg18d/bin/postgres...

Reading symbols from /lib64/libz.so.1...

Reading symbols from /usr/lib/debug/usr/lib64/libz.so.1.2.11-1.2.11-40.el9.x86_64.debug...

Reading symbols from /lib64/libm.so.6...

Reading symbols from /usr/lib/debug/usr/lib64/libm.so.6-2.34-275.0.1.el9_8.x86_64.debug...

Reading symbols from /lib64/libicui18n.so.67...

Reading symbols from /usr/lib/debug/usr/lib64/libicui18n.so.67.1-67.1-10.el9_6.x86_64.debug...

Reading symbols from /lib64/libicuuc.so.67...

Reading symbols from /usr/lib/debug/usr/lib64/libicuuc.so.67.1-67.1-10.el9_6.x86_64.debug...

Reading symbols from /lib64/libc.so.6...

Reading symbols from /usr/lib/debug/usr/lib64/libc.so.6-2.34-275.0.1.el9_8.x86_64.debug...

Reading symbols from /lib64/ld-linux-x86-64.so.2...

Reading symbols from /lib64/libstdc++.so.6...

Reading symbols from /usr/lib/debug/usr/lib64/libstdc++.so.6.0.29-11.5.0-14.0.1.el9.x86_64.debug...

Reading symbols from /lib64/libgcc_s.so.1...

Reading symbols from /usr/lib/debug/usr/lib64/libgcc_s-11-20240719.so.1-11.5.0-14.0.1.el9.x86_64.debug...

Reading symbols from /lib64/libicudata.so.67...

Reading symbols from /usr/lib/debug/usr/lib64/libicudata.so.67.1-67.1-10.el9_6.x86_64.debug...

(No debugging symbols found in /usr/lib/debug/usr/lib64/libicudata.so.67.1-67.1-10.el9_6.x86_64.debug)

Thread debugging using libthread_db enabled

Using host libthread_db library "/lib64/libthread_db.so.1".

0x00007fef2410fdda in epoll_wait (epfd=6, events=0x2ef6990, maxevents=1, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30

30 return SYSCALL_CANCEL (epoll_wait, epfd, events, maxevents, timeout);

(gdb)

设置断点:

(gdb) b ExecResult

Breakpoint 1 at 0x7c6677: file nodeResult.c, line 69.

(gdb)

psql执行select 1;

postgres=# select 1;

gdb输入c

(gdb) c

Continuing.

Breakpoint 1, ExecResult (pstate=0x2fd3768) at nodeResult.c:69

69 ResultState *node = castNode(ResultState, pstate);

(gdb)

gdb输入bt

gdb输入list可以查看当前

gdb输入up,down

相关推荐
IvorySQL3 小时前
PostgreSQL 日报|内核多项缺陷修复与数据校验补丁推进(8 月 27 日)
数据库·postgresql·区块链
Cloud云卷云舒11 小时前
【运营商数据库】实战淬炼,规模落地 | 中国移动HaishanDB年中总结会圆满召开
数据库·postgresql·ai-native·haishandb·移动云海山数据库
xuefuhe21 小时前
PostgreSQL Page Layout
postgresql
云贝贝贝1 天前
PostgreSQL 生产环境备份恢复与高可用实战
数据库·postgresql
wangchunyu1141 天前
PostgreSQL 入门与实践:从零搭建一个 CRUD 应用
数据库·postgresql
m0_579146651 天前
PostgreSQL+Milvus分层存储架构:双写一致性与CAP理论取舍分析
postgresql·架构·milvus·cap
瀚高PG实验室1 天前
PostgreSQL CREATE TYPE 未检查 multirange schema 的 CREATE 权限HGVE-2026-E007
数据库·postgresql·瀚高数据库
夏炳辉.1 天前
零基础Linux PostgreSQL(psql)从安装到集群高可用全套学习大纲
linux·学习·postgresql
像风一样自由20201 天前
15.Milvus是什么?为什么RAG系统经常使用它?
postgresql·大模型·milvus·rag·智能体