Debugging requests that spawn daemons

From m204wiki
Revision as of 15:55, 15 September 2022 by Ekern (talk | contribs)
Jump to navigation Jump to search

If the application you are debugging spawns a daemon in either of the following cases, the daemon code is displayed in a dynamically created Daemon tab:

  • A SOUL Daemon object Run method for a daemon or transactional daemon.
  • A synchronous $COMMBG request (an output $list parameter is specified for the function)

daemon1f2

While the code in the Daemon (1) tab has focus, the current program in the Source Code tab waits for the daemon code to execute. The code line that spawned the daemon is highlighted, while the remaining Source Code lines are dimmed as a reminder that this code is not executable (the Run, Step, and Step Over buttons apply to the active code in the Daemon (1) tab). The Source Code lines are scrollable, however.

daemon2c1

Commands you invoke, like Step or Run, execute for the code on the Daemon (1) tab. When daemon execution is complete, the spawning program regains focus and the Daemon (1) tab is removed.

Multiple daemons 

If your program has daemons that call additional daemons, the Debugger will display their code on a separate tab, dynamically spawning more Daemon tabs (Daemon (2), Daemon (3), and so on up to 5). Each new Daemon page will get focus and respond to the code execution buttons, while the Source Code page and preceding Daemon pages will wait for the current daemon execution to complete. After the current daemon code runs to completion, its tab will be removed, Daemon thread completed will be displayed in the Status bar, and the preceding Daemon page will regain focus.

Discontinue Daemon debugging

You can optionally have the Debugger run in a mode that does not display daemon code in the Debugger Client. In this mode, the Debugger runs all other code as usual but suspends the display (but not the execution) of daemon code.

To enter this mode, from the Source Code page at any point during program execution, you simply press the Alt key and click the Run button (the ALT-F5 key combination is also equivalent, by default). Equivalent alternatives are the runWithoutDaemons command and the Run Without Daemons option of the Execution menu.

Once this mode is entered, all debugging of Daemons is suspended:

  • Subsequent daemon code executes normally but is not displayed
  • No Daemon (1) tab is shown in the GUI
  • No daemon source code is sent from the mainframe to the PC

Debugging an interactive daemon  

A daemon you have spawned with a SOUL Daemon class Run method (or RunAsynchronously or RunIndependently) might temporarily return control to its master thread by issuing a ReturnToMaster method. The master thread may do further processing and then return control to the daemon by issuing a Continue method (or ContinueAsync or ContinueIndependently). There may be multiple such exchanges of control.

This interactive processing is captured in the Debugger by:

  1. Keeping a tab (Source Code) open for the code of the master thread and a tab (Daemon) open for the daemon, as usual.
  2. Giving focus to the tab whose code is executing, and dimming the code in the other tab.

If a master thread issues a ContinueAsync or ContinueIndependently call, however, the focus does not shift to the Daemon tab (though its code remains available for inspection).

See Also

Controlling the execution of program code

Source Code tab