Kernel patches to get KGDB working on the Nexus 6.
For background, please see associated blog post at http://www.contextis.com/resources/blog/kgdb-android-debugging-kernel-boss
-
Root your Nexus 6!
-
Download and build the stock Nexus 6 kernel (kernel/msm) using instructions from https://source.android.com/source/building.html
-
Download this directory structure into the root of your kernel source (kernel/msm/) including the .config file.
-
Re-build your kernel source.
-
Create your boot image, passing console arguments e.g. to update a stock image I used:
abootimg -u boot.img -k zImage-dtb -c 'cmdline=console=ttyHSL0,115200,n8 kgdboc=ttyHSL0,115200 kgdbretry=4'
-
Boot your phone into the bootloader (adb reboot bootloader) and on your host run:
fastboot oem config console enable
-
Reboot into bootloader again
-
Plug in your debug cable (see blog)
-
Boot your image e.g.
fastboot boot boot.img
-
Open a shell (adb shell), su to root, then type:
echo -n g > /proc/sysrq-trigger
-
Hit enter
-
On your host machine fire up GDB (you'll need a working version of GDB cross-compiled for ARM):
arm-eabi-gdb ./vmlinux
(gdb) set remoteflow off
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyUSB0
You should hit the KGDB breakpoint and be able to continue, examine memory, etc.