If you are debugging your Linux or MacOS kernel drivers frequently, running the guest OS under VMWare and using the VMWare gdb stub can save you a lot of time: fast reliable debugging experience handled by VMWare on top of the operating system itself.
There’s just one “feature” that can cost you a lot of time if you’re and just took me a whole evening to figure out.
When you add debug stub support to your VM, you add something like this to your VMX file:
debugStub.listen.guest32=1 debugStub.listen.guest64=1 debugStub.listen.guest32.remote = "TRUE" debugStub.listen.guest64.remote = "TRUE"
Then you start debugging your kernel being so happy about the speed and reliability and then suddenly notice that you can’t set more than 4 breakpoints.
The problem is that VMWare 8 uses the “hide breakpoints” mode by default. I.e. instead of making your breakpoints with the “int 3” instructions like any normal debugger would do, it uses the scarce hardware debugging registers, limiting the amount of the breakpoints you can have to 4. It happens regardless of the GDB command you use to set the breakpoint. I.e. the normal “break” will still be interpreted as “hbreak”.
The solution is very simple. Just add this line to your VMX file:
debugStub.hideBreakpoints = "FALSE"
This disables the breakpoint hiding mode and lets VMWare use the good old int 3 instruction to set the breakpoints so that you can debug normally again.