Re: Debuggin XNU build
Re: Debuggin XNU build
- Subject: Re: Debuggin XNU build
- From: Regis Duchesne <email@hidden>
- Date: Tue, 21 Apr 2015 17:28:00 +0000
- Thread-topic: Debuggin XNU build
On a normal Mac, pressing the power button (there is also a key combo to do the same) will drop you to the debugger. Which is why ways to send an NMI to the VM were mentioned earlier in this thread.
You will need to set bit 0x4 in debug= in boot-args:
DB_NMI
0x04
Drop into debugger on NMI (Command–Power, Command-Option-Control-Shift-Escape, or interrupt switch).
—
hpreg
> On Apr 21, 2015, at 6:22 PM, Prokash Sinha <email@hidden> wrote:
>
> 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 <email@hidden> 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden