Difference between revisions of "Gdb"
From Linuxintro
imported>ThorstenStaerk |
imported>ThorstenStaerk |
||
Line 4: | Line 4: | ||
info functions | info functions | ||
finish | finish | ||
+ | break | ||
+ | run | ||
+ | continue | ||
= Example = | = Example = |
Revision as of 17:08, 26 November 2011
gdb allows you to debug Linux programs.
Notable functions
info functions finish break run continue
Example
How to debug vlc
Here I try to find out where vlc exits because I am root:
gdb /usr/bin/vlc (gdb) info functions All defined functions: Non-debugging symbols: [...] 0x0000000000400f40 geteuid [...] (gdb) break geteuid Breakpoint 1 at 0x400f40 (gdb) run Starting program: /usr/bin/vlc Breakpoint 1, 0x00007ffff71cfc70 in geteuid () from /lib64/libc.so.6
ok, let's trace the program one command at a time:
(gdb) stepi 0x00007ffff71cfc75 in geteuid () from /lib64/libc.so.6 (gdb) stepi 0x00007ffff71cfc77 in geteuid () from /lib64/libc.so.6 (gdb) 0x0000000000401103 in ?? () (gdb) 0x0000000000401105 in ?? () (gdb) 0x000000000040170f in ?? () [...] (gdb) break *0x40170e Breakpoint 3 at 0x40170e (gdb) continue
See also
- objdump -- disassemble a program
- strace -- show syscalls from a running process
- hexeditors