I am trying to debug a kernel panic in our kext. I can attach to the target Mac over ethernet if I:
- cause an NMI using
- add an IOPanic call to my kext and cause it to be executed
- use Dtrace to invoke a panic
However if I reproduce the kernel panic which I am investigating, the Mac just restarts.
How can I make the Mac wait for me to attach with lldb rather than restarting?
My target configuration is:
- Mac is 2021 M1 Pro 14" MacBook Pro
- macOS 14.2 (23C64)
- Network: Apple Thunderbolt 3 <-> Thunderbolt 3 adapter + Apple Thunderbolt 2 to ethernet adapters
- Boot-args = "debug=0x44 wdt=-1 kdp_match_name=en8" (I have also tried debug=0x104C0C)
I have tried creating kernel cored dumps, installing either a release or debug build of the kext.
When I first started investigating this kernel panic, I could attach if the kernel panic occurred with the Apple supplied build of our kext but not with the test one I built. After a week of testing, I can no longer attach with the Apple supplied build.