If the host and the target are connected via some form of TCP/IP connection, the debugger and agent can use that connection as well. Two types of TCP/IP communications are possible with the debugger and agent: static port and dynamic port connections (see below).
The QNX Neutrino target must have a supported Ethernet controller. Note that since the debug agent requires the TCP/IP manager to be running on the target, this requires more memory.
This need for extra memory is offset by the advantage of being able to run multiple debuggers with multiple debug sessions over the single network cable. In a networked development environment, developers on different network hosts could independently debug programs on a single common target.
Figure 1. Several developers can debug a single target system.TCP/IP static port connection
For a static port connection, the debug agent is assigned a TCP/IP port number and listens for communications on that port only. For example, the pdebug 1204 command specifies TCP/IP port 1204:
Figure 2. Running the process debug agent with a TCP/IP static port.If you have multiple developers, each developer could be assigned a specific TCP/IP port number above the reserved ports 0 to 1024.
TCP/IP dynamic port connection
For a dynamic port connection, the debug agent is started by inetd and communicates via standard input/output. The command to run the process debug agent in this case is as follows (from the inetd.conf file):
pdebug stream tcp nowait root /usr/bin/pdebug pdebug -
The inetd process fetches the communications port from the configuration file (typically /etc/services). For example:
pdebug 1234/tcp
The host process debugger (gdb) connects to the port explicitly, but the debug agent (pdebug) has no direct knowledge of the port.
Figure 3. For a TCP/IP dynamic port connection, the inetd process manages the port.Note that this method is also suitable for one or more developers. It's effectively what the qconn daemon does to provide support to remote IDE components; qconn listens to a port and spawns pdebug on a new, dynamically determined port.
Sample buildfile for dynamic port sessions
The following buildfile supports multiple sessions specifying the same port. Although the port for each session on the pdebug side is the same, inetd causes unique ports to be used on the debugger side. This ensures a unique socket pair for each session.
Note that inetd should be included and started in your boot image. The pdebug program should also be in your boot image (or available from a mounted filesystem).
The config files could be built into your boot image (as in this sample buildfile) or linked in from a remote filesystem using the [type=link] command:
[type=link] /etc/services=/mount_point/services [type=link] /etc/inetd.conf=/mount_point/inetd.conf
Here's the buildfile:
[virtual=x86,bios +compress] boot = {
startup-bios -N node428
PATH=/proc/boot:/bin:/apk/bin_nto:./ procnto
}
[+script] startup-script = {
# explicitly running in edited mode for the console link
devc-ser8250 -e -b115200 &
reopen
display_msg Welcome to QNX Neutrino on a PC-compatible BIOS system
# tcp/ip with a NE2000 Ethernet adaptor
io-pkt-v4 -dne2000 -ptcpip if=ndi0:10.0.1.172 &
waitfor /dev/socket
inetd &
pipe &
# pdebug needs devc-pty to be running
devc-pty &
# NFS mount of the QNX Neutrino filesystem
fs-nfs3 -r 10.89:/x86 /x86 -r 10.89:/home /home &
# CIFS mount of the NT filesystem
fs-cifs -b //QA:10.0.1.181:/QARoot /QAc apk 123 &
# NT Hyperterm needs this to interpret backspaces correctly
stty erase=08
reopen /dev/console
[+session] esh &
}
[type=link] /usr/lib/ldqnx.so.2=/proc/boot/libc.so
[type=link] /lib=/x86/lib
[type=link] /tmp=/dev/shmem # tmp points to shared memory
[type=link] /dev/console=/dev/ser2 # no local terminal
[type=link] /bin=/x86/bin # executables in the path
[type=link] /apk=/home/apk # home dir
[perms=+r,+x] # Boot images made under MS-Windows
# need to be reminded of permissions.
devn-ne2000.so
devnp-shim.so
libc.so
fpemu.so
libsocket.so
[data=copy] # All executables that can be restarted
# go below.
devc-ser8250
io-pkt-v4
pipe
devc-pty
fs-nfs3
fs-cifs
inetd
esh
stty
ping
ls
# Data files are created in the named
# directory.
/etc/hosts = {
127.0.0.1 localhost
10.89 node89
10.222 node222
10.326 node326
10.0.1.181 QA node437
10.241 APP_ENG_1
}
/etc/services = {
ftp 21/tcp
telnet 23/tcp
pdebug 8000/tcp
}
/etc/inetd.conf = {
ftp stream tcp nowait root /bin/fdtpd fdtpd
telnet stream tcp nowait root /bin/telnetd telnetd
pdebug stream tcp nowait root /usr/bin/pdebug pdebug -
}