Don’t die gdb, we love you: kgmacros ported to Mavericks.

Our lovely gdb has been declared dead with Xcode 5 release. The new king in town is lldb, and that also applies to kernel debugging. Change is good, even if we Humans don’t like it, but… there’s still no gdbinit for lldb and I just love it. Even more important (for kernel debugging), lldb still has no support (afaik) for VMware gdb stub. This means it’s not possible to do kernel debugging in Mavericks VMs other than KDP. I like the gdb stub a lot; ctrl+c and bang we got kernel control.

I needed to do some research with Mavericks so I decided to port the kgmacros script to Mavericks. It was easier than I expected, just some fixes to structures that changed. Most functions are working ok, and there are a few private helper commands I added last yet while I doing some research. Mostly improvements related to physical memory functions. The most important commands, at least for me, are fully working.

The script is available at Github repo. The kgmacros file is for Mountain Lion, and kgmacros_mavericks for Mavericks.

One small tip if you are doing two real machines debugging with lldb and thunderbolt. You will need to set the boot args parameter “kdp_match_name=en4” if you are using a thunderbolt to ethernet adapter in the target machine. KDP expects by default the network interface in en0 and the thunderbolt adapter is set as en4. Other than that everything works. It just needs the gdbinit like output and commands. Deroko started a version here. Go help him, I don’t want to learn Python (again) ;-).


2 thoughts on “Don’t die gdb, we love you: kgmacros ported to Mavericks.

  1. Hi fG!

    Is there any gdbinit for lldb available yet?

    I miss all the nice gdb colors and formatting now that I’ve moved to lldb debugging on Terminal.


    1. Hi,
      There’s an attempt by Deroko but not advancing much lately.
      That’s one of the main reasons I haven’t moved to lldb, no gdbinit like script.
      I was thinking about hardcoding those features in the code but had no time to poke around yet.
      Let’s see if someone steps up meanwhile 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *