X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2FScripts%2Fmacho-dump;h=8c9fa59c601060815b6a56c14fd40e31b789aae5;hb=648b20d5dbc54391f0d38c6ff16cf304bf3cb297;hp=c2598f5b00d8be0ea51211bc9eb80b9fe41fe8d2;hpb=f0a0be47ed02c93e9679e8cf76a52a2ab18d3276;p=oota-llvm.git diff --git a/test/Scripts/macho-dump b/test/Scripts/macho-dump index c2598f5b00d..8c9fa59c601 100755 --- a/test/Scripts/macho-dump +++ b/test/Scripts/macho-dump @@ -4,6 +4,8 @@ import struct import sys import StringIO +import common_dump + class Reader: def __init__(self, path): if path == '-': @@ -41,7 +43,10 @@ class Reader: return int(Value) def read64(self): - return struct.unpack('><'[self.isLSB] + 'Q', self.read(8))[0] + Value = struct.unpack('><'[self.isLSB] + 'Q', self.read(8))[0] + if Value == int(Value): + Value = int(Value) + return Value def registerStringTable(self, strings): if self.string_table is not None: @@ -187,8 +192,12 @@ def dumpNlist32(f, i, opts): print " ('n_sect', %r)" % n_sect n_desc = f.read16() print " ('n_desc', %r)" % n_desc - n_value = f.read32() - print " ('n_value', %r)" % n_value + if f.is64Bit: + n_value = f.read64() + print " ('n_value', %r)" % n_value + else: + n_value = f.read32() + print " ('n_value', %r)" % n_value print " ('_string', %r)" % f.getString(n_strx) print " )," @@ -263,7 +272,7 @@ def dumpSection(f, i, opts, is64Bit): if opts.dumpSectionData: f.seek(offset) - print " ('_section_data', %r)" % f.read(size) + print " ('_section_data', '%s')" % common_dump.dataToHex(f.read(size)) f.seek(prev_pos)