From: <bob...@us...> - 2007-07-28 01:28:15
|
Revision: 1212 http://hackndev.svn.sourceforge.net/hackndev/?rev=1212&view=rev Author: bobofdoom Date: 2007-07-27 18:28:12 -0700 (Fri, 27 Jul 2007) Log Message: ----------- Cocoboot: traceparse.py: added instruction decoding via objdump. Modified Paths: -------------- cocoboot/trunk/tools/traceparse.py Modified: cocoboot/trunk/tools/traceparse.py =================================================================== --- cocoboot/trunk/tools/traceparse.py 2007-07-28 00:38:08 UTC (rev 1211) +++ cocoboot/trunk/tools/traceparse.py 2007-07-28 01:28:12 UTC (rev 1212) @@ -1,11 +1,25 @@ #!/usr/bin/env python import struct import sys +import subprocess +import tempfile + +OBJDUMP_CMD = "arm-softfloat-linux-gnueabi-objdump" + if len(sys.argv) < 2: print 'Usage: %s cocoboot.trc' % sys.argv[0] print 'Decodes a raw cocoboot trace dump file' sys.exit(-1) +def decode_instr(instr): + tmpf = tempfile.NamedTemporaryFile() + tmpf.write(struct.pack('<I', instr)) + tmpf.flush() + + out = subprocess.Popen([OBJDUMP_CMD, "-D", "-bbinary", "-marm", tmpf.name], stdout=subprocess.PIPE).communicate()[0] + print out + + f = file(sys.argv[1], 'rb') while 1: data = f.read(16*4) @@ -20,6 +34,7 @@ reg = 'PC ' elif i == 15: reg = ' ' + decode_instr(w) else: reg = 'r%-2d' % (i-1) print '%s = %08x %-10d %s' % (reg, w,w, repr(s)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |