Lines Matching refs:f

65    f = Reader(path)
67 magic = f.read(4)
69 f.isLSB, f.is64Bit = False, False
71 f.isLSB, f.is64Bit = True, False
73 f.isLSB, f.is64Bit = False, True
75 f.isLSB, f.is64Bit = True, True
79 print "('cputype', %r)" % f.read32()
80 print "('cpusubtype', %r)" % f.read32()
81 filetype = f.read32()
84 numLoadCommands = f.read32()
87 loadCommandsSize = f.read32()
90 print "('flag', %r)" % f.read32()
92 if f.is64Bit:
93 print "('reserved', %r)" % f.read32()
95 start = f.tell()
99 dumpLoadCommand(f, i, opts)
102 if f.tell() - start != loadCommandsSize:
106 def dumpLoadCommand(f, i, opts):
107 start = f.tell()
110 cmd = f.read32()
112 cmdSize = f.read32()
116 dumpSegmentLoadCommand(f, opts, False)
118 dumpSymtabCommand(f, opts)
120 dumpDysymtabCommand(f, opts)
122 dumpSegmentLoadCommand(f, opts, True)
125 print " ('uuid', %s)" % uuid.UUID(bytes=f.read(16))
129 f.read(cmdSize - 8)
132 if f.tell() - start != cmdSize:
136 def dumpSegmentLoadCommand(f, opts, is64Bit):
137 print " ('segment_name', %r)" % f.read(16)
139 print " ('vm_addr', %r)" % f.read64()
140 print " ('vm_size', %r)" % f.read64()
141 print " ('file_offset', %r)" % f.read64()
142 print " ('file_size', %r)" % f.read64()
144 print " ('vm_addr', %r)" % f.read32()
145 print " ('vm_size', %r)" % f.read32()
146 print " ('file_offset', %r)" % f.read32()
147 print " ('file_size', %r)" % f.read32()
148 print " ('maxprot', %r)" % f.read32()
149 print " ('initprot', %r)" % f.read32()
150 numSections = f.read32()
152 print " ('flags', %r)" % f.read32()
156 dumpSection(f, i, opts, is64Bit)
159 def dumpSymtabCommand(f, opts):
160 symoff = f.read32()
162 nsyms = f.read32()
164 stroff = f.read32()
166 strsize = f.read32()
169 prev_pos = f.tell()
171 f.seek(stroff)
172 string_data = f.read(strsize)
175 f.registerStringTable(string_data)
177 f.seek(symoff)
180 dumpNlist32(f, i, opts)
183 f.seek(prev_pos)
185 def dumpNlist32(f, i, opts):
187 n_strx = f.read32()
189 n_type = f.read8()
191 n_sect = f.read8()
193 n_desc = f.read16()
195 if f.is64Bit:
196 n_value = f.read64()
199 n_value = f.read32()
201 print " ('_string', %r)" % f.getString(n_strx)
204 def dumpDysymtabCommand(f, opts):
205 print " ('ilocalsym', %r)" % f.read32()
206 print " ('nlocalsym', %r)" % f.read32()
207 print " ('iextdefsym', %r)" % f.read32()
208 print " ('nextdefsym', %r)" % f.read32()
209 print " ('iundefsym', %r)" % f.read32()
210 print " ('nundefsym', %r)" % f.read32()
211 print " ('tocoff', %r)" % f.read32()
212 print " ('ntoc', %r)" % f.read32()
213 print " ('modtaboff', %r)" % f.read32()
214 print " ('nmodtab', %r)" % f.read32()
215 print " ('extrefsymoff', %r)" % f.read32()
216 print " ('nextrefsyms', %r)" % f.read32()
217 indirectsymoff = f.read32()
219 nindirectsyms = f.read32()
221 print " ('extreloff', %r)" % f.read32()
222 print " ('nextrel', %r)" % f.read32()
223 print " ('locreloff', %r)" % f.read32()
224 print " ('nlocrel', %r)" % f.read32()
226 prev_pos = f.tell()
228 f.seek(indirectsymoff)
232 print " (('symbol_index', %#x),)," % f.read32()
235 f.seek(prev_pos)
237 def dumpSection(f, i, opts, is64Bit):
239 print " (('section_name', %r)" % f.read(16)
240 print " ('segment_name', %r)" % f.read(16)
242 print " ('address', %r)" % f.read64()
243 size = f.read64()
246 print " ('address', %r)" % f.read32()
247 size = f.read32()
249 offset = f.read32()
251 print " ('alignment', %r)" % f.read32()
252 reloc_offset = f.read32()
254 num_reloc = f.read32()
256 print " ('flags', %#x)" % f.read32()
257 print " ('reserved1', %r)" % f.read32()
258 print " ('reserved2', %r)" % f.read32()
260 print " ('reserved3', %r)" % f.read32()
263 prev_pos = f.tell()
265 f.seek(reloc_offset)
269 print " (('word-0', %#x)," % f.read32()
270 print " ('word-1', %#x))," % f.read32()
274 f.seek(offset)
275 print " ('_section_data', '%s')" % common_dump.dataToHex(f.read(size))
277 f.seek(prev_pos)