调试C运行时 [英] Debugging the C runtime
本文介绍了调试C运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在之前和之后这是怎么回事的main()
使用GDB的详细研究。难道是不够的只是重新编译 -g
并链接针对glibc的?
I want to get a detailed look at what's going on both before and after main()
using GDB. Would it be enough just to recompile glibc with -g
and link against that?
推荐答案
如果你想使用调试器玩,你可以用GDB这种方式:
if you want to play with the debugger, you can use GDB this way:
- 安装了`glibc`包调试信息( rel=\"nofollow\">是做到这一点的方式Fedora的,我不知道其他发行版)
- 或点GDB到一致的调试文件目录:
- install the debug-info for the `glibc` package (here is the way to do it with Fedora, I don't know about the other distros)
- or point GDB to a consistent debug file directory:
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "/usr/lib/debug".
(gdb) set debug-file-directory ...
(这是 /usr/lib/debug/lib64/libc-2.14.so.debug
在我的系统)
- 告诉你的GDB`main`之前显示回溯:
(gdb) show backtrace past-entry
Whether backtraces should continue past the entry point of a program is off.
(gdb) set backtrace past-entry on
- ,那么你应该看看你要找的内容,并通过它浏览:
(gdb) where
#0 main () at test.c:4
#1 __libc_start_main (main=0x40050f <main>, argc=1,...) at libc-start.c:226
#2 _start ()
这篇关于调试C运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文