1 | TMGIDE5 ;TMG/kst/GT/M debugger Interrupt handler code ;03/18/09
|
---|
2 | ;;1.0;TMG-LIB;**1**;03/23/09
|
---|
3 | ;
|
---|
4 | ;" TMG IDE Debugger Interrupt handler code
|
---|
5 | ;"
|
---|
6 | ;" K. Toppenberg
|
---|
7 | ;" 3/18/09
|
---|
8 | ;" License: GPL Applies
|
---|
9 | ;"
|
---|
10 | ;"------------------------------------------------------------
|
---|
11 | ;"PUBLIC API
|
---|
12 | ;"------------------------------------------------------------
|
---|
13 | ;"PICKINTR -- show currently running jobs, and allow user to start debugging them
|
---|
14 | ;"INTERUPT -- respond to mupip intrpt, assigning control to a remote process
|
---|
15 |
|
---|
16 | ;"------------------------------------------------------------
|
---|
17 | ;"PRIVATE API
|
---|
18 | ;"------------------------------------------------------------
|
---|
19 | ;"LaunchIntr(JobNum) -- create interrupt message to job, then start listening
|
---|
20 | ;" for requests for control from interrupted process
|
---|
21 | ;"------------------------------------------------------------
|
---|
22 | ;"Dependencies
|
---|
23 | ;" TMGIDE4
|
---|
24 | ;" TMGKERNL
|
---|
25 | ;" %ZISUTL
|
---|
26 | ;" TMGUSRIF
|
---|
27 |
|
---|
28 | PICKINTR
|
---|
29 | ;"Purpose: To show currently running jobs, and allow user to start
|
---|
30 | ;" debugging them (tapping into process currently running)
|
---|
31 | ;"Called from TMGIDE
|
---|
32 | ;
|
---|
33 | new array
|
---|
34 | do MJOBS^TMGKERNL(.array)
|
---|
35 | kill array($J) ;"don't show this process
|
---|
36 | new Menu,UsrSlct
|
---|
37 | new i,j set i="",j=1
|
---|
38 | for set i=$order(array(i)) quit:(i="") do
|
---|
39 | . set Menu(j)="Job "_$get(array(i))_$char(9)_i
|
---|
40 | . set j=j+1
|
---|
41 | if $data(Menu)=0 do goto PIDone
|
---|
42 | set Menu(0)="Pick Job to Debug"
|
---|
43 | ;
|
---|
44 | M1 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
|
---|
45 | ;
|
---|
46 | if UsrSlct="^" goto PIDone
|
---|
47 | if UsrSlct=0 set UsrSlct="" goto M1
|
---|
48 | if UsrSlct=+UsrSlct do LaunchIntr(UsrSlct)
|
---|
49 | goto M1
|
---|
50 | ;
|
---|
51 | PIDone quit
|
---|
52 | ;
|
---|
53 | LaunchIntr(JobNum)
|
---|
54 | ;"Purpose: To create interrupt message to job, then start listening
|
---|
55 | ;" for requests for control from interrupted process
|
---|
56 | if +$get(JobNum)'>0 quit
|
---|
57 | set tmgDbgRemoteJob=JobNum
|
---|
58 | set ^XUTL("XUSYS","TMG COMMAND")="INTRPT"
|
---|
59 | zsystem "mupip intrpt "_JobNum
|
---|
60 | do Controller^TMGIDE3 ;"launch the controller
|
---|
61 | set ^XUTL("XUSYS","TMG COMMAND")=""
|
---|
62 | quit
|
---|
63 | ;
|
---|
64 | INTERUPT
|
---|
65 | ;"Purpose: To respond to mupip interrupt for a process, turning control
|
---|
66 | ;" over to a remote control process
|
---|
67 | ;"NOTE: This will be called by a modified version of JOBEXAM^ZU
|
---|
68 | if $get(TMGDEBUG) write !,"Sending INQ to connect to remote controller..."
|
---|
69 | new TMGR set TMGR=$$MessageOut^TMGIDE4("INQ "_$J,30)
|
---|
70 | if TMGR="" goto Int2
|
---|
71 | if $get(TMGDEBUG) do
|
---|
72 | . write !
|
---|
73 | . write "*****************************************************",!
|
---|
74 | . write "* INTERRUPT RECEIVED. Transferring control to *",!
|
---|
75 | . write "* a remote controller. That is process ",$$LJ^XLFSTR($piece(TMGR," ",2),5),?52,"*",!
|
---|
76 | . write "* *",!
|
---|
77 | . write "* Please switch to that process window for control. *",!
|
---|
78 | . write "*****************************************************",!
|
---|
79 | set TMGR=$$MessageOut^TMGIDE4("WRITE Notice: Controlling interrupted job #"_$J,,0)
|
---|
80 | set $ZSTEP="N TMGTrap S TMGTrap=$$STEPTRAP^TMGIDE4($ZPOS) zstep:(TMGTrap=1) into zstep:(TMGTrap=2) over zcontinue"
|
---|
81 | set TMGStepMode="into"
|
---|
82 | zstep into quit
|
---|
83 | Int2 quit
|
---|
84 | ;
|
---|