meta data for this page
This is an old revision of the document!
Starting
gdb <executable> gdb --args <executable> arg1 arg2 arg3
getting info
- p[rint] var
- ptype var
- x /100bx m - eXamine memory located by variable m, print 100 bytes in hex format
- bt (backtrace)
- t (threads)
call stack
- bt (backtrace)
- frame 4 - switch to frame #4
- up
- down
breakpoints
- break malloc
- clear malloc
- info break
stepping
- s [tep]
- c [ontinue] <num_to_ignore>
- n [ext] - to next line
- fin [ish] - execute until stack frame returns
- u [ntil] <line number> - execute to line (to avoid loops)
symbols
- set symbol-reloading on
- add-symbol-file ~/mymodule.o 0xd8be4000
file paths and libraries
- set verbose on
- set auto-load safe-path /
- info shared
- set sysroot /home/niziak/n/3/out/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot
source paths
Search paths (prefixes):
- dir /path/to/src1
- dir /path/to/lib/src2
Translate beginning of paths:
- set substitute-path /usr/lib ../../out/target/usr/lib
infos
- show debug-file-directory
threads
- info threads - show info about threads
- thread 4 - switch to thread 4
- print mutex
Kernel OOPS
Reading
PC is at RTMPCheckEtherType+0x90/0x4d4 [mt7601Uapsta] LR is at RTMPCheckEtherType+0x34/0x4d4 [mt7601Uapsta] Code: e59f3418 e0256593 e2859d43 e289902c (e5d939ba)
Oops occurs at offset 0x90 from RTMPCheckEtherType. 0x4d4 is length. “Code” line shows last instruction. Instruction in bracket is problematic instruction (at RTMPCheckEtherType+0x90)
Tracing
Disassembly kernel binary or module binary: objdump -dS vmlinux > /tmp/kernel.s and look into generated code.
Python
apt-get install gdb python2.7-dbg
gdb python <pid>
DRAFTS
call raise(kernel-thread-id, signo) or call pthread_kill(pthread-thread-id, signo).