Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Debugging a program with wvideo while it's executing
Ref. No. QNX.000009304
Category(ies) Development
Issue A program is showing unwanted behavior, and needs to be debugged on the fly to see exactly where the problem is in the source code. Some programs use fork() or spawn() and the wvideo doesn't seem to handle this. This is in QNX4 and using the Watcom 9.52 compiler.




Solution Debugging a program while it is executing using Watcom 9.52, or while it is forking or so on, is done by "attaching" the debugger to the running program. Just follow these steps:

1x09Run "sin" to find out the program's process ID (pid).

2x09Move to the directory that contains the appropriate source file (e.g. cd/work/src). Note the debugger's set source command can be used to tell it where to look for this file.

3x09Type "wvideo <pid>" where <pid> is the number from step 1.

wvideo will run, showing the source surrounding the next instruction to be executed. Note that if a shared-library function is being executed, the source will not be visible. To step through the shared-library function back to the source, use the debugger's trace command. Typing "show calls" to see how the program got to where it is.
It is possible to also debug a process that's running on another node. For example, let's say the development system is node 1 and the target system is node 2. While as a console on node 1 and process 3544 is running on node 2, simply type:

x09wvideo //2 3544

See Also: Debugger User's Guide for Watcom 9.52.