I found this post from a related post and wanted to say that I just posted some work that I did to get this to work on Nexus 6 if anyone is interested:
http://www.contextis.com/resources/blog/kgdb-android-debugging-kernel-boss/
Interestingly, the OP issue with sysrq was one of the ones I ran into. The reason for this behavior is that KGDB did not initialize correctly, so it could not install a handler for the "g" trigger (kgdb). This is why all the other sysrq commands still work.
Longer explanation (thanks @Robert):
To get this working, I had to make a UART debugging cable based on this Accuvant blog . This is a fairly simple circuit that consists of the FTDI 3.3v main breakthrough (available from SparkFun at the time of writing), as well as 4 resistors (2 x 1K Ohms, 1 x 1.2K Ohms and 1 x 100 Ohms) and a 4-element headphone jack Tip-Ring-Sleeve (TRRS). Resistors essentially provide a voltage divider to reduce 3.3V to something more secure for your phone. By inserting an audio jack with the other end connected to your circuit board, the audio subsystem recognizes that a voltage (~ 2.8 V) is on one of the pins, and it knows to provide a UART interface through this cable. The FTDI gap is connected to the computer via USB, and from here you can access console messages through a terminal emulator, such as a minicomputer. However, you now have a serial interface through the same mechanism and that we can use to connect KGDB.
So, at this point, relatively small changes are required for the Nexus 6 serial driver (msm_serial_hs_lite.c) to support KGDB (in particular, the ability to perform I / O using an atomic symbol). I just ported these changes from the main Linux kernel code, as a chapter called Stephen Boyd did a great job with the full serial driver MSM (Qualcomm) msm_serial.c. Its changes can be found here or just search "msm_serial: add poll_ support" on Google. The port was not complicated, and my code can be found on github .
In addition, you should be able to create your own kernel for your N6, which google provides a lot of information about . Then you need to create a boot image containing the KGDB modifications in the github repository. I took the original kernel from https://developers.google.com/android/nexus/images , extracted it (using abootimg -x), and then used the following command to repackage it using my custom kernel (zImage-dtb ) and additional command line parameters to ensure that KGDB is loaded and points to my serial port as follows:
abootimg -u boot.img -k zImage-dtb -c 'cmdline=console=ttyHSL0,115200,n8 kgdboc=ttyHSL0,115200 kgdbretry=4'
With boot.img created, I could boot into it using the fastboot boot boot.img command, open the adb shell, and then launch a breakpoint in the Android kernel with the command:
echo -ng > /proc/sysrq-trigger
It should be noted that for completeness, you need superuser privileges to access / proc / sysrq -trigger, so you need to have root.
With the phone stopped and the debugging cable connected, run the GDB version for ARM on your PC with an uncompressed kernel as an argument (for example, arm-eabi-gdb./vmlinux). Note. I am running Ubuntu 14.04 and using arm-eabi-gdb from the prebuilts directory in my original AOSP repository. Finally, enter the following commands:
set remoteflow off set remotebaud 115200 target remote /dev/ttyUSB0
Everything should be fine, it should immediately break into the kgdb breakpoint (so that your write is done in / proc / sysrq -trigger), and you can start debugging.