home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!usc!elroy.jpl.nasa.gov!euclid.JPL.NASA.GOV!pjs
- From: pjs@euclid.JPL.NASA.GOV (Peter J. Scott)
- Subject: Getting PC of process: will this code work in V5?
- Message-ID: <1992Sep11.234602.9702@elroy.jpl.nasa.gov>
- Sender: news@elroy.jpl.nasa.gov (Usenet)
- Nntp-Posting-Host: euclid.jpl.nasa.gov
- Reply-To: pjs@euclid.jpl.nasa.gov
- Organization: Jet Propulsion Laboratory, NASA/Caltech
- Date: Fri, 11 Sep 1992 23:46:02 GMT
- Lines: 100
-
- Several years ago I needed a routine that would return the program counter
- of a specified process and a kind netter (whose name, I am afraid, I no
- longer have) sent me the code below. I haven't run it since we upgraded
- to VMS 5.x, and would like to know whether this code would run okay
- without actually having to try it, since it requires CMKRNL and I assign
- it a high probability of crashing the system if it fails, something I
- can't afford on these systems. I'd be most grateful if some guru can tell
- me whether this code is still good, or how it should be changed. The rest
- of you might get a kick out of the opening comments...
-
- .TITLE GET_PC Get any process' PC
- .IDENT /V04-002/
- ;
- ;****************************************************************************
- ;* *
- ;* COPYRIGHT (c) 1985, 1986 *
- ;* BY WIGITAL EQUIPMENT CORPORATION, MUNCHER, MINN. *
- ;* *
- ;* THIS SOFTWARE IS NOT LICENSED AND MAY BE ABUSED AND/OR COPIED WITHOUT *
- ;* THE HASSLE ASSOCIATED WITH STUPID LICENSING TERMS AND WITHOUT *
- ;* INCLUSION OF ANY COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COPIES *
- ;* THEREOF MAY BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER *
- ;* MUNCHER. SEND PLENTY OF SPRS; FUEL OIL IS DAMNED EXPENSIVE IN *
- ;* MINNESOTA AND IT GETS REAL COLD. NO TITLE TO OR OWNERSHIP OF THE *
- ;* SOFTWARE IS HEREBY CLAIMED (QUITE FRANKLY, WE'RE TOO EMBARRASSED). *
- ;* *
- ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE *
- ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY WIGITAL EQUIPMENT *
- ;* CORPORATION. *
- ;* *
- ;* WIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS *
- ;* SOFTWARE ON EQUIPMENT WHICH IS SUPPLIED BY WIGITAL.
- *
- ;* *
- ;****************************************************************************
- ;
- .LIBRARY /SYS$LIBRARY:LIB/
- $PCBDEF
- $PHDDEF
- $SSDEF
- .DEFAULT DISPLACEMENT,WORD
- .ENABLE SUPPRESSION
-
- .PAGE
- .TITLE GET_PC
- ;
- ; Functional description:
- ; This service returns the PC of any process the
- ; user is entitled to control.
- ;
- ; Calling sequence:
- ; CALLS/CALLG
- ;
- ; Input Parameters:
- ; (AP) 3
- ; 4(AP) Address of process identification
- ; 8(AP) Address of descriptor of process name
- ;
- ; Output Parameters:
- ; @4(AP) Process identification
- ; @12(AP) Address of longword to return new name
- ;
- ;
- ;Make sure we are all in one page or fault will crash machine!
- .PSECT CIT_CODE,PAGE,NOWRT,EXE,PIC,SHR
-
- .ENTRY GET_PC,^M<>
- PUSHAL (AP)
- PUSHAW B^GET_PC_KERNEL
- CALLS #2,G^SYS$CMKRNL
- RET
-
- .ENTRY GET_PC_KERNEL,^M<R2,R3,R4>
-
- IFNOWRT #4,@12(AP),3$
-
- JSB G^EXE$NAMPID
- BLBC R0,2$
-
- BBC #PCB$V_PHDRES,B^PCB$L_STS(R4),1$
- MOVL B^PCB$L_PHD(R4),R1
- MOVL W^PHD$L_PC(R1),R0
- SETIPL #0
- MOVL R0,@12(AP)
- MOVL #1,R0
- RET
-
- 1$: MOVL #SS$_SUSPENDED,R0
- 2$: SETIPL #0
- RET
-
- 3$: MOVL #SS$_ACCVIO,R0
- RET
- .END
-
- --
- This is news. This is your | Peter Scott, NASA/JPL/Caltech
- brain on news. Any questions? | (pjs@euclid.jpl.nasa.gov)
-
-
-