I have an image that runs in Passive KITL mode. It evens connects to PB
when hitting an exception.

Is it possible to connect to PB again after disconnecting?

When I hit Disconnect, a messge box warns me about disabling KdStub
before disconnecting. However I don't know how to do that.

Looking at the source, I found the following in
\WINCE420\PRIVATE\WINCEOS\COREOS\NK\KERNEL\kwin32.c:
//------------------------------------------------------------------------------
// This function is called when kdstub gets Terminate Message from the
debugger
// It simply reverts back KDTrap, KDUpdateSymbols, KDSanitize, KDReboot
function
// pointers to FAKE functions.
//------------------------------------------------------------------------------
BOOL
KDCleanup(void)
{
g_pKdInit = NULL;
KDTrap = FakeKDTrap;
KDUpdateSymbols = FakeUpdateSymbols;
KDSanitize = FakeKDSanitize;
KDReboot = FakeKDReboot;
return TRUE;
}

Its referenced near:

case DbgKdTerminateApi:

in \WINCE420\PRIVATE\WINCEOS\COREOS\NK\KDSTUB\kdapi.c

Any insight would be great.

Thanks

Re: PB 4.2 - KdStub by Tom

Tom
Tue Nov 29 22:43:30 CST 2005

Do not post source code from the private tree - it is a violation of the
Shared Source Licenses!

I do not believe it is possible to reconnect. g_pKdInit is only set at
kernel init time when kd.dll is loaded. Because it is cleared when you
disconnect, I don't think you can reconnect without a reboot.

Tom Gensel (eMVP)



Re: PB 4.2 - KdStub by chrono

chrono
Wed Nov 30 13:27:09 CST 2005

Thanks for replying. My bad on posting code from the private tree.

Couple more clarifying questions. Seems like, once kernel debugger has
been initialized by registering the client, Windows CE hangs if PB has
disconnected.

Is it possible to make a KitlIoCtl call to de-register the KDBG client?
Possibly from an exe I would write.

I've also read about loaddbg.exe. Does anyone know how to add it to the
image? Is the source available somewhere?

Thanks in advance.

Tom Gensel (eMVP) wrote:
> Do not post source code from the private tree - it is a violation of the
> Shared Source Licenses!
>
> I do not believe it is possible to reconnect. g_pKdInit is only set at
> kernel init time when kd.dll is loaded. Because it is cleared when you
> disconnect, I don't think you can reconnect without a reboot.
>
> Tom Gensel (eMVP)


Re: PB 4.2 - KdStub by Tom

Tom
Wed Nov 30 15:04:42 CST 2005

Actually, when I ready your first post, I somehow missed that you were
trying to use JIT debugging over passive KITL. As such, I'll step back from
my statement that reconnecting to the debugger isn't possible without a
reboot. Frankly, I don't know if it's possible or not, but I don't readily
see any reason you couldn't, since Kd.dll is loaded dynamically in this case
and not during kernel init (and g_pKdInit is reset on any PROCESS_ATTACH to
kd.dll). As you say, you may have more difficulty disconnecting
successfully than reconnecting - I've never tried this.

loaddbg.exe is built if you include the Target Control Shell support
component in your OS project, but I believe you have to add it to your BIB
file manually to have it included in your image.

Tom Gensel (eMVP)