
On Fri, Aug 21, 2015 at 12:39 AM, Aruna Hewapathirane <aruna.hewapathirane@gmail.com> wrote:
Has anyone ever used qemu and gdb ? If so has anyone successfully debugged a module ? I would be very thankful if someone can show me the 'specific' steps to follow to get this going.
I have done this once upon a time... checking the scripts I used: Step 1: launch qemu with -gdb like so: qemu-system-x86_64 -nographic -kernel /path/to/kernel -gdb tcp:10.0.0.1:1234 [all the other options] (In my case 10.0.0.1 is bridged with the host.) Step 2: Make a gdbinit file that looks like: set architecture i386:x86-64:intel target remote localhost:1234 file vmlinux # this part is deep magic - check /proc/modules for correct offsets add-symbol-file net/wireless/cfg80211.o 0xffffffffa00000000 # and so-on for whatever modules you care about continue Step 3: Launch gdb on the host YMMV -- I rarely have used an actual debugger for my own kernel work. I do frequently use gdb to do the same thing as addr2line by running gdb on the .ko and then "l *addr+0x123" -- to resolve symbols from oops messages, but you don't need qemu or remote gdb for that. -- Bob Copeland %% www.bobcopeland.com