summaryrefslogtreecommitdiff
path: root/tools/mapfile_tool.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mapfile_tool.py')
-rwxr-xr-xtools/mapfile_tool.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/mapfile_tool.py b/tools/mapfile_tool.py
index 92e53ad..3556d0d 100755
--- a/tools/mapfile_tool.py
+++ b/tools/mapfile_tool.py
@@ -215,28 +215,39 @@ def do_mapfile(src, dest, fix_offset):
def work_on_hook(hook, id, func):
- #print 'doing %s (%s) for %s' % (hook['name'], hook['type'], id)
+
+ try:
+ t = hook['type']
- t = hook['type']
+ if t == 'patch':
+ error = 'missing addr'
+
+ hook['addr_%s' % id] = func(hook['addr_%s' % original])
- if t == 'patch':
- hook['addr_%s' % id] = func(hook['addr_%s' % original])
+ elif t == 'branch_insn' or t == 'add_func_pointer':
+ error = 'missing src_addr'
- elif t == 'branch_insn' or t == 'add_func_pointer':
- hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original])
+ hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original])
- if 'target_func_%s' % original in hook:
- hook['target_func_%s' % id] = func(hook['target_func_%s' % original])
+ if 'target_func_%s' % original in hook:
+ error = 'missing target_func'
- elif t == 'nop_insn':
- area = hook['area_%s' % original]
- if isinstance(area, list):
- start = func(area[0])
- new_area = [start, start + (area[1] - area[0])]
- else:
- new_area = func(area)
+ hook['target_func_%s' % id] = func(hook['target_func_%s' % original])
- hook['area_%s' % id] = new_area
+ elif t == 'nop_insn':
+ error = 'missing area'
+
+ area = hook['area_%s' % original]
+ if isinstance(area, list):
+ start = func(area[0])
+ new_area = [start, start + (area[1] - area[0])]
+ else:
+ new_area = func(area)
+
+ hook['area_%s' % id] = new_area
+
+ except:
+ print 'Key Error %s for %s (%s) for %s' % (error, hook['name'], hook['type'], id)
#if hook['name'] == 'WM_onCreate': print hook