背景
默认已经安装postgresql以及gdb等工具
默认已经初始化数据库以及启动数据库服务
找出postgres进程号
ps -ef|grep postgres
找到postgres进程号 1385
进入GDB调试
[minmin@localhost ~]$ gdb attach 1385
设置一个断点
(gdb) b ExecResult
Breakpoint 1 at 0x5bbdd0: file nodeResult.c, line 68.
再开启一个命令行窗口,连接数据库
[minmin@localhost ~]$ psql postgres
执行一条sql语句
postgres=# select 1;
返回GDB窗口,输入 c 命令
停留在断点上
查看堆栈,输入bt
完