调试 openGauss server main 函数方法

假设单机server启动命令为:

snippet.bash
[yz@test openGauss]$ gs_ctl start -D /opt/openGauss/gauss_data -l logfile

单机启动过程

gs_ctl

使用 gdb 调试运行gs_ctl:

snippet.bash
[yz@test openGauss]$ gdb --args gs_ctl start -D /opt/openGauss/gauss_data -l logfile
……
(gdb) b start_postmaster
Breakpoint 1 at 0x4081ac: file pg_ctl.cpp, line 711.
(gdb) r
Starting program: /opt/openGauss/openGauss-server/dest/bin/gs_ctl stop -D /opt/openGauss/gauss_data -l logfile
……
(gdb) 

gaussdb

调试运行gaussdb:

snippet.bash
[yz@test openGauss]$ export GAUSSHOME=/opt/openGauss/openGauss-server/dest/
[yz@test openGauss]$ gdb --args /opt/openGauss/openGauss-server/dest/bin/gaussdb -D /opt/openGauss/gauss_data
……
(gdb) b main
Breakpoint 1 at 0x165ab1a: file main.cpp, line 79.
(gdb) r

注:

/opt/openGauss/openGauss-server/dest/ 是openGauss编译后的程序目录。