socket-kgdb Code
Brought to you by:
byang1217
File | Date | Author | Commit |
---|---|---|---|
Makefile | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
README | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
fsock_fw.c | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
gdb_serial_protocol.html | 2011-02-14 | Bin Yang | [20e56c] socket kgdb rc1 |
gdbstub.c | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
run.sh | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
skgdb.c | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
skgdb.h | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
skgdb_start.sh | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
tty.c | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
x86_32.c | 2011-02-24 | Bin Yang | [fd7e2e] socket kgdb alpha release |
The code is ugly. And I believe lots of potential bugs inside. Only X86 32 is supported. easy to add other arch support. The purpose of this tool: 1. debug kernel without any HW support. 2. debug specific thread without stop kernel. it helps to debug in realtime requirment system. 3. If you enjoy it, please share your happy with me. :) The limitations, 1. can not break inside atomic context. 2. can not support 'n' and 's' commands in gdb Here is the theory. 1. enable kprobe 2. hack the kprobe. including the die notify priority, ins boundary checking, jump optimizing. 3. add kprobe at break instruction. 4. hack the kprobe die notification priority. Add a hack function before int 3 die notification. The hack function save the pt_regs and hack the return ip register to gdb stub server fuction. 4. after gdb stub server return, hack the return ip and jump back to kprobe function. All hack functions use "kallsyms_lookup_name" to find the address and modify the original value dynamically. Steps to try it: 1. enable kprobe in your kernel config 2. modify Makefile base on your kernel src code patch. 3. make it. Copy skgdb_start.sh socket_kgdb.ko fsock_fw to your board. 3. run skgdb_start.sh. 5. connect gdb: target remote yourip:7321 Bin Yang <byang1217@gmail.com> Bin Yang <bin.yang@intel.com>