about summary refs log tree commit diff stats
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/disasm/file.py4
-rw-r--r--example/expression/simplification_tools.py1
-rw-r--r--example/ida/ctype_propagation.py1
-rw-r--r--example/ida/graph_ir.py1
-rwxr-xr-xexample/jitter/mips32.py17
-rwxr-xr-xexample/jitter/msp430.py15
-rw-r--r--example/jitter/x86_32.py3
7 files changed, 17 insertions, 25 deletions
diff --git a/example/disasm/file.py b/example/disasm/file.py
index 88ba6162..196e1b1a 100644
--- a/example/disasm/file.py
+++ b/example/disasm/file.py
@@ -13,6 +13,6 @@ cont = Container.from_stream(open(sys.argv[1]))
 mdis = dis_x86_32(cont.bin_stream)
 # Inform the engine to avoid disassembling null instructions
 mdis.dont_dis_nulstart_bloc = True
-blocks = mdis.dis_multiblock(addr)
+asmcfg = mdis.dis_multiblock(addr)
 
-open('graph.dot', 'w').write(blocks.dot())
+open('graph.dot', 'w').write(asmcfg.dot())
diff --git a/example/expression/simplification_tools.py b/example/expression/simplification_tools.py
index 7c15b3e7..cb062fb3 100644
--- a/example/expression/simplification_tools.py
+++ b/example/expression/simplification_tools.py
@@ -32,7 +32,6 @@ x = ExprMem(a + b + ExprInt(0x42, 32), 32)
 
 
 def replace_expr(e):
-    # print 'visit', e
     dct = {c + ExprInt(0x42, 32): d,
            a + b: c, }
     if e in dct:
diff --git a/example/ida/ctype_propagation.py b/example/ida/ctype_propagation.py
index d35835dc..db324833 100644
--- a/example/ida/ctype_propagation.py
+++ b/example/ida/ctype_propagation.py
@@ -268,7 +268,6 @@ def analyse_function():
     iraCallStackFixer = get_ira_call_fixer(ira)
     ir_arch = iraCallStackFixer(mdis.symbol_pool)
 
-
     asmcfg = mdis.dis_multiblock(addr)
     # Generate IR
     for block in asmcfg.blocks:
diff --git a/example/ida/graph_ir.py b/example/ida/graph_ir.py
index 97d30851..dd842281 100644
--- a/example/ida/graph_ir.py
+++ b/example/ida/graph_ir.py
@@ -116,7 +116,6 @@ def build_graph(verbose=False, simplify=False):
 
     # populate symbols with ida names
     for addr, name in idautils.Names():
-        # print hex(ad), repr(name)
         if name is None:
             continue
         if (mdis.symbol_pool.getby_offset(addr) or
diff --git a/example/jitter/mips32.py b/example/jitter/mips32.py
index c5b2f7f5..31ab03c8 100755
--- a/example/jitter/mips32.py
+++ b/example/jitter/mips32.py
@@ -5,16 +5,11 @@ from miasm2.analysis import debugging
 from miasm2.jitter.csts import *
 from miasm2.analysis.machine import Machine
 
-from pdb import pm
-
 parser = ArgumentParser(
     description="""Sandbox raw binary with mips32 engine
 (ex: jit_mips32.py example/mips32_sc_l.bin 0)""")
-parser.add_argument("-r", "--log-regs",
-                    help="Log registers value for each instruction",
-                    action="store_true")
-parser.add_argument("-m", "--log-mn",
-                    help="Log desassembly conversion for each instruction",
+parser.add_argument("-t", "--trace",
+                    help="Log instructions/registers values",
                     action="store_true")
 parser.add_argument("-n", "--log-newbloc",
                     help="Log basic blocks processed by the Jitter",
@@ -43,9 +38,11 @@ def jit_mips32_binary(args):
     myjit.init_stack()
 
     # Log level (if available with jitter engine)
-    myjit.jit.log_regs = args.log_regs
-    myjit.jit.log_mn = args.log_mn
-    myjit.jit.log_newbloc = args.log_newbloc
+    myjit.set_trace_log(
+        trace_instr=args.trace,
+        trace_regs=args.trace,
+        trace_new_blocks=args.log_newbloc
+    )
 
     myjit.vm.add_memory_page(0, PAGE_READ | PAGE_WRITE, open(filepath).read())
     myjit.add_breakpoint(0x1337BEEF, code_sentinelle)
diff --git a/example/jitter/msp430.py b/example/jitter/msp430.py
index 6dd67542..2f9b8649 100755
--- a/example/jitter/msp430.py
+++ b/example/jitter/msp430.py
@@ -8,11 +8,8 @@ from miasm2.analysis.machine import Machine
 parser = ArgumentParser(
     description="""Sandbox raw binary with msp430 engine
 (ex: jit_msp430.py example/msp430_sc.bin 0)""")
-parser.add_argument("-r", "--log-regs",
-                    help="Log registers value for each instruction",
-                    action="store_true")
-parser.add_argument("-m", "--log-mn",
-                    help="Log desassembly conversion for each instruction",
+parser.add_argument("-t", "--trace",
+                    help="Log instructions/registers values",
                     action="store_true")
 parser.add_argument("-n", "--log-newbloc",
                     help="Log basic blocks processed by the Jitter",
@@ -36,9 +33,11 @@ def jit_msp430_binary(args):
     myjit.init_stack()
 
     # Log level (if available with jitter engine)
-    myjit.jit.log_regs = args.log_regs
-    myjit.jit.log_mn = args.log_mn
-    myjit.jit.log_newbloc = args.log_newbloc
+    myjit.set_trace_log(
+        trace_instr=args.trace,
+        trace_regs=args.trace,
+        trace_new_blocks=args.log_newbloc
+    )
 
     myjit.vm.add_memory_page(0, PAGE_READ | PAGE_WRITE, open(filepath, "rb").read())
     myjit.add_breakpoint(0x1337, lambda _: exit(0))
diff --git a/example/jitter/x86_32.py b/example/jitter/x86_32.py
index 1409d7aa..5272f732 100644
--- a/example/jitter/x86_32.py
+++ b/example/jitter/x86_32.py
@@ -24,8 +24,7 @@ data = open(args.filename).read()
 run_addr = 0x40000000
 myjit.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE, data)
 
-myjit.jit.log_regs = True
-myjit.jit.log_mn = True
+myjit.set_trace_log()
 myjit.push_uint32_t(0x1337beef)
 
 myjit.add_breakpoint(0x1337beef, code_sentinelle)