Update examples (#477)

* Use locked_context() in count_instructions example

 * We use this example on the front page, and it currently generates
   a flood of warnings.

* Update example indeces

* Remove dump_stats()

* Remove extra comments

* Remove redundant comments
This commit is contained in:
Yan 2017-09-01 17:05:43 -04:00 committed by GitHub
parent 9b8ef3cd76
commit 7679773088
5 changed files with 6 additions and 14 deletions

View File

@ -44,8 +44,8 @@ make
# Use the Manticore CLI
manticore basic
cat mcore_*/*0.stdin | ./basic
cat mcore_*/*1.stdin | ./basic
cat mcore_*/*2.stdin | ./basic
# Use the Manticore API
cd ../script

View File

@ -17,11 +17,13 @@ if __name__ == '__main__':
sys.exit(2)
m = Manticore(sys.argv[1])
m.context['count'] = 0
with m.locked_context() as context:
context['count'] = 0
@m.hook(None)
def explore(state):
m.context['count'] += 1
with m.locked_context() as context:
context['count'] += 1
m.run(procs=3)

View File

@ -16,6 +16,7 @@ if __name__ == '__main__':
# Create a new Manticore object
m = Manticore(sys.argv[1], sys.argv[2:])
m.verbosity = 2
if m.arch == 'arm':
target = (0x1082c, 'R4')
@ -31,10 +32,5 @@ if __name__ == '__main__':
sym_var = state.new_symbolic_value(32, label='from_callback')
state.cpu.write_register(target[1], sym_var)
# Start path exploration. start() returns when Manticore finishes
m.verbosity = 2
m.run()
# Print high level statistics
m.dump_stats()

View File

@ -25,7 +25,5 @@ if __name__ == '__main__':
print "Execution goal reached."
print "Instruction bytes: {:08x}".format(instruction)
# Start path exploration. m.run() returns when Manticore
# finishes
m.run()

View File

@ -12,9 +12,5 @@ if __name__ == '__main__':
path = sys.argv[1]
# Create a new Manticore object
m = Manticore(path)
# Start path exploration. start() returns when Manticore
# finishes
m.run()
# Print high level statistics
m.dump_stats()