diff paraspace/dexfile.py @ 57:fa8fe7d714b9

Fix semantic bug of dexfile.depend_off_rel by searching relative offset. - _DEX_Try.handlerOff is not one2one mapped to a _DEX_Catch of common _DEX_Code object. - But, previous _link_dependencies() was wrote based on this idea. - This changeset fix the behavior by searching depend-on object with right offset related to 'relative_to' object of the 'depend_off_rel' instance.
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 25 Jun 2011 08:16:16 +0800
parents 6e4cf6905729
children c2a4921ec83b
line wrap: on
line diff
--- a/paraspace/dexfile.py	Fri Jun 24 10:56:33 2011 +0800
+++ b/paraspace/dexfile.py	Sat Jun 25 08:16:16 2011 +0800
@@ -1006,11 +1006,10 @@
 class _DEX_Try(composite):
     startAddr = uint32
     insnCount = uint16
-    catch_ref = ref('_DEX_Catch')
     handlerOff = depend_off_rel('_DEX_Code.handlers_size',
-                                '_DEX_Try.catch_ref')(uint16)
+                                '_DEX_Catch')(uint16)
 
-    child_names = 'startAddr insnCount catch_ref handlerOff'.split()
+    child_names = 'startAddr insnCount handlerOff'.split()
     pass
 
 
@@ -1034,9 +1033,8 @@
     handlers = array('count', _DEX_CatchHandler)
     catchAllHandler = cond((lambda parent, data, off: parent.catchesAll),
                            _DEX_CatchAllHandler)
-    try_ref = ref('_DEX_Try')
 
-    child_names = 'size handlers catchAllHandler try_ref'.split()
+    child_names = 'size handlers catchAllHandler'.split()
 
     @property
     def catchesAll(self):
@@ -1068,15 +1066,13 @@
     handlers_size = cond(_has_tries, uleb128)
     catch_handler_items = cond(_has_tries,
                                array('handlers_size.value', _DEX_Catch))
-    try_catch_asso = one2one('try_items.value.items', 'catch_ref',
-                             'catch_handler_items.value.items', 'try_ref')
 
     padding2 = auto_align(2)
 
     child_names = \
         'registersSize insSize outsSize triesSize debugInfoOff ' \
         'insnsSize insns padding try_items handlers_size ' \
-        'catch_handler_items try_catch_asso padding2'.split()
+        'catch_handler_items padding2'.split()
     pass