c - 调试剥离程序时在 gdb 中加载伪调试符号

标签 c linux gdb x86-64 disassembly

我正在使用 gdb 调试一个剥离的程序。

(gdb) bt
#0  0x00007fffcb443650 in fooSnprintf () from ./install.so.1

我知道第三个参数是格式字符串:

(gdb) print (char*)$rdx
$9 = 0x7fffe8dd4050 "%u %s"

我如何让 gdb 在断点停止处显示函数参数,就像加载真正的调试符号时一样?

Breakpoint 1, fooSnprintf (a=0, b=0, fmt=0x40060a "%u %s") at test.c:3

我知道 hook-stop,但它是全局的,会在任何断点处触发。

这可行,但不方便:

define hook-stop
    if $rip == fooSnprintf
        print (char*)$rdx
    end
end

最佳答案

您可以使用 commands 指令将命令与特定断点相关联:

break fooSnprintf
commands
print (char*)$rdx
end

参见 here更多详情

关于c - 调试剥离程序时在 gdb 中加载伪调试符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37875752/

相关文章:

c - 阻塞读取直到指定数量的字节到达

python - root.query_pointer()._data 导致 CPU 使用率高

c++ - 链表中的段错误和 Linux 的调试选项

c - 我收到不支持的操作错误

c++ - Windows下4K屏幕截图并直接保存到缓冲区

c - 为什么套接字会拒绝连接?

linux - 在 linux (gitlab-runner) 中删除另一个用户生成的文件的权限

linux - SCP 不在 crontab 中工作,但在命令行上工作

c - 使用 SDL_image 保存 PNG 时出现段错误

debugging - 如何调试Mono本身?