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

相关推荐
aifannihao12 小时前
ON CONFLICT 冲突后返回空:sqlite3 实测 get-or-create
数据库·python·postgresql·sqlite3·标准库
Decay__1 天前
PostgreSQL 用户权限与安全 —— 角色体系、GRANT 授权、pg_hba.conf 认证、行级安全与审计
运维·数据库·sql·postgresql
zhangjw342 天前
2-4 集合运算 union /union all /intersect/except
数据库·postgresql
Decay__2 天前
PostgreSQL DBA 日常运维手册 —— 会话、锁阻塞、慢查询、膨胀与每日巡检
运维·数据库·sql·postgresql
Decay__3 天前
PostgreSQL 安装部署实战 —— PGDG yum 源安装、initdb 初始化与 postgresql.conf 参数调优
运维·数据库·sql·postgresql
她的男孩3 天前
状态默认填了 DRAFT,同步后却变成 '''DRAFT'':Forge Admin 清洗 PG 的 COLUMN_DEFAULT
spring boot·低代码·postgresql
Flynt3 天前
Postgres 19 实测:表膨胀清理,VACUUM FULL 锁到读写归零,REPACK 没停一秒
数据库·postgresql·性能优化
ZhengEnCi4 天前
覆盖索引是什么:用借书和外卖看懂回表这件事
sql·mysql·postgresql
ZhengEnCi5 天前
覆盖索引怎么设计:从回表代价到 MySQL 与 PostgreSQL 的落地写法
sql·mysql·postgresql
利威尔xu7 天前
PostgreSQL 索引失效 4 类:函数运算让查询全表扫描拖垮性能
开发语言·数据库·postgresql·性能优化·索引优化