This chapter tells you how to start the Watcom Debugger. Topics include:
Use the wd command to start the Watcom debugger. The syntax is as follows:
wd {-options} [:sym_file] [cmd_line]
where cmd_line is one of the following:
The optional nid argument identifies the node you want to run the program on. For more information, see the section ``Using the QNX Network for Remote Debugging'' in the Remote Debugging chapter.
The sym_file argument is optional, and specifies the name of the file, usually with extension sym, in which debugging information for the program is to be found.
The two forms of cmd_line allow you to debug:
In both cases you can specify the node the process or executable is found on.
You may encounter problems if the debugger doesn't know where to find the source code associated with your executable. The name of the source file included in the debugging information is the path and the original name from the compiler's command line. If the original filename is no longer valid (for example, if you've moved the source to another directory), you must tell the debugger where to find the source files by choosing Source Path from the File menu. See the ``File menu'' in the Debugger Environment chapter. |
You can specify on the command line the options you want to use during your debugging session. Acceptable option short forms are indicated in capital letters; options aren't case-sensitive. For example, the -TRap option may be shortened to -tr.
The following options are available:
If you use the ;trap_parm parameter, you'll likely need to put the option in quotes to avoid having the shell interpret the semicolon. |
The remote trap files themselves have startup parameters, which are specified following the semicolon. See the Remote Debugging chapter for more information.
Normally you don't have to specify a trap file. If you don't specify the -trap option, the default trap file that supports local or QNX network debugging is loaded.
The -COlumns option is ignored in QNX character-mode. |
You need to use this option only if the debugger runs out of memory or causes your application to run out of memory. |
If you're using the remote debugging feature, the debugger uses as much available memory as available.
The PATH environment variable on the task machine is always used in locating executable image files. When -remotefiles is specified, the debugger also uses the task machine's PATH environment variable to locate debugger command files. See the chapter Remote Debugging for more information.
This option is useful if the debugger detects and tries to load debugging information that isn't valid. |
You can also specify a full device name, such as
-console=//23/dev/ser1
for wd to use for its input and output. In this case, the debugger doesn't flip between its screen and the application's screen. You can optionally follow the device name with a colon and a terminal type, such as
-console=/dev/ttyp1:vt240
to let the debugger know what kind of terminal you're using so it can set up the user-interface library appropriately.
If you're in Photon, wd creates a new pterm window and ignores this option. |
You can use the WD environment variable to specify default options to be used by the debugger. Once you've defined the environment variable, those options are used each time you start the debugger.
The following example illustrates how to define default options for the debugger:
export "WD=-nofpu -console=3"
In QNX, the names of environment variables must be in uppercase. |
There are several supporting files provided with the Watcom Debugger:
The Watcom Debugger searches for support files in this order:
When the REMotefiles option is specified, the debugger attempts to locate the Watcom Debugger's support files (command files, trap files, and so on) on the task machine. See the Remote Debugging chapter. |
When the debugger starts up, it attempts to open an initialization file that contains your customization commands. The search order for this file as follows:
An error message is displayed if no configuration file can be found.
A limited form of debugging of an application that has terminated and produced a postmortem dump can be done under QNX. In order to use this feature, you must start the QNX dumper utility. The syntax is given below; see the QNX Utilities Reference for more information.
dumper [-d path] [-p pid] &
The options are:
The ampersand (&) must be specified so that the shell is rejoined. |
For example,
dumper &
or
dumper -d /usr/fred/dump_area &
Whenever a program terminates abnormally, a dump of the current state of the program in memory is written to disk. The dump filename is the same as the program name with a .dmp extension. For example, if the program name is a.out then the dump is written in the /home/userid/a.out.dmp file.
You can use the -d option of the dumper program to force all dumps into a single directory rather than into your home directory.
The -p option lets you monitor a particular process. You can run multiple copies of the dumper program, each monitoring a different process.
Use the Watcom Debugger to examine the contents of the postmortem dump. The interface between wd and the postmortem dump is contained in a special trap file, pmd.trp, which is specified to the debugger using the -trap option.
wd -TRap=pmd[;i] [:sym_file] file_spec
where
Depending on the shell that you're using, you may need to place
the option specification in quotation marks if you include the optional
;i.
For example,
wd "-trap=pmd;i" myapp |
Basically, the Watcom Debugger is fully functional when a postmortem dump is examined. However, some operations aren't allowed: