From: <bob...@us...> - 2007-07-29 01:23:01
|
Revision: 1216 http://hackndev.svn.sourceforge.net/hackndev/?rev=1216&view=rev Author: bobofdoom Date: 2007-07-28 18:22:46 -0700 (Sat, 28 Jul 2007) Log Message: ----------- Cocoboot: Improved instruction decoding on traceparse.py by Sergey Lapin. Modified Paths: -------------- cocoboot/trunk/tools/traceparse.py Modified: cocoboot/trunk/tools/traceparse.py =================================================================== --- cocoboot/trunk/tools/traceparse.py 2007-07-29 00:47:07 UTC (rev 1215) +++ cocoboot/trunk/tools/traceparse.py 2007-07-29 01:22:46 UTC (rev 1216) @@ -16,7 +16,8 @@ tmpf.write(struct.pack('<I', instr)) tmpf.flush() - out = subprocess.Popen([OBJDUMP_CMD, "-D", "-bbinary", "-marm", tmpf.name], stdout=subprocess.PIPE).communicate()[0] + out = subprocess.Popen([OBJDUMP_CMD, "-D", "-bbinary", "-marm", "-Mreg-names-raw", tmpf.name], stdout=subprocess.PIPE).communicate()[0] + out = out.split('\n')[6] print out @@ -26,17 +27,40 @@ if not data: break words = struct.unpack('<16I', data) - for i, w in zip(range(len(words)), words): - s = str(struct.pack('<I', w)) - if i == 0: - reg = ' ' - elif i == 14: - 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)) - print '-' * 20 - print + if (words[15] & 0xffffff00) == 0xe580c000: + print '0x%08x = 0x%08x' % (words[1]+(words[15] & 0xff), words[13]) + elif (words[15] & 0xffffff00) == 0xe5810000: + print '0x%08x = 0x%08x' % (words[2]+(words[15] & 0xff), words[1]) + elif (words[15] & 0xffffff00) == 0xe5812000: + print '0x%08x = 0x%08x' % (words[2]+(words[15] & 0xff), words[3]) + elif (words[15] & 0xffffff00) == 0xe5801000: + print '0x%08x = 0x%08x' % (words[1]+(words[15] & 0xff), words[2]) +# elif (words[15] & 0xffffff00) == 0xe583e000: +# print '%08x = %08x' % (words[2]+(words[15] & 0xff), words[4]) + elif (words[15] & 0xffffff00) == 0xe5813000: + print '0x%08x = 0x%08x' % (words[2]+(words[15] & 0xff), words[4]) + elif (words[15] & 0xffffff00) == 0xe5821000: + print '0x%08x = 0x%08x' % (words[3]+(words[15] & 0xff), words[2]) + elif (words[15] & 0xffffff00) == 0xe5900000: + print 'ldr r0, [r0, #%d] => 0x%08x' % ((words[15] & 0xff), words[1]) + elif (words[15] & 0xffffff00) == 0xe5911000: + print 'ldr r1, [r1, #%d] => 0x%08x' % ((words[15] & 0xff), words[2]) + elif (words[15] & 0xffffff00) == 0xe59ee000: + print 'ldr r14, [r14, #%d] => ???' % ((words[15] & 0xff)) + elif (words[15] & 0xffffff00) == 0xe591e000: + print '0x%08x => r14' % (words[2]+(words[15] & 0xff)) + else: + for i, w in zip(range(len(words)), words): + s = str(struct.pack('<I', w)) + if i == 0: + reg = ' ' + elif i == 14: + 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)) + print '-' * 20 + print This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |