From: mckinneyj@cpva.saic.com Sent: Wednesday, March 03, 2004 12:29 PM To: Info-VAX@Mvb.Saic.Com Subject: Re: COMputable image linker map program counter help In article <4b6ec350.0403011346.2624ac75@posting.google.com>, JimStrehlow@data911.com (Jim Strehlow) writes: >> We did a $SHOW PROCESS/CONTINUOUS to get several PC address values. >> The PC ranges from 006F7510 through 00ADA638 >> > We try to have a separate batch DCL command procedure > (a "batch watchdog process") > that acts as a watchdog over the troublesome other process. > > How can we capture $SHOW PROCESS/CONTINUOUS or program counter > information in a batch watchdog process? > F$GETJPI does not appear to display program counter information. On Alpha? Maybe this will be useful? $ mac get_pc $ link/sysexe get_pc $ run get_pc ;++ .title GET_PC .ident "Get_PC V1" ;-- .macro check ?l blbs r0,l $exit_s r0 l: .endm check .library "sys$library:lib.mlb" .link "sys$system:sys.stb"/selective_search .extrn exe$cvt_epid_to_ipid, - ; convert ext pid to int pid exe$read_process, - ; read other proc's registers sys$cmkrnl_64 .psect _data quad,wrt,noshr $dscdef ; descriptor definitions $proc_read_writedef ; process read/write symbols $ssdef ; system service return codes ;****************** ; input data and prompt strings ;****************** pid_desc: ; descriptor for lib$get_input .word 8 .byte dsc$k_dtype_t .byte dsc$k_class_s .address .+4 .blkb 8 prompt: .ascid "pid> " ;****************** ; output buffer ;****************** tttext_size=80 tttext_buffer: ; buffer for $fao conversion .long tttext_size .address 10$ 10$: .blkb tttext_size epid: .blkl 1 ; extended PID t_pc: .blkb eacb$k_gen_register_size ; target's P(rogram)C(ounter) qast_count: .long 0 ; ast request counter kargs: .long 2 ; arguments to $cmkrnl k_epid: .address epid k_t_pc: .address t_pc k_epid_offset=k_epid-kargs k_t_pc_offset=k_t_pc-kargs ;****************** ; $fao output format ;****************** fmt: .ascid "!/ PC for PID !8XL is address !16XQ!/" ;****************** ; Main Program ; Prompt for pid ; hop into kernel mode and get target process PC ; display the info ;****************** .psect _code page,nowrt,shr .entry get_pc,^m<> pushal pid_desc ; read with prompt for PID pushal prompt pushal pid_desc calls #3,g^lib$get_input check pushl #1 ; convert ascii PID to binary EPID pushl #4 pushal epid pushal pid_desc calls #4,g^ots$cvt_tz_l check ;****************** ; Get the target's PC ;****************** $cmkrnl_s routin=get_it,arglst=kargs check ;****************** ; Format and display target PID and PC ;****************** movl #tttext_size,tttext_buffer ; reset buffer size $fao_s ctrstr=fmt,- outbuf=tttext_buffer,- outlen=tttext_buffer,- p1=epid,- p2=t_pc check pushal tttext_buffer calls #1,g^lib$put_output check ret ;****************** ; Kernel mode code to return target's PC ; Inputs: 4(ap) pid ; 8(ap) pc ; Outputs: pc buffer filled ; r0= ss$_normal we hope ; ;****************** .call_entry max_args=3, home_args=true, label=get_it, output=r0 movab g^exe$sigtoret,(fp) ; establish exception handler ; to prevent an ACCVIO from ; causing a SSRVEXCEPT bugcheck movl @k_epid_offset(ap),r0 ; EPID in R0 ; convert extended PID to internal PID using EXE$EPID_TO_IPID... input ; is in r0 and output will be in r0 jsb g^exe$cvt_epid_to_ipid ; convert extended to internal tstl r0 ; valid PID? bneq ok_proc ; 0=>error movl #ss$_nonexpr,r0 brw err_out ok_proc: $setup_call64 6 ; load 6 quadword args on stack moval qast_count,r1 $push_arg64 r1 ; address of AST counter $push_arg64 #eacb$k_general_register ; select general register type movl k_t_pc_offset(ap),r1 $push_arg64 r1 ; location to return PC value $push_arg64 #eacb$k_pc ; select PC $push_arg64 #eacb$k_gen_register_size ; length of return value $push_arg64 r0 ; target IPID jsb g^exe$read_process ; get PC from target process err_out: ret .end get_pc