PASE Snoop

Various PASE snoop utilities exist for static PASE binaries (not running) …

call qp2term

Conventional PASE path geometry ...
main programs (PASE *PGM)
> cd /usr/bin
> cd /usr/local/bin
> always ... /bin
shared programs (PASE *BNDSRVPGM)
> cd /usr/lib
> cd /usr/local/lib
> always ... /lib

Recursive path find/search file name with partial name 
> cd /usr/lib
> find . -name "*Xm*" -print

See contents PASE shared library (PASE BNDSVRPGM)
> ar -t  /usr/lib/libXm.a
   shr_32.o
   shr4.o
   $

See the import/exports of any PASE binary 
> dump -Tuv /usr/lib/libXm.a
  output all import/exports 

PASE snoop running binaries to see guts …

>
call qp2term

wrkactjob for PASE jobs only ... 
> ps -ef 
:
qtmhhttp 10770 10769   0   Sep 05      -  0:00 /QOpenSys/QIBM/ProdData/OS400/PASE/sbin/zfcgi 0 0 /myasp2/www/zend2/logs 23 24 10 20 
qtmhhttp 10771 10770   0   Sep 05      -  0:02 /usr/local/ZendSvr/bin/php-cgi.bin 
:

debugger attach to snoop program guts ...
> dbx -a 10754
Waiting to attach to process 10754 ...
Successfully attached to /QOpenSys/QIBM/ProdData/OS400/PASE/sbin/zfcgi.
Type 'help' for help.
reading symbolic information ...warning: no source compiled with -g

stopped in __fd_poll at 0xd0110fa0
0xd0110fa0 (__fd_poll+0x8c) 80410014         lwz   r2,0x14(r1)


dbx map -- see what was loaded by this program while running (PASE *BNDSRVPGMs)
(dbx) map
Entry 1:
   Object name: /QOpenSys/QIBM/ProdData/OS400/PASE/sbin/zfcgi  <--- main program (PASE *PGM)
   Text origin:     0x10000000
   Text length:     0x7aa1
   Data origin:     0x30000000
   Data length:     0x25f8
   File descriptor: 0x3

Entry 2:
   Object name: /usr/lib/libcrypt.a <--- libc.a needed libcrypt.a <--- another shared library (PASE *BNDSRVPGM)
   Member name: shr.o
   Text origin:     0xd02f50f8
   Text length:     0x846
   Data origin:     0xf00f1508
   Data length:     0x128
   File descriptor: 0x4

Entry 3:
   Object name: /usr/lib/libc.a <-- zfci needed libc.a <--- shared library (PASE *BNDSRVPGM)
   Member name: shr.o
   Text origin:     0xd004b980
   Text length:     0x2a9177
   Data origin:     0xf0049e28
   Data length:     0xa67c8
   File descriptor: 0x5

dbx detach -- let process continue running 
dbx quit -- kill the process right now (*immed)
(dbx) detach 
> 


===========================
HEY -- sometimes the binaries are very big and complex with many files ...
============================
Ops ... dbx ran out of space ... 
> dbx -a 10771
Waiting to attach to process 10771 ...
Successfully attached to /usr/local/ZendSvr/bin/php-cgi.bin.
Type 'help' for help.
reading symbolic information ...dbx: fatal error: nesting depth limit (25) exceeded.
Use the -d option to increase nesting depth limit.

Well -d 100 give it more nesting depth ...
> dbx -d 100 -a 10771
Waiting to attach to process 10771 ...
Successfully attached to /usr/local/ZendSvr/bin/php-cgi.bin.
Type 'help' for help.
reading symbolic information ...
stopped in wait.wait [/usr/lib/libc.a] at 0xd00dfb00 ($t1)
0xd00dfb00 (wait+0xe8) 80410014         lwz   r2,0x14(r1)

dbx map -- SO MUCH STUFF map not fit on screen ... so pipe to tmp file (map > mymap.txt)
(dbx) map > mymap.txt 

dbx detach -- let process continue running 
dbx quit -- kill the process right now (*immed)
(dbx) detach
>

look at the top of file ...
> head mymap.txt
Entry 1:
   Object name: /usr/local/ZendSvr/bin/php-cgi.bin
   Text origin:     0x10000000
   Text length:     0x78e6e2
   Data origin:     0x30000a47
   Data length:     0x9d761
   File descriptor: 0x3

Entry 2:
   Object name: /usr/local/ZendSvr/lib/libxerces-c.a


look at bottom of file ...
> tail mymap.txt
Entry 98:
   Object name: /usr/lib/libc.a
   Member name: shr.o
   Text origin:     0xd004b980
   Text length:     0x2a9177
   Data origin:     0xf0049e28
   Data length:     0xa67c8
   File descriptor: 0x64
> 


Author(s)

Tony “Ranger” Cairns - IBM i PHP / PASE