c - GDB 没有那个文件或目录

标签 c linux debugging assembly gdb

我正在学习 OpenSecurityTraining 中的这些类(class).

我已经到了实验室部分,我必须在 CMU 炸弹上训练自己。他们提供了一个 x86_64 编译的 CMU Bomb,你可以在这里找到它来训练:CMU Bomb x86-64最初来自 CMU Labs for Computer Systems: A Programmer's Perspective (CS:APP) 1st edition 的 32 位炸弹.

我有一个虚拟化的 64 位 Elementary OS 发行版,我在其中使用 GDB 毫无问题地反汇编了 CMU Bomb。现在,我有一个 64 位 Ubuntu 14.04 LTS(未虚拟化),当我尝试重现我在 Elementary OS 上做的原因时,我得到了著名的错误。

我运行这些命令:

gdb ./bomb-x64
(gdb) b main
Breakpoint 1 at 0x400dbd: file bomb.c, line 37. -- why bomb.c ?
(gdb) r
...
bomb.c: no such file or directory

编辑:我可以在 CMU Bomb 的其他函数上创建断点,它按预期工作。
示例:

(gdb) b phase_1
Breakpoint 3 at 0x400f00
(gdb) r

Breakpoint 1, 0x0000000000400f00 in phase_1 ()
(gdb) disas
Dump of assembler code for function phase_1:
=> 0x0000000000400f00 <+0>: sub    $0x8,%rsp
   0x0000000000400f04 <+4>: mov    $0x4023b0,%esi
   0x0000000000400f09 <+9>: callq  0x401308 <strings_not_equal>
   0x0000000000400f0e <+14>:    test   %eax,%eax
   0x0000000000400f10 <+16>:    je     0x400f17 <phase_1+23>
   0x0000000000400f12 <+18>:    callq  0x40140a <explode_bomb>
   0x0000000000400f17 <+23>:    add    $0x8,%rsp
   0x0000000000400f1b <+27>:    retq   
End of assembler dump.

我听说过 ia32-libs 但它没有做任何事情,因为我在 64 位 Ubuntu 上运行 64 位编译的 CMU Bomb,我错了吗?

最佳答案

使用dir命令设置源码路径

dir /usr/src/debug

在上面的路径中。您的代码应该出现。

关于c - GDB 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27850335/

相关文章:

c - C 语言中内存地址可以移植吗?

C中的契约(Contract)设计模式

c++ - 可重现 : Why does passing this object in C break my code?

c++ - Opencv2 示例程序不工作

c++ - 为什么 Visual Studio 在调试时以不同方式对待 ANSI 转义代码?

c - 使用数组的段错误

c - Linux 管道 : Bad file descriptor in functions read and write

linux - 如何确定 Linux 上的日志文件文件夹?

JavaScript 函数未在 Firefox 中定义?

c - Hangman 程序帮助(C 编程简介)