20-11-2012, 06:11 PM
Linux Debugging Techniques
1Linux Debugging.pdf (Size: 139.27 KB / Downloads: 113)
Tools
Library and system call trace
strace, ltrace
Debuggers
gdb,ddd
kgdb
kdb
Built-In
Oops data upon a panic/crash
Dump Facility
Linux Kernel Crash Dump - lkcd
andling Failures
System Crash
Collect and analyze oops/panic data
Collect and analyze dump with lkcd
System Hang
Use Magic SysReq Keys
NMI invoking a dump using lkcd
look at the hang using debugger
kdb or kgdb
ps command
Kernel Investigation
User mode Linux - run Linux under Linux
Debuggers
Gdb and /proc/kcore
Remote kernel debugging
kgdb & serial connection
Kdb with or without serial connection
Lcrash on running system
Adding printk's in the kernel
Handling a System Crash
Occurs when a critical system failure is detected
Kernel routine call oops
Attempts to report/record system state
Information is limited (after the fact)
Better to have an entire system memory dump
LKCD project on Sourceforge
Thorough analysis and investigation can be done
Panic/Oops Analysis
Steps
Collect oops output, System.map, /proc/ksyms, vmlinux,
/proc/modules
Use ksymoops to interpret oops
Instructions is /usr/src/linux/Documentation/oops-tracing.txt
Ksymoops(8) man page
Brief analysis
Ksymoops disassembles the section of code
EIP points to the failing instruction
The call trace section shows how the code got there
How to find failing line of code?
Linux Technology
Center
Debuggers
kgdb
Remote host Linux kernel debugger through gdb provides a
mechanism to debug the Linux kernel using gdb
Gives you source level type of debugging
kdb
The Linux kernel debugger (kdb) is a patch for the linux kernel
and provides a means of examining kernel memory and data
structures while the system is operational
Doesn't give you source level type of debugging