comparison ptrace.py @ 0:fee51ab07d09

blanket publication of all existing python files in lib/python on maritain
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 09 Mar 2020 14:58:04 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:fee51ab07d09
1 #!/usr/bin/python
2 # usage: ptrace.py TRACE [result of nm xemacs | egrep '[$_]']
3 import sys
4 symfile=open(sys.argv[2])
5 syms={}
6 for l in symfile:
7 (addr,rest)=l.rstrip().split(' ',1)
8 syms[addr]=rest
9 symfile.close()
10 trfile=open(sys.argv[1])
11
12 for l in trfile:
13 (what,rest)=l.rstrip().split(' ',1)
14 if what in ('incipit','exit','p'):
15 print l.rstrip()
16 continue
17 (where,when)=rest.split()
18 try:
19 (z,b)=where.split('x')
20 print "%8s %s %s"%(what,syms["00"+b],when)
21 except:
22 print "not hex: ",l.rstrip()
23 trfile.close()