☰
×
◈ Introductions
◈ Linux Kernel Compilation
◈ Linux Kernel Debugging
◈ Linux Kernel APIs - I
◈ Linux Kernel APIS - II
◈ Linux Kernel APIS - III
◈ KGDB Setup
◈ QEMU Setup
◈ Linux System Calls Table
◈ Useful Linux Commands
Home
About
Consulting
Training
Tutorials
Interview Questions
Contact
Tutorials
Linux Kernel Debugging
Home
Linux Kernel Debugging
◈ Introductions
◈ Linux Kernel Compilation
◈ Linux Kernel Debugging
◈ Linux Kernel APIs - I
◈ Linux Kernel APIS - II
◈ Linux Kernel APIS - III
◈ KGDB Setup
◈ QEMU Setup
◈ Linux System Calls Table
◈ Useful Linux Commands
Tutorials - Linux Kernel Debugging
Kernel Debugging
« Prev
Next »
Linux Kernel Debugging
1.Why we need to Debug? 1. Misbehaviour 2. Memory Leaks 3. Invalid/Illegal Memory Access 4. Invalid Instructions 5. Synchronization issue among threads or many context * Debug is the way to find the where particular problem is. * Different debugging tools are there to find the different type of problem. * Sometime, You may need not to have debug particular problem.. Example: Single threaded application case study. • Instruction address where the problem is, • What are the local variable contain • What are the parameters to the function? • Who has called this function? • What were the data of global variables? Information of the registers What the IP has currently. (This contains the address of the fault instruction) Stack (we need the whole stack data for local variables to find) Global data variables will in data segment: Callinformation (Stack contains this) Heap (memory allocations) What core dump file contains 1) Process status • signal info like signal number and error number • set of pending signals • set of help signals ( blocked signals) • Process id, parent process id .. • set of registers 2) Process information • state of the current process • state in string like R, S, Z • Whether the process is in Zonbi status • Nice value of the process • process flags • pid , ppid • process name • Command line arguments. 3) Thread specific information • Process status for the thread 4) Info about the memory mapped files • Number of files mapped • Name of the file mapped • start address • End address 5) Process address space • like code segment , data segment , stack segment , heap etc gdb ./a.out core disassemble (if no symbols ) print $eax print $dl print/c $dl info registers backtrace ( where you have come from) info frame bt where info stack base address return address first parameter second parameter third parameter ebp+0 previos ebp ebp+4 return instraction of the caller ebp+8 first paramenter ebp+12 second parameter ebp+16 third parameter info register info frame X $ebp+4 X/10xw $ebp+4 info symbol
disassemble connect+176 info frame x/10xw $ebp+8 info files (where the files are loaded and its permission) frame 1 info frame global variable print
« Prev
Next »
Helpful Links
Interview Questions
Corporate Training
Recommended Books
Linux Consulting
Apply for Job Assistance
If you have any queries please email us at
info@motionzen.com