Debugging Taskman Tasks

From VistApedia
Jump to: navigation, search

Background

The reason you would want to do this is that Taskman tasks are usually done in the background; so debugging them is difficult. In particular, you cannot use the debugger with them as they are not running in the foreground. This is a guide to help you run a task in the Foreground. Many thanks to the main Taskman programmer, Rick Marshall, for the directions. Questions? Hardhats google group.

Steps

  1. Place Taskman in Wait State (XUP -> XUTM WAIT)
  2. Invoke the code that schedules the task. The task will show up in ^%ZTSK
  3. Find your task in ^%ZTSK just to confirm its existence. It may be usually the last one; unless you are on a busy system.
  4. Put a breakpoint using ZBREAK on the code you want to debug
  5. Kill ^%ZTSCH("WAIT","MGR"). This allows the Manager to move the task to the job list.
  6. Set ^%ZTSCH("WAIT","MGR")=$H. This stops the Manager again.
  7. Kill ^%ZTSCH("STOP"). This lifts the ban on sub-managers.
  8. Run ^%ZTMS. It will break at the breakpoint. You put on. Now you are debugging the task in the foreground.

A tiny warning: Taskman frequently opens a device prior to running a task. If that's so, make sure your $ZSTEP is appropriate so that it switches between the current $IO and $P. GT.M will warn you if your output is going elsewhere.