comparison python/outstream.py @ 259:ac603eb66b63

Added function call
author Windel Bouwman
date Mon, 05 Aug 2013 20:41:25 +0200
parents 04c19282a5aa
children 9417caea2eb3
comparison
equal deleted inserted replaced
258:04c19282a5aa 259:ac603eb66b63
76 self.dumpSection(s) 76 self.dumpSection(s)
77 77
78 def dumpSection(self, s): 78 def dumpSection(self, s):
79 print('.section '+ s) 79 print('.section '+ s)
80 for i in self.sections[s].instructions: 80 for i in self.sections[s].instructions:
81 if type(i) is DebugInfo:
82 continue
81 addr = i.address 83 addr = i.address
82 insword = i.encode() 84 insword = i.encode()
83 assert type(insword) is bytes 85 assert type(insword) is bytes
84 insword = binascii.hexlify(bytes(reversed(insword))).decode('ascii') 86 insword = binascii.hexlify(bytes(reversed(insword))).decode('ascii')
85 asm = str(i) 87 asm = str(i)
86 if len(insword) == 0: 88 if len(insword) == 0:
87 print(' {}'.format(asm)) 89 print(' {}'.format(asm))
88 else: 90 else:
89 print(' 0x{0:08x} 0x{1} {2}'.format(addr, insword, asm)) 91 print(' 0x{0:08x} 0x{1} {2}'.format(addr, insword, asm))
90 92
91 class TextOutputStream(OutputStream): 93 class TextOutputStream(OutputStream):
92 pass 94 pass