First, I’m using lldb, since gdb is not being supported anymore. In the debugger, hitting Cntl+C would not work. AFAIRC, gdb does not work that way either when do the kernel debugging ( I could be wrong), but in freebsd it does not work. So in kgdb, the kludge is to make a kernel variable like Kernel.Debug field to have a trap when we toggle or try to write from the target. And that trap is captured in the debugger. There got to be a way to Break in to the running kernel directly ( either with key combination on the host debugger) or toggling some variable — I just don’t know. Prokash On Apr 21, 2015, at 5:43 AM, Regis Duchesne <hpreg@vmware.com> wrote:
one more question (though different ) is that - Is there any kernel variable that we can toggle on the target using sysctl to trigger a break into the debugger. Or if there is any key-combination that would do that. This is when kernel debugger connection is fine, and I let the target to boot completely, then I want to break in. Assume I don’t have any component running where I can set BP before letting the target go on running.
I can think of two ways to do this:
1) Use nvram to add flag 0x1 to debug= in boot-args.
DB_HALT 0x01 Halt at boot-time and wait for debugger attach (gdb).
Then after the OS X guest boots, it will wait for your debugger to connect. Then just run "c" (continue) and your guest will run normally until it either hits a breakpoint, or you hit Ctrl-C at the gdb prompt.
2) Write a trivial kernel module which simply calls Debugger(<some string>); in its start method. Then load that module in the guest every time you need to drop to the debugger.
Cheers, -- hpreg
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Prokash Sinha