Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDB no such file or directory

I'm following these lessons from OpenSecurityTraining.

I've reached the lab part where I've to train myself on a CMU Bomb. They provide a x86_64 compiled CMU Bomb that you can find here to train on : CMU Bomb x86-64 originally from a 32-bit bomb from CMU Labs for Computer Systems: A Programmer's Perspective (CS:APP) 1st edition.

I had a virtualized 64 bits Elementary OS distribution where I disassembled the CMU Bomb without problems using GDB. Now, I've a 64 bits Ubuntu 14.04 LTS (not virtualized) and when I try to reproduce why I did on my Elementary OS, I get the famous error.

I run these commands :

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

Edit : I can create breakpoints on others functions of the CMU Bomb and it works as expected.
Example :

(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.

I've heard of ia32-libs but this doesn't do anything more since I'm on 64bits Ubuntu and run a 64bits compiled CMU Bomb, am I wrong ?

like image 409
Cédric M. Avatar asked Jan 08 '15 22:01

Cédric M.


People also ask

What is gdbinit?

gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.

How do I remove a breakpoint in gdb?

With the clear command you can delete breakpoints according to where they are in your program. With the delete command you can delete individual breakpoints, watchpoints, or catchpoints by specifying their breakpoint numbers. It is not necessary to delete a breakpoint to proceed past it.

What is a gdb inferior?

gdb represents the state of each program execution with an object called an inferior . An inferior typically corresponds to a process, but is more general and applies also to targets that do not have processes. Inferiors may be created before a process runs, and may be retained after a process exits.


1 Answers

Use dir command to set source path

dir /usr/src/debug

in above path. Your code should present.

like image 87
Dinesh Chowdary Avatar answered Sep 28 '22 04:09

Dinesh Chowdary