Re: Advanced debugging an image



=?Utf-8?B?TWFhcnRlbg==?= <Maarten@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in news:9228487B-038A-4085-8278-4FACEC38F673@xxxxxxxxxxxxx:

Dear,

Is it possible to modify code during an active (connected) debug
session in PB5 without reloading the whole image again and again?

You can't edit and continue code like you can do in VS200* on the
PC, but you can avoid to build and download the image by keeping the
modules you are changing out of the image (you can configure that in
your project build options).
The OS will load your module from the flat release dir when needed.
The only thin you should care about is that you have to unload your
module before you re-build (and then download the new one).
For a regular exe or a dll used by an exe that simply means closing
the process (either quitting it in a "clean" way or killin it from
PB).
For a driver you should unload it. The simplest way to do that is to
use a simple program that will load and unload your driver.
Here's my very simple application to do that:

WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PTSTR
pCmdLine, int nCmdShow)
{
HANDLE devhandle=ActivateDeviceEx(pCmdLine,NULL,0,NULL);

if (devhandle==INVALID_HANDLE_VALUE)
return GetLastError();

MessageBox(NULL,TEXT("Driver loaded, press OK to unload
it"),TEXT("LoadDriver"),MB_OK);

DeactivateDevice(devhandle);
return 0;
}


It will keep the driver loaded until you press the "OK" button on
the message box.
If you driver is loaded at boot you should change its registry
configuration, moving it outside of the HKLM\Drivers\Boot subtree.

This system won't work with drivers loaded by the USB bus, SD bus,
PCMCIA bus (in this case if you handle de-initialization correctly,
unpugging the device should also force an unloading of your driver).
For PCI but you can get the memory address, IRQ etc. and re-
configure them manually inside your driver.
For network drivers you'll need to load NDIS instead of your "real"
driver.
For native drivers (display, touch, mouse, keyboard) you can't force
a loading/unloading of the driver. You may try kill and restart GWES
but all the applications using GDI/windows will be affected.

Sometimes you won't be unable to do an uload (the driver is stuck
inside some interface call, for example) and so you'll have to
reload the image anyway.

--
Valter Minute
www.fortechembeddedlabs.it
Training, support and development for Windows CE
(the reply address of this message is invalid)
.