Mercurial > hg > python
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ptrace.py Mon Mar 09 14:58:04 2020 +0000 @@ -0,0 +1,23 @@ +#!/usr/bin/python +# usage: ptrace.py TRACE [result of nm xemacs | egrep '[$_]'] +import sys +symfile=open(sys.argv[2]) +syms={} +for l in symfile: + (addr,rest)=l.rstrip().split(' ',1) + syms[addr]=rest +symfile.close() +trfile=open(sys.argv[1]) + +for l in trfile: + (what,rest)=l.rstrip().split(' ',1) + if what in ('incipit','exit','p'): + print l.rstrip() + continue + (where,when)=rest.split() + try: + (z,b)=where.split('x') + print "%8s %s %s"%(what,syms["00"+b],when) + except: + print "not hex: ",l.rstrip() +trfile.close()