home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sherlock.zip / EXCEPT / EXCEPT.ZIP / EXCEPT.XED < prev    next >
Text File  |  1993-05-19  |  3KB  |  97 lines

  1. /*=======================================================================
  2. *   Function     : VM Xedit macro to analyse the Stack Dump 16:16
  3. *                : application's stack
  4. *   Author       : Fiammante Marc                  02/05/93
  5. *======================================================================*/
  6. say 'Analysing the stack dump .TRP file for 16:16 function calls'
  7. 'AUTOSAVE OFF'
  8. 'EXTRACT /WRAP/'
  9. 'SET WRAP OFF'
  10. 'TOP'
  11. 'LOCATE /EBP :/'
  12.  do i=1 while rc=0
  13.    'EXTRACT /CURLINE/'
  14.    parse value curline.3 with . . ebp . . eip .
  15.    'DOWN 1'
  16.    'EXTRACT /CURLINE/'
  17.    parse value curline.3 with . . cs . . ss .
  18.    ebp=substr(ebp,5,4)
  19.    ip=substr(eip,5,4)
  20.    /* say '>'EBP'<' */
  21.    ssb=x2b(ss)
  22.    ssb='000' || substr(ssb,1,length(ssb)-3)
  23.    ssn=b2x(ssb)
  24.    line=''
  25.    'EXTRACT /LINE/'
  26.    topline=line.1
  27.    dll=''
  28.    in=''
  29.    'LOCATE /'cs'/'
  30.    if rc=0 then do
  31.       'LOCATE -/MODULE/'
  32.       if rc=0 then do
  33.          'EXTRACT /CURLINE/'
  34.          parse value curline.3 with . dll .
  35.          in='In :'
  36.          if pos('.DLL',dll)=0 then do
  37.             dll=''
  38.             in=''
  39.          end
  40.       end
  41.    end
  42.    'BOT'
  43.    'INPUT --------------'
  44.    'INPUT TRAP number 'i
  45.    'INPUT Executing' cs':'ip 'Bp :'ebp  in  dll
  46.    ':'line.1
  47.    do while rc=0
  48.       nextline=ssn || substr(strip(ebp),1,3) || '0'
  49.       if line<>nextline then do
  50.          'LOCATE /'nextline'/'
  51.          if rc<>0 then leave
  52.          line=nextline
  53.       end
  54.       xoffset=substr(ebp,4,1)
  55.       offset=x2d(xoffset)
  56.       coffset=2*offset
  57.       'EXTRACT /CURLINE/'
  58.       curline.3=translate(curline.3,' ','>')
  59.       curline=space(substr(curline.3,12,39),0)
  60.       curline=substr(curline,coffset+1)
  61.       if length(curline)<9 then do
  62.          'DOWN 1'
  63.          'EXTRACT /CURLINE/'
  64.          line=substr(curline.3,2,8)
  65.          curline.3=translate(curline.3,' ','>')
  66.          curline=curline || space(substr(curline.3,12,39),0)
  67.       end
  68.       ebp=substr(curline,1,4)
  69.       ip =substr(curline,5,4)
  70.       cs =substr(curline,9,4)
  71.       'EXTRACT /LINE/'
  72.       ':'topline
  73.       dll=''
  74.       in=''
  75.       'LOCATE /'cs'/'
  76.       if rc=0 then do
  77.          'LOCATE -/MODULE/'
  78.          if rc=0 then do
  79.             'EXTRACT /CURLINE/'
  80.             parse value curline.3 with . dll .
  81.             in='In :'
  82.             if pos('.DLL',dll)=0 then do
  83.                dll=''
  84.                in=''
  85.             end
  86.          end
  87.       end
  88.       'BOT'
  89.       'INPUT Return to' cs':'ip 'Bp :'ebp  in  DLL
  90.       ':'line.1
  91.    end
  92.    ':'topline
  93.    'LOCATE /EBP :/'
  94. end
  95. 'SET WRAP' wrap.1
  96. 'MACRO K'
  97.