<<gdb使用经验技巧>>
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
<<gdb使用经验技巧>>
Tags: devel,linux,c,cpp
1. 用gcc编译须注意: .o文件必须放在.a文件前
用gcc/g++链接.o文件时, .o文件必须放在.a文件前, 否则出错: "找不到相关库函数的定义":
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:74: undefined reference to `glViewport@16'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:75: undefined reference to `glMatrixMode@4'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:77: undefined reference to `glLoadIdentity@0'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:81: undefined reference to `glFrustum@48'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:83: undefined reference to `glMatrixMode@4'
g++ file1.o file2.o file3.o lib1.a lib2.a -o a.out // 正确写法
g++ lib1.a lib2.a file1.o file2.o file3.o -o a.out // 错误写法
2. watch
You can force gdb to use only software watchpoints with the set
can-use-hw-watchpoints 0 command. With this variable set to zero, gdb will
never try to use hardware watchpoints, even if the underlying system supports
them. (Note that hardware-assisted watchpoints that were set before setting
can-use-hw-watchpoints to zero will still use the hardware mechanism of
watching expression values.)
set can-use-hw-watchpoints
Set whether or not to use hardware watchpoints.
show can-use-hw-watchpoints
Show the current mode of using hardware watchpoints.
(gdb)
// Use software watchpoints
(gdb) set can-use-hw-watchpoints 0
// Use hardware watchpoints
(gdb) set can-use-hw-watchpoints 1
100. FAQ
100.1 Target description specified unknown architecture "arm"
用gdb与gdbserver调试, gdb端有可能报如下的错误和警告, 原因一般是由于gdb与
gdbserver不匹配! 解决的办法是使用配套的gdb与gdbserver!
(gdb) target remote 192.168.3.196:2345
Remote debugging using 192.168.3.196:2345
warning: while parsing target description (at line 1): Target description specified unknown architecture "arm"
warning: Could not load XML target description; ignoring
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x00000000 in ?? ()
(gdb)
Tags: devel,linux,c,cpp
1. 用gcc编译须注意: .o文件必须放在.a文件前
用gcc/g++链接.o文件时, .o文件必须放在.a文件前, 否则出错: "找不到相关库函数的定义":
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:74: undefined reference to `glViewport@16'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:75: undefined reference to `glMatrixMode@4'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:77: undefined reference to `glLoadIdentity@0'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:81: undefined reference to `glFrustum@48'
E:/desktop_item/tmp/0virtual/nehe2/LVHM/Chess/CGfxOpenGL.cpp:83: undefined reference to `glMatrixMode@4'
g++ file1.o file2.o file3.o lib1.a lib2.a -o a.out // 正确写法
g++ lib1.a lib2.a file1.o file2.o file3.o -o a.out // 错误写法
2. watch
You can force gdb to use only software watchpoints with the set
can-use-hw-watchpoints 0 command. With this variable set to zero, gdb will
never try to use hardware watchpoints, even if the underlying system supports
them. (Note that hardware-assisted watchpoints that were set before setting
can-use-hw-watchpoints to zero will still use the hardware mechanism of
watching expression values.)
set can-use-hw-watchpoints
Set whether or not to use hardware watchpoints.
show can-use-hw-watchpoints
Show the current mode of using hardware watchpoints.
(gdb)
// Use software watchpoints
(gdb) set can-use-hw-watchpoints 0
// Use hardware watchpoints
(gdb) set can-use-hw-watchpoints 1
100. FAQ
100.1 Target description specified unknown architecture "arm"
用gdb与gdbserver调试, gdb端有可能报如下的错误和警告, 原因一般是由于gdb与
gdbserver不匹配! 解决的办法是使用配套的gdb与gdbserver!
(gdb) target remote 192.168.3.196:2345
Remote debugging using 192.168.3.196:2345
warning: while parsing target description (at line 1): Target description specified unknown architecture "arm"
warning: Could not load XML target description; ignoring
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x00000000 in ?? ()
(gdb)
A beautiful web dashboard for Linux
最近提交(Master分支:4 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)