Remote debugging allows you to run the debugger on one side of a communication link, while the application being debugged runs on the other. Remote debugging is required when, for example, there isn't enough memory to run both the debugger and the application on the same machine.
This chapter covers the following:
The easiest way to debug an application that's running on another node is to use the QNX network. QNX integrates a network of nodes into a single, homogeneous set of resources, and you can run a program or access a file on any machine (provided you have the appropriate authority).
As discussed in the section “Syntax” in the chapter Starting Up the Debugger, the syntax of the wd command is as follows:
wd {-options} [:symbol_file] [cmd_line]
where cmd_line is one of the following:
If you want to run the debugger on your node and the application on another, simply specify the node ID (nid) of the other node as part of the command line. For example:
wd //7 my_program
runs the debugger on your current node and runs the command my_program on node 7.
The following command:
wd //7 //5/home/mary/my_program
runs the program my_program (found in /home/mary on node 5) on node 7, while the debugger runs on your current node.
For more information about the QNX network, see QNX System Architecture manual.
If you're debugging a QNX application from another platform, you need to use a link between the two machines. In this scenario, you need to use the remote form of the Watcom Debugger.
The debugger is broken down into 4 parts:
In the following examples the notation shown below, indicates that cmd1 is to be run on machine A, and cmd2 is to be run on B:
A>cmd1 B>cmd2
Machine A is the QNX machine that runs the application. The debugger runs on machine B, using the command syntax appropriate to the operating system in use.
A normal non-remote debugging session just uses the user interface and the debug kernel. All components run on the same machine. This simple debugging session would be started with the command:
A>wd app
A remote debugging session adds a remote debug server and a remote trap file as well. For example, using the parallel port to debug between two machines would be accomplished using the following components:
A>parserv B>wd -tr=par app
To start the above remote debugging session, follow these steps:
The rest of the debugger command line is identical to the command you would type if you were debugging the application locally.
You must start the remote debug server first. If you don't, the remote trap file isn't able to establish a communication link and the debugger refuses to start.
The following diagram shows debugging on a serial link:
A>serserv -tr=rsi B>wd -tr=ser app
The debugger provides the following remote link capabilities:
These links are supported on the following operating systems:
Communication parameters may be passed to the remote trap file and the
remote server.
They are passed to the remote trap file by following the name of the
trap file with a semicolon and the parameter. For example:
passes the parameter 2.4800 to the remote debug server.
To pass the same parameter to the remote trap file, use:
These link parameters are specific to each remote link and are
described in the following sections.
This link communicates over the parallel port. Three different cable
types may be used. They are called the LapLink, Flying Dutchman, and
WATCOM cables. Although the WATCOM cable communicates considerably
faster than the other two, we have found it to be unreliable on some
printer cards.
These cables are described in the section
“Parallel
Port Wiring Considerations” in Appendix C: Wiring for Remote
Debugging.
The parameter to this link is a number from 1 to 3. This
tells the software which parallel port the cable is connected
to (LPT1, LPT2, LPT3). The default is 1. The parameter used
on each side of the link depends on which printer port the cable
is plugged into on that machine. It need not be the same on both sides.
The following example shows how to debug across a parallel cable
plugged into printer port 3 on one machine and port 2 on the other:
This link communicates over the serial port. For wiring details, see
“Serial Port Wiring
Considerations” in Appendix C: Wiring for Remote Debugging.
The debugger and server
automatically synchronize on a communications speed. They may
communicate at baud rates as high as 115k. You don't need to use
the stty command.
The parameter to this link takes the form:
nid,port_number.baud_rate
where
The baud_rate variable may be any of 115200, 57600, 38400,
19200, 9600, 4800, 2400, or 1200.
It may be shortened to the first 2 digits.
A special baud rate of 0 is also allowed. This should be used
if the serial port has been pre-assigned using the
mode or stty
command. The pre-assigned baud rate is used and the baud rate
negotiation is avoided. This allows you to debug over a modem.
The following example shows how to debug across a serial cable
using default settings:
The following example shows how to debug across a serial cable
using serial port 2 on each machine setting the maximum baud
rate to 9600:
Under QNX, a node id may be specified followed by a comma if the
serial port isn't located on the current node.
For example, serserv 3,1.9600 would use the device
//3/dev/ser1 at a baud rate of 9600.
The TCP/IP link allows you to communicate between any two sessions
using TCP/IP if you have installed TCP/IP support.
See your network documentation for details on installing TCP/IP
support.
In order to use TCP/IP to remotely debug a program, you must start the
TCPSERV server program first.
For example,
The server program displays an available socket port number on the
screen.
You also need to know your Internet Protocol (IP) address.
This can be in alphanumeric or numeric form
(for example, jdoe.watcom.on.ca or
172.31.0.99).
To use the remote TCP/IP server, you must specify the TCP/IP trap filename to
the debugger along with an argument consisting of the socket
port number given by TCPSERV and your IP address.
You must also include the name of the application you wish to debug.
For example:
The TCP/IP remote debug service permits debugging of applications
anywhere on the Internet.
However, response varies with the type of connection involved.
Link descriptions
A>serserv 2.4800
B>wd -tr="ser;2.4800" app
PAR (parallel)
A>parserv 3
B>wd -tr="par;2" app
SER (serial)
A>serserv
B>wd -tr=ser app
A>serserv 2.9600
B>wd -tr="ser;2.9600" app
TCP/IP (Internet packets)
A>tcpserv
Socket port number: 1024
WATCOM TCP/IP Debug Server
Version 10.6
Copyright by WATCOM International ...
Press 'q' to exit
B>wd -tr="tcp;1024.jdoe.watcom.on.ca" app
or
B>wd -tr="tcp;1024.172.31.0.99" app