简体   繁体   English

使用 gdb 在特定行设置断点

[英]Set breakpoint at specific line with gdb

I have two files:我有两个文件:

bomb.c and bomb (executable). bomb.cbomb (可执行)。 In the .c file there are calls to the bomb file..c文件中有对bomb文件的调用。 I cannot see the inside of the bomb file though, only, of course, the disassembly.我看不到炸弹文件的内部,当然只能看到反汇编。

I'm currently running on Linux, and I'm trying to set some breakpoints to better understand the inside of the bomb file.我目前在 Linux 上运行,我正在尝试设置一些断点以更好地了解炸弹文件的内部。

I do:我愿意:

gdb bomb
b 0x0000000000401061

But it doesn't work, since I get the error:但它不起作用,因为我收到错误:

Function "0x0000000000401061" not defined.

From the disassembly of bomb I was able to recognize some function, and if I do:bomb的拆解中,我能够识别出一些 function,如果我识别出:

b [function name]

the breakpoint is set.断点已设置。

I wish to set it into a specific line, which is not a function. How can I do that?我想把它设置到一个特定的线路,而不是 function。我该怎么做?

The solution that worked for me:对我有用的解决方案:

b *0x401061

Instead of:代替:

b 0x0000000000401061

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM