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:

  1. Sign on to a display station session
  2. Start a job to run the multithreaded program
  3. Use the Start Service Job (STRSRVJOB) command to service the job running the multithreaded program
  4. Call the Start Debug (STRDBG) command, adding programs to debug, and setting breakpoints
  5. Notify the servicing job when the thread hits a breakpoint so that it stops the thread
  6. Stop all threads with the debugger support
  7. Issue valid debug commands from the debug screen that is displayed
  8. Resume the thread that hit the breakpoint and then all other threads
  9. Repeat the above cycle until debugging is complete
  10. Call the End Debug (ENDDBG) command