next up previous contents
Next: 7. Enhanced Support for Up: 6. Debugging Drivers Previous: 6.1 User-Mode Debugging   Contents

Subsections


6.2 Debug Monitor

Debug Monitor is a powerful graphical- and console-mode tool for monitoring all activities handled by the WinDriver kernel (windrvr6.sys/.dll/.o/.ko).
You can use this tool to monitor how each command sent to the kernel is executed.
In addition, WinDriver enables you to print your own debug messages to the Debug Monitor, using the WD_DebugAdd() function (described in the WinDriver PCI Low-Level API Reference) or the high-level PrintDbgMessage() function [B.8.14].

The Debug Monitor has two modes: graphical mode and console mode. The following sections explain how to operate Debug Monitor in both modes.


6.2.1 Using the Debug Monitor in Graphical Mode - wddebug_gui

The graphical (GUI) version of the Debug Monitor utility - wddebug_gui - is available for Windows 98/Me/2000/XP/Server 2003/Vista , Linux and Solaris. You may also use the Debug Monitor to debug your Windows CE driver code running on CE emulation on a Windows 2000/XP/Server 2003/Vista platform. For Windows CE targets, use Debug Monitor in console mode [6.2.2].

  1. Run the Debug Monitor using either of the following alternative methods:

    Figure 6.1: Start Debug Monitor
    Image dbgm_log

  2. Set the Debug Monitor's status, trace level and debug sections information from the Debug Options dialogue, which is activated either from the Debug Monitor's View | Debug Options menu or the Debug Options toolbar button.

    Figure 6.2: Debug Options
    Image dbgm_dbg_opts

  3. Once you have defined what you want to trace and on what level, click OK to close the Debug Options window.

  4. Activate your program (step-by-step or in one run).

  5. Watch the Debug Monitor log for errors or any unexpected messages.


6.2.1.1 Running the Graphical Debug Monitor for a Renamed Driver

By default, the graphical Debug Monitor program - wddebug_gui - logs messages from the windrvr6.sys/.o/.ko driver. However, you can also use wddebug_gui to log debug messages from a renamed driver (see explanation in section 15.2 regarding renaming the windrvr6 driver module) by running wddebug_gui from the command line with the driver_name option:

    wddebug_gui <driver_name>

****************************************************************************************
  NOTE
  The driver name should be set to the name of the driver file without the file's extension; e.g. windrvr6, not windrvr6.sys (on Windows) or windrvr6.o (on Linux).
****************************************************************************************

For example, if you have renamed the default windrvr6.sys driver on Windows to my_driver.sys, you can log messages from your driver by running the Debug Monitor using the following command:

    wddebug_gui my_driver


6.2.2 Using the Debug Monitor in Console Mode - wddebug

The Debug Monitor utility comes in a console-mode version - WinDriver/util/wddebug - which is available for all supported operating systems.

To use the wddebug console-mode version of the Debug Monitor utility on Windows 98/Me/2000/XP/Server 2003/Vista, Windows CE, Linux and Solaris, run the WinDriver/util/wddebug utility, as explained below.

\bgroup\color{NavyBlue}\fbox{\large{\textbf{\emph{i}}}}\egroup On Windows CE, start a Windows CE command window (CMD.EXE) on the Windows CE target and then run the program WDDEBUG.EXE inside this shell.


WDDEBUG USAGE

wddebug [<driver_name>] <command> [<level>] [<sections>]

****************************************************************************************
  NOTE
  The wddebug command options must be used in the order in which they appear in the usage demonstration above.
****************************************************************************************

<driver_name> :
The name of the driver to which to apply the command.

The driver name can be set either to windrvr6 (default), or to the name of any driver renamed from the windrvr6 driver module (see explanation in section 15.2).

****************************************************************************************
  NOTE
  The driver name should be set to the name of the driver file without the file's extension; e.g. windrvr6, not windrvr6.sys (on Windows) or windrvr6.o (on Linux).
****************************************************************************************

<command> :
The Debug Monitor command to execute:

****************************************************************************************
  NOTE
  The following options are applicable only to the Debug Monitor on and dbg_on activation commands described above.
****************************************************************************************

<level> :
The debug trace level to set. The level can be set to either of the following flags: ERROR, WARN, INFO or TRACE, where ERROR is the lowest trace level and TRACE is the highest level (displays all messages).
The default debug trace level is ERROR.

<sections> :
The debug sections to set. The debug sections determine what part of the WinDriver API you would like to monitor. For a full list of all supported debug sections, run wddebug with no arguments to view its usage instructions.
The default debug sections flag is ALL - sets all the supported debug sections.



USAGE SEQUENCE

To log messages using wddebug, use this sequence:

\bgroup\color{NavyBlue}\fbox{\large{\textbf{\emph{i}}}}\egroup You can also run wddebug with the status command while the Debug Monitor is turned off in order to view information regarding the running <driver_name> kernel module.


EXAMPLE

The following is an example of a typical wddebug usage sequence. Since no <driver_name> is set, the commands are applied to the default driver - windrvr6.


next up previous contents
Next: 7. Enhanced Support for Up: 6. Debugging Drivers Previous: 6.1 User-Mode Debugging   Contents