for entry in self._dwarfinfo.CFI_entries():
if isinstance(entry, CIE):
- self._emitline('\n%08x %016x %016x CIE' % (
- entry.offset, entry['length'], entry['CIE_id']))
+ self._emitline('\n%08x %s %s CIE' % (
+ entry.offset,
+ self._format_hex(entry['length'], fullhex=True, lead0x=False),
+ self._format_hex(entry['CIE_id'], fullhex=True, lead0x=False)))
self._emitline(' Version: %d' % entry['version'])
self._emitline(' Augmentation: "%s"' % bytes2str(entry['augmentation']))
self._emitline(' Code alignment factor: %u' % entry['code_alignment_factor'])
self._emitline(' Return address column: %d' % entry['return_address_register'])
self._emitline()
else: # FDE
- self._emitline('\n%08x %016x %016x FDE cie=%08x pc=%016x..%016x' % (
+ self._emitline('\n%08x %s %s FDE cie=%08x pc=%s..%s' % (
entry.offset,
- entry['length'],
- entry['CIE_pointer'],
+ self._format_hex(entry['length'], fullhex=True, lead0x=False),
+ self._format_hex(entry['CIE_pointer'], fullhex=True, lead0x=False),
entry.cie.offset,
- entry['initial_location'],
- entry['initial_location'] + entry['address_range']))
+ self._format_hex(entry['initial_location'], fullhex=True, lead0x=False),
+ self._format_hex(
+ entry['initial_location'] + entry['address_range'],
+ fullhex=True, lead0x=False)))
self._emit(describe_CFI_instructions(entry))
self._emitline()
for entry in self._dwarfinfo.CFI_entries():
if isinstance(entry, CIE):
- self._emitline('\n%08x %016x %016x CIE "%s" cf=%d df=%d ra=%d' % (
+ self._emitline('\n%08x %s %s CIE "%s" cf=%d df=%d ra=%d' % (
entry.offset,
- entry['length'],
- entry['CIE_id'],
+ self._format_hex(entry['length'], fullhex=True, lead0x=False),
+ self._format_hex(entry['CIE_id'], fullhex=True, lead0x=False),
bytes2str(entry['augmentation']),
entry['code_alignment_factor'],
entry['data_alignment_factor'],
entry['return_address_register']))
ra_regnum = entry['return_address_register']
else: # FDE
- self._emitline('\n%08x %016x %016x FDE cie=%08x pc=%016x..%016x' % (
+ self._emitline('\n%08x %s %s FDE cie=%08x pc=%s..%s' % (
entry.offset,
- entry['length'],
- entry['CIE_pointer'],
+ self._format_hex(entry['length'], fullhex=True, lead0x=False),
+ self._format_hex(entry['CIE_pointer'], fullhex=True, lead0x=False),
entry.cie.offset,
- entry['initial_location'],
- entry['initial_location'] + entry['address_range']))
+ self._format_hex(entry['initial_location'], fullhex=True, lead0x=False),
+ self._format_hex(entry['initial_location'] + entry['address_range'],
+ fullhex=True, lead0x=False)))
ra_regnum = entry.cie['return_address_register']
# Print the heading row for the decoded table
# Compare ignoring whitespace
lines1_parts = lines1[i].split()
lines2_parts = lines2[i].split()
+
if ''.join(lines1_parts) != ''.join(lines2_parts):
ok = False
+
+ try:
+ # Ignore difference in precision of hex representation in the
+ # last part (i.e. 008f3b vs 8f3b)
+ if (''.join(lines1_parts[:-1]) == ''.join(lines2_parts[:-1]) and
+ int(lines1_parts[-1], 16) == int(lines2_parts[-1], 16)):
+ ok = True
+ except ValueError:
+ pass
+
sm = SequenceMatcher()
sm.set_seqs(lines1[i], lines2[i])
changes = sm.get_opcodes()
ok = True
break
if not ok:
- errmsg = 'Mismatch on line #%s:\n>>%s<<\n>>%s<<\n' % (
- i, lines1[i], lines2[i])
+ errmsg = 'Mismatch on line #%s:\n>>%s<<\n>>%s<<\n (%r)' % (
+ i, lines1[i], lines2[i], changes)
return False, errmsg
return True, ''