Sadia Bashir
Sadia Bashir

Reputation: 95

Enable debugging of kernel module from user-space process

I am working with openvswitch on ubuntu 14.04 server. I can easily attach gdb with any of its binary files for debugging its various features but when it comes to its kernel module, I am not able to debug it as per my requirement. I am using following steps to attach linux kernel with gdb: 1. gdb /tmp/vmlinux /proc/kcore 2. Adding a symbol File to GDB: cd /sys/module/openvswitch/sections/ ls -A1 .cat .text .data .bss 3. in gdb - add-symbol-file datapath/linux/openvswitch.ko 0xf87a2000 -s .data 0xf87b4000 -s .bss 0xf87b4560 4. b vxlan_udp_encap_recv

but when I generate packets for testing ovs kernel module and step over it says "The program is not being run."

Note: I have confirmed all module symbols by running this command: nm root/ovs/_build-gcc/datapath/linux/openvswitch.ko = which prints all symbols. and lsmod also confirms the existence of ovs kernel module.

I want to make ovs module stop at specified break point after it receives a message from its user-space application on netlink socket for its detailed debugging as conveniently as it allows me to debug a user-space process. Please suggest me how do I resolve this problem or if there is any alternative. I'll be really grateful for any help or suggestion. Thank you!

Upvotes: 0

Views: 1237

Answers (2)

caf
caf

Reputation: 239331

To debug the kernel you need to use KGDB / KDB.

Upvotes: 1

user3629249
user3629249

Reputation: 16540

one possibility:

run the gdb server on the target machine. run gdb on another machine. recompile the target machine kernel with the -ggdb parameter on gcc. start both machines with the target machine running the kernel with all the -ggdb info. have all the source available on both machines. connect from the testing machine to the target machine. have the gdb server connect to the kernel ....

Upvotes: 0

Related Questions