Multithreaded job debugging
You can use the mechanism provided by the spawn() API to start a debugging session before actually calling the multithreaded program to be debugged.
Setting the QIBM_CHILD_JOB_SNDINQMSG environment variable to 1 controls this capability.
An example SPAWN command is available for your use and modification as part of IBM® i option 7, the IBM i Example Tools Library, QUSRTOOL. Member TP0ZINFO in the file QATTINFO in the QUSRTOOL library contains information about how to create the SPAWN CL command.
You can also simplify the process of starting a job that runs the multithreaded program and the debugging session by creating a command (such as the SPAWN command) that performs the necessary steps. The steps are as follows:
- Sign on to a display station session
- Start a job to run the multithreaded program
- Use the Start Service Job (STRSRVJOB) command to service the job running the multithreaded program
- Call the Start Debug (STRDBG) command, adding programs to debug, and setting breakpoints
- Notify the servicing job when the thread hits a breakpoint so that it stops the thread
- Stop all threads with the debugger support
- Issue valid debug commands from the debug screen that is displayed
- Resume the thread that hit the breakpoint and then all other threads
- Repeat the above cycle until debugging is complete
- Call the End Debug (ENDDBG) command