# HG changeset patch # User Thinker K.F. Li # Date 1308792771 -28800 # Node ID 870312703ba101e7ed8fe9973fc961ad5b69a8da # Parent 705356005362fd695179a8d80b4724557fc758aa Fix issuge of crossing dexfile.ref when updating offset diff -r 705356005362 -r 870312703ba1 paraspace/dex_deptracker.py --- a/paraspace/dex_deptracker.py Wed Jun 22 20:22:03 2011 +0800 +++ b/paraspace/dex_deptracker.py Thu Jun 23 09:32:51 2011 +0800 @@ -34,7 +34,11 @@ obj = obj.child_type continue - obj = getattr(parent, name) + try: + obj = getattr(parent, name) + except: + print obj, parent, name_path + raise pass return obj, parent @@ -760,13 +764,25 @@ obj, path_parts = queue.pop() name_path = '.'.join(path_parts) + obj_clazz = _resolve_name_path(name_path) + if isinstance(obj_clazz, dexfile.depend): + continue + if name_path in depon_dep_map: marker, dummy = _resolve_name_path(name_path) + while isinstance(marker, dexfile.ref): + marker, dummy = _resolve_name_path(marker.target_path) + try: + obj = obj[0] + except: + print name_path + raise + pass marker.set_marker(obj, moff()) pass if isinstance(obj, (tuple, list)): - attrs = [(elt, path_parts + [str(idx)]) + attrs = [(elt, make_path(elt, path_parts, str(idx))) for idx, elt in enumerate(obj)] attrs.reverse() queue = queue + attrs diff -r 705356005362 -r 870312703ba1 paraspace/dexfile.py --- a/paraspace/dexfile.py Wed Jun 22 20:22:03 2011 +0800 +++ b/paraspace/dexfile.py Thu Jun 23 09:32:51 2011 +0800 @@ -991,11 +991,11 @@ 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) - catch_ref = ref('_DEX_Catch') - child_names = 'startAddr insnCount handlerOff catch_ref'.split() + child_names = 'startAddr insnCount catch_ref handlerOff'.split() pass