首页 > 解决方案 > 如何在 Linux 中调试无调试符号的 C 程序?

问题描述

int goo(int g)
{
    int filedesc = open("testfile.txt", O_WRONLY | O_APPEND);
}

int foo(int f)
{
    goo(2);
}

int main()
{
    foo(1);
}

gcc no_symbol.c -o no_symbol

在 GDB 中

(gdb) r
Starting program: /home/samuel/project/no_symbol 

Breakpoint 1, 0x000055555555463e in goo ()
(gdb) bt full
#0  0x000055555555463e in goo ()
No symbol table info available.
#1  0x0000555555554676 in foo ()
No symbol table info available.
#2  0x0000555555554687 in main ()
No symbol table info available.

有没有什么方法我可以在没有源代码的情况下知道 g 和 f 的值?

标签: clinuxgdb

解决方案


推荐阅读