Attempt at OS X symbol lookup fix

This commit is contained in:
Alex Groce
2017-12-14 11:39:37 -08:00
parent 31838780c3
commit 0d934d4fac
2 changed files with 22 additions and 6 deletions
+12 -4
View File
@@ -319,9 +319,14 @@ def main():
if not setup_ea:
raise Exception()
except:
L.critical("Cannot find symbol `DeepState_Setup` in binary `{}`".format(
try:
setup_ea = project.kb.labels.lookup('_DeepState_Setup')
if not setup_ea:
raise Exception()
except:
L.critical("Cannot find symbol `DeepState_Setup` in binary `{}`".format(
args.binary))
return 1
return 1
entry_state = project.factory.entry_state(
add_options={angr.options.ZERO_FILL_UNCONSTRAINED_MEMORY,
@@ -345,8 +350,11 @@ def main():
# Read the API table, which will tell us about the location of various
# symbols. Technically we can look these up with the `labels.lookup` API,
# but we have the API table for Manticore-compatibility, so we may as well
# use it.
ea_of_api_table = project.kb.labels.lookup('DeepState_API')
# use it.
try:
ea_of_api_table = project.kb.labels.lookup('DeepState_API')
except:
ea_of_api_table = project.kb.labels.lookup('_DeepState_API')
mc = DeepAngr(state=run_state)
apis = mc.read_api_table(ea_of_api_table)
+10 -2
View File
@@ -327,15 +327,23 @@ def main():
if not setup_ea:
raise Exception("Could not find symbol")
except:
L.critical("Cannot find symbol `DeepState_Setup` in binary `{}`: {}".format(
try:
setup_ea = m._get_symbol_address('_DeepState_Setup')
if not setup_ea:
raise Exception("Could not find symbol")
except:
L.critical("Cannot find symbol `DeepState_Setup` in binary `{}`: {}".format(
args.binary, traceback.format_exc()))
return 1
return 1
setup_state = m._initial_state
mc = DeepManticore(setup_state)
ea_of_api_table = m._get_symbol_address('DeepState_API')
if not ea_of_api_table:
ea_of_api_table = m._get_symbol_address('_DeepState_API')
apis = mc.read_api_table(ea_of_api_table)
del mc
m.add_hook(setup_ea, lambda state: run_tests(args, state, apis))