Once you have set up the target system for sampledd.sys as specified
above, you must reboot the target system to instantiate sampledd.sys
and load the debug kernel.
You can run a quick check that the target machine is set up OK by
running a terminal emulator (such as t, ZOC, etc.) to see that KDB is alive and
communicating at 9600 baud. Remember to shut down this terminal emulator
before you run icatgam.exe as they will compete over the COMx port.
See the diagram above for more details.
-
After you have edited setenv.cmd and seticat.cmd, run them to set up
your host environment. Start the ICAT debugger by typing start icatgam.exe.
You will see the Debug Session Control (DSC) window and be prompted by the
Initialization panel.
Select the Attach button. This will establish the communication to the remote target debug kernel.
The speed of the connection depends on the baud rate you specified. 115K is currently the
fastest speed available. Once the attach is complete, the DSC should show the module(s)
that has been requested by the CAT_MODULE_LIST to be debugged. If you do not see any modules in the list,
it may be for one of the following reasons:
- Your CAT_HOST_BIN_PATH environment variable does not point to local copies of your debug binaries.
- Your binaries are not built with debug information.
- Your binaries are not loaded yet.
-
If sampledd.sys is displayed in the DSC window, click on the "+",
and you will notice routines are displayed. Click on the Strategy routine.
The strategy routine of the sampledd.sys device driver should come
up in the source window.
Note: This is masm source, so you will see assembler
directives,BUT it is source. We support both CodeView (cl and cl386)
and HLL (IBM C Set) debug formats for C.
If when you try your own code and can't get the source, check the following:
- Check that the CAT_HOST_SOURCE_PATH variable points to the path location where your
source resides.
- Check that your modules were built with debug information.
If an object module does not show up in the list of object modules (an exe, dll, sys, etc. file),
it usually means that the object module was not built with debug information.
- Set a breakpoint on line 216 where there is a call to router_table.
Then have ICAT "go" by clicking on the green light icon or
Run option from the menu.
On the target machine, run sample.exe. sample.exe is found in
the \icatos2\sample directory where the device driver was located. It
will emit a DevIOCtl to open the sampledd.sys device driver. You should hit
your breakpoint.
When icatgam.exe notifies you of the breakpoint hit, click on
the register icon on the
toolbar or select Monitors->registers.
Click on the storage icon or the Monitors->storage and edit its value to
that of the PC reg at the bottom of the register window. You will see memory that corresponds
to the code space. See the running example screen capture window above.
Now go crazy and debug away. We will be fixing bugs and supplying new
debugger spins. When done, close icatgam.exe. The debugger will
restore the baud rate back to its original speed and disconnect from the remote kernel.
-
Here are some common problems encountered when using the debugger:
- A terminal emulator is running at the same time conflicting for the com port.
- Debug versions of the binary are not located on the target and host machines.
Note:
The debug version of the binary on the target machine can be stripped
using the debstrip utility or some other debug stripping tool found with the compiler. This is useful when debug
modules are too big to manage. However, the host version must have full debug information because
this is where ICAT gathers its debug information. ICAT only request address and state
information from the target system.
- The debugger hangs when shutting down. The workaround is to use PSPM2.EXE to kill
the icatgam.exe process. This tool can be found on DevCon or Hobbes.
- The target system appears to be locked up after the debugger disconnects. The target may still be
in KDB. You can re-attach to the target with ICAT and tell it to go, or you can bring up a terminal
emulator program and connect to the kernel and hit "g" for go. A baud rate adjustment
may be needed.
|