make
gdb chapter_3.3
root@hecs-270451192.168.0.179 16:37:50 [pwd:~/test]# gdb test
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-16.el8
Copyright (C)2018 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:
<http://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"...
Reading symbols from test...done.
#成功加载(gdb) list
198 int throw_num =50;199 printf("throw\n");200 throw 10;201}202 catch(...)203{204 int catch_num =100;205 printf("catch ...\n");206}207(gdb) quit
r #启动程序
q #退出程序
q #退出gdby
启动调试并添加参数
gdb dmserver
set args /home/dmdba/dmdbms/data/DMDB/dm.ini
r
(gdb) r
Starting program: /home/dmdba/dmdbms/bin/dmserver /home/dmdba/dmdbms/data/DMDB/dm.ini
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-164.el8.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".file dm.key not found, use default license![Detaching after fork from child process 2515887]
version info: develop
[New Thread 0x7fffe757a700 (LWP 2515888)][Detaching after fork from child process 2515889]
DM Database Server 64 V8 03134284058-20230621-193718-20046 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[New Thread 0x7fffa4703700 (LWP 2515890)][New Thread 0x7fffa161f700 (LWP 2515891)][New Thread 0x7fffa151e700 (LWP 2515892)][New Thread 0x7fffa141d700 (LWP 2515893)][New Thread 0x7fffa131c700 (LWP 2515894)]
Database mode =0, oguid =15324133[New Thread 0x7fffa121b700 (LWP 2515895)]
License will expire on 2024-06-21
[New Thread 0x7fff9819e700 (LWP 2515896)][New Thread 0x7fff881e0700 (LWP 2515897)][New Thread 0x7fff78aee700 (LWP 2515898)][New Thread 0x7fff789ed700 (LWP 2515899)]
附加到进程
ps -ef|grep dms
gdb attach pid
常用命令
#查看源码
list
#显示调用栈信息
backtrace
#查看信息
info threads
#设置日志
set logging on
set logging off
show logging
set logging file coredump.c
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了