# HG changeset patch # User Thinker K.F. Li # Date 1308566340 -28800 # Node ID 312dcf38226f8365c05a333f0e4fe32008d4d63d # Parent 38fdd422f611645c9e5fb1e26de22d2dbdc8c367 construct children of DEXFile from map items diff -r 38fdd422f611 -r 312dcf38226f paraspace/dexfile.py --- a/paraspace/dexfile.py Mon Jun 20 17:49:09 2011 +0800 +++ b/paraspace/dexfile.py Mon Jun 20 18:39:00 2011 +0800 @@ -1505,14 +1505,14 @@ child_names = 'header'.split() block_defs = { - # 0x0000: 'kDexTypeHeaderItem', + 0x0000: 'header', 0x0001: 'stringIds', 0x0002: 'typeIds', 0x0003: 'protoIds', 0x0004: 'fieldIds', 0x0005: 'methodIds', 0x0006: 'classDefs', - # 0x1000: 'kDexTypeMapList', + 0x1000: 'maps', 0x1001: 'typeLists', # 0x1002: 'kDexTypeAnnotationSetRefList', 0x1003: 'annotationSetItems', @@ -1567,6 +1567,8 @@ data = self.data maps = self.maps.items.items for map in maps: + if map.type in (0x0000, 0x1000): # header and maps + continue if map.type in self.block_defs: self._parse_block(map) pass @@ -1579,10 +1581,11 @@ pass def children(self): - return 'header stringIds typeIds protoIds fieldIds methodIds ' \ - 'classDefs typeLists annotationSetItems classDatas codeItems ' \ - 'stringDataItems debugInfoItems annotationItems ' \ - 'encodedArrayItems annotationsDirectoryItems'.split() + map_items = [self.block_defs[map_item.type] + for map_item in self.maps.items.items] + children = map_items + ['maps'] + print children + return children pass