about summary refs log tree commit diff stats
path: root/example/expression
diff options
context:
space:
mode:
Diffstat (limited to 'example/expression')
-rw-r--r--example/expression/asm_to_ir.py16
-rw-r--r--example/expression/graph_dataflow.py26
-rw-r--r--example/expression/solve_condition_stp.py22
3 files changed, 32 insertions, 32 deletions
diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py
index 552ddd36..4193f31d 100644
--- a/example/expression/asm_to_ir.py
+++ b/example/expression/asm_to_ir.py
@@ -8,7 +8,7 @@ from miasm2.arch.x86.ira import ir_a_x86_32
 
 
 # First, asm code
-blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
+blocks, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
 main:
    MOV    EAX, 1
    MOV    EBX, 2
@@ -25,20 +25,20 @@ loop:
 
 
 symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0)
-for b in blocs:
-    print b
+for block in blocks:
+    print block
 
 
 print "symbols:"
 print symbol_pool
-patches = asmbloc.asm_resolve_final(mn_x86, blocs, symbol_pool)
+patches = asmbloc.asm_resolve_final(mn_x86, blocks, symbol_pool)
 
 # Translate to IR
 ir_arch = ir_a_x86_32(symbol_pool)
-for b in blocs:
-    print 'add bloc'
-    print b
-    ir_arch.add_bloc(b)
+for block in blocks:
+    print 'add block'
+    print block
+    ir_arch.add_bloc(block)
 
 # Display IR
 for lbl, irblock in ir_arch.blocks.items():
diff --git a/example/expression/graph_dataflow.py b/example/expression/graph_dataflow.py
index 0b01956f..bd767165 100644
--- a/example/expression/graph_dataflow.py
+++ b/example/expression/graph_dataflow.py
@@ -49,12 +49,12 @@ def get_modified_symbols(sb):
     return out
 
 
-def intra_bloc_flow_symb(ir_arch, flow_graph, irbloc):
+def intra_bloc_flow_symb(ir_arch, flow_graph, irblock):
     symbols_init = ir_arch.arch.regs.regs_init.copy()
     sb = SymbolicExecutionEngine(ir_arch, symbols_init)
-    sb.emulbloc(irbloc)
+    sb.emulbloc(irblock)
     print '*' * 40
-    print irbloc
+    print irblock
     in_nodes = {}
     out_nodes = {}
 
@@ -68,7 +68,7 @@ def intra_bloc_flow_symb(ir_arch, flow_graph, irbloc):
             all_mems.update(get_expr_mem(n))
 
         for n in all_mems:
-            node_n_w = get_node_name(irbloc.label, 0, n)
+            node_n_w = get_node_name(irblock.label, 0, n)
             if not n == src:
                 continue
             o_r = n.arg.get_r(mem_read=False, cst_read=True)
@@ -76,7 +76,7 @@ def intra_bloc_flow_symb(ir_arch, flow_graph, irbloc):
                 if n_r in current_nodes:
                     node_n_r = current_nodes[n_r]
                 else:
-                    node_n_r = get_node_name(irbloc.label, i, n_r)
+                    node_n_r = get_node_name(irblock.label, i, n_r)
                 if not n_r in in_nodes:
                     in_nodes[n_r] = node_n_r
                 flow_graph.add_uniq_edge(node_n_r, node_n_w)
@@ -89,20 +89,20 @@ def intra_bloc_flow_symb(ir_arch, flow_graph, irbloc):
             if n_r in current_nodes:
                 node_n_r = current_nodes[n_r]
             else:
-                node_n_r = get_node_name(irbloc.label, 0, n_r)
+                node_n_r = get_node_name(irblock.label, 0, n_r)
             if not n_r in in_nodes:
                 in_nodes[n_r] = node_n_r
 
             flow_graph.add_node(node_n_r)
             for n_w in nodes_w:
-                node_n_w = get_node_name(irbloc.label, 1, n_w)
+                node_n_w = get_node_name(irblock.label, 1, n_w)
                 out_nodes[n_w] = node_n_w
 
                 flow_graph.add_node(node_n_w)
                 flow_graph.add_uniq_edge(node_n_r, node_n_w)
 
-    irbloc.in_nodes = in_nodes
-    irbloc.out_nodes = out_nodes
+    irblock.in_nodes = in_nodes
+    irblock.out_nodes = out_nodes
 
 
 def node2str(self, node):
@@ -121,7 +121,7 @@ def gen_block_data_flow_graph(ir_arch, ad, block_flow_cb):
         if irblock.label.offset == ad:
             irblock_0 = irblock
             break
-    assert(irbloc_0 is not None)
+    assert(irblock_0 is not None)
     flow_graph = DiGraph()
     flow_graph.node2str = lambda n: node2str(flow_graph, n)
 
@@ -133,8 +133,8 @@ def gen_block_data_flow_graph(ir_arch, ad, block_flow_cb):
         print 'IN', [str(x) for x in irblock.in_nodes]
         print 'OUT', [str(x) for x in irblock.out_nodes]
 
-    print '*' * 20, 'interbloc', '*' * 20
-    inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label)
+    print '*' * 20, 'interblock', '*' * 20
+    inter_bloc_flow(ir_arch, flow_graph, irblock_0.label)
 
     # from graph_qt import graph_qt
     # graph_qt(flow_graph)
@@ -169,7 +169,7 @@ if args.symb:
 else:
     block_flow_cb = intra_bloc_flow_raw
 
-gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb)
+gen_block_data_flow_graph(ir_arch, ad, block_flow_cb)
 
 print '*' * 40
 print """
diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py
index 1f0f2967..5d3ebc59 100644
--- a/example/expression/solve_condition_stp.py
+++ b/example/expression/solve_condition_stp.py
@@ -35,7 +35,7 @@ if not args:
     sys.exit(0)
 
 
-def get_bloc(ir_arch, mdis, ad):
+def get_block(ir_arch, mdis, ad):
     if isinstance(ad, asmbloc.asm_label):
         l = ad
     else:
@@ -46,7 +46,7 @@ def get_bloc(ir_arch, mdis, ad):
         ir_arch.add_bloc(b)
     b = ir_arch.get_bloc(l)
     if b is None:
-        raise LookupError('no bloc found at that address: %s' % l)
+        raise LookupError('no block found at that address: %s' % l)
     return b
 
 
@@ -62,11 +62,11 @@ def emul_symb(ir_arch, mdis, states_todo, states_done):
         sb.symbols = symbols.copy()
         if ir_arch.pc in sb.symbols:
             del(sb.symbols[ir_arch.pc])
-        b = get_bloc(ir_arch, mdis, ad)
+        b = get_block(ir_arch, mdis, ad)
 
-        print 'run bloc'
+        print 'run block'
         print b
-        # print blocs[ad]
+        # print blocks[ad]
         ad = sb.emulbloc(b)
         print 'final state'
         sb.dump_id()
@@ -161,20 +161,20 @@ if __name__ == '__main__':
 
     sb = SymbolicExecutionEngine(ir_arch, symbols_init)
 
-    blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
+    blocks, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
     PUSH argv
     PUSH argc
     PUSH ret_addr
     ''')
 
 
-    b = list(blocs)[0]
+    b = list(blocks)[0]
     print b
     # add fake address and len to parsed instructions
-    for i, l in enumerate(b.lines):
-        l.offset, l.l = i, 1
+    for i, line in enumerate(b.lines):
+        line.offset, line.l = i, 1
     ir_arch.add_bloc(b)
-    irb = get_bloc(ir_arch, mdis, 0)
+    irb = get_block(ir_arch, mdis, 0)
     sb.emulbloc(irb)
     sb.dump_mem()
 
@@ -185,7 +185,7 @@ if __name__ == '__main__':
     states_done = set()
     states_todo.add((uint32(ad), sb.symbols, ()))
 
-    # emul blocs, propagate states
+    # emul blocks, propagate states
     emul_symb(ir_arch, mdis, states_todo, states_done)
 
     all_info = []