openGauss源码目录结构

  • src源码目录结构如下
    ├─bin -> gs_ctl等命令代码
    ├─common
    │ ├─backend -> 后端代码
    │ │ ├─catalog -> 数据字典相关
    │ │ ├─client_logic
    │ │ ├─lib -> 公共函数
    │ │ ├─libpq -> 前后端通信处理
    │ │ ├─nodes
    │ │ ├─parser -> SQL解析
    │ │ ├─pgxc_single
    │ │ ├─po
    │ │ ├─port -> 平台相关
    │ │ ├─regex -> 正则表达式
    │ │ ├─snowball -> 全文检索相关
    │ │ ├─tsearch -> 全文检索
    │ │ └─utils
    │ │ ├─adt -> 内置数据类型、函数
    │ │ ├─cache -> 缓存相关
    │ │ ├─error -> 错误处理
    │ │ ├─fmgr -> 函数管理
    │ │ ├─hash -> hash函数
    │ │ ├─init -> 数据库初始化相关
    │ │ ├─mb -> 多字节数据处理
    │ │ ├─misc
    │ │ ├─mmgr -> 内存管理
    │ │ ├─resowner -> 资源所有者管理
    │ │ ├─sort -> 排序处理
    │ │ └─time -> 事务处理
    │ ├─interfaces -> 应用程序接口
    │ │ ├─ecpg
    │ │ └─libpq
    │ ├─pgxc
    │ │ └─tools
    │ │ └─makesgml
    │ ├─pl -> 过程语言相关
    │ │ ├─plpgsql
    │ │ └─plpython
    │ ├─port -> 平台移植相关
    │ ├─template -> 平台相关设置模板
    │ ├─timezone -> 时区相关
    │ └─tutorial -> 指南
    ├─gausskernel
    │ ├─bootstrap -> 初始化数据库处理(bootstrap mode)
    │ ├─cbb
    │ │ ├─bbox
    │ │ ├─communication
    │ │ ├─extension -> 扩展 odbc接口,fdw
    │ │ ├─grpc -> rpc相关
    │ │ ├─instruments -> 维护相关
    │ │ ├─utils
    │ │ │ ├─aes -> 加解密
    │ │ │ ├─biginteger -> biginteger计算优化
    │ │ │ ├─bloomfilter -> 布隆过滤器
    │ │ │ ├─debug -> 分布式测试框架的例程
    │ │ │ ├─gssignal -> 信号管理实现
    │ │ │ ├─hll -> hll聚合
    │ │ │ ├─partition -> 分区相关
    │ │ │ ├─ssl -> ssl相关
    │ │ │ └─zfiles -> 压缩文件处理
    │ │ └─workload
    │ ├─dbmind
    │ ├─optimizer
    │ │ ├─commands -> 命令处理
    │ │ ├─geqo
    │ │ ├─path -> 访问路径相关
    │ │ ├─plan -> 查询优化
    │ │ ├─prep
    │ │ ├─rewrite -> 查询重写
    │ │ └─util
    │ ├─process
    │ │ ├─datasource
    │ │ ├─globalplancache -> 全局计划缓存
    │ │ ├─job -> 定时任务相关
    │ │ ├─main -> openGauss进程的主函数入口
    │ │ ├─postmaster -> 主线程
    │ │ ├─stream
    │ │ ├─tcop -> postgres的主要部分
    │ │ └─threadpool -> 线程池相关
    │ ├─runtime
    │ │ ├─codegen -> llvm相关
    │ │ ├─executor -> 执行器
    │ │ └─vecexecutor
    │ ├─security -> 数据库安全相关
    │ └─storage -> 存储引擎相关
    │ ├─access -> 各种方式的存取
    │ ├─buffer -> 缓存管理
    │ ├─bulkload -> fdw相关
    │ ├─cmgr
    │ ├─cstore -> 列式存储
    │ ├─dfs -> 分布式文件系统管理
    │ ├─file -> 文件管理
    │ ├─freespace -> 空闲空间映射管理
    │ ├─ipc -> 进程间通信
    │ ├─large_object -> 大对象访问
    │ ├─lmgr -> 锁管理
    │ ├─mot -> 内存表
    │ ├─page -> 页面访问
    │ ├─remote -> 远程访问
    │ ├─replication -> 主从复制相关
    │ └─smgr -> 存储管理
    ├─include -> 头文件
    ├─makefiles
    ├─test
    └─tools

  • gdb调试
    查看gdb帮助信息

[root@localhost ~]# gdb --help
This is the GNU debugger.  Usage:

    gdb [options] [executable-file [core-file or process-id]]
    gdb [options] --args executable-file [inferior-arguments ...]
    gdb [options] [--python|-P] script-file [script-arguments ...]

Options:

  --args             Arguments after executable-file are passed to inferior
  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  --batch            Exit after processing options.
  --batch-silent     As for --batch, but suppress all gdb stdout output.
  --return-child-result
                     GDB exit code will be the child's exit code.
  --cd=DIR           Change current directory to DIR.
  --command=FILE, -x Execute GDB commands from FILE.
  --eval-command=COMMAND, -ex
                     Execute a single GDB command.
                     May be used multiple times and in conjunction
                     with --command.
  --init-command=FILE, -ix Like -x but execute it before loading inferior.
  --init-eval-command=COMMAND, -iex Like -ex but before loading inferior.
  --core=COREFILE    Analyze the core dump COREFILE.
  --pid=PID          Attach to running process PID.
  --dbx              DBX compatibility mode.
  --directory=DIR    Search for source files in DIR.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --fullname         Output information used by emacs-GDB interface.
  --help             Print this message.
  --interpreter=INTERP
                     Select a specific interpreter / user interface
  -l TIMEOUT         Set timeout in seconds for remote debugging.
  --nw               Do not use a window interface.
  --nx               Do not read any .gdbinit files.
  --nh               Do not read .gdbinit file from home directory.
  --python, -P       Following argument is Python script file; remaining
                     arguments are passed to script.
  --quiet            Do not print version number on startup.
  --readnow          Fully read symbol files on first access.
  --readnever        Do not read symbol files.
  --se=FILE          Use FILE as symbol file and executable file.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  --tui              Use a terminal user interface.
  --version          Print version information and then exit.
  -w                 Use a window interface.
  --write            Set writing into executable and core files.
  --xdb              XDB compatibility mode.

At startup, GDB reads the following init files and executes their commands:
   * system-wide init file: /etc/gdbinit

For more information, type "help" from within GDB, or consult the
GDB manual (available as on-line info or a printed manual).
Report bugs to "".

[root@localhost ~]#

进入命令行后,可用"help all"查询所有可用命令,"help 命令"可查询该命令的相关解释

(gdb) help all

Command class: aliases

ni -- Step one instruction
rc -- Continue program being debugged but run it in reverse
rni -- Step backward one instruction
rsi -- Step backward exactly one instruction
si -- Step one instruction exactly
stepping -- Specify single-stepping behavior at a tracepoint
tp -- Set a tracepoint at specified line or function
tty -- Set terminal for future runs of program being debugged
where -- Print backtrace of all stack frames
ws -- Specify single-stepping behavior at a tracepoint

Command class: breakpoints

awatch -- Set a watchpoint for an expression
break -- Set breakpoint at specified line or function
break-range -- Set a breakpoint for an address range
catch -- Set catchpoints to catch events
catch assert -- Catch failed Ada assertions
catch catch -- Catch an exception
catch exception -- Catch Ada exceptions
catch exec -- Catch calls to exec
catch fork -- Catch calls to fork
catch load -- Catch loads of shared libraries
catch signal -- Catch signals by their names and/or numbers
catch syscall -- Catch system calls by their names and/or numbers
catch throw -- Catch an exception
catch unload -- Catch unloads of shared libraries
catch vfork -- Catch calls to vfork
clear -- Clear breakpoint at specified line or function
commands -- Set commands to be executed when a breakpoint is hit
condition -- Specify breakpoint number N to break only if COND is true
---Type  to continue, or q  to quit---

// 查看attach命令的用法
(gdb) help attach
Attach to a process or file outside of GDB.
This command attaches to another target, of the same type as your last
"target" command ("info files" will show your target stack).
The command may take as argument a process id or a device file.
For a process id, you must have permission to send the process a signal,
and it must have the same effective uid as the debugger.
When using "attach" with a process id, the debugger finds the
program running in the process, looking first in the current working
directory, or (if not found there) using the source file search path
(see the "directory" command).  You can also use the "file" command
to specify the program, and to load its symbol table.

// 查看设置断点的命令用法
(gdb) help break
Set breakpoint at specified line or function.
break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] [if CONDITION]
PROBE_MODIFIER shall be present if the command is to be placed in a
probe point.  Accepted values are `-probe' (for a generic, automatically
guessed probe type) or `-probe-stap' (for a SystemTap probe).
LOCATION may be a line number, function name, or "*" and an address.
If a line number is specified, break at start of code for that line.
If a function is specified, break at start of code for that function.
If an address is specified, break at that exact address.
With no LOCATION, uses current execution address of the selected
stack frame.  This is useful for breaking on return to a stack frame.

THREADNUM is the number from "info threads".
CONDITION is a boolean expression.

Multiple breakpoints at one place are permitted, and useful if their
conditions are different.

Do "help breakpoints" for info on other commands dealing with breakpoints.

// next, step
(gdb) help next
Step program, proceeding through subroutine calls.
Usage: next [N]
Unlike "step", if the current source line calls a subroutine,
this command does not enter the subroutine, but instead steps over
the call, in effect treating it as a single source line.
(gdb) help step
Step program until it reaches a different source line.
Usage: step [N]
Argument N means step N times (or till program stops for another reason).
(gdb)

你可能感兴趣的:(openGauss源码目录结构)