diff options
| author | Ajax <commial@gmail.com> | 2018-07-02 17:31:59 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-07-03 14:28:18 +0200 |
| commit | 68fac2e86cc61eba9adfe520fa0e04a7e8943450 (patch) | |
| tree | 2be74a21b54a3111f3c18746badfb0cf1ed41149 /example/expression | |
| parent | 6ef8dbb2223d0847e3822b545b249511e96a1f9b (diff) | |
| download | miasm-68fac2e86cc61eba9adfe520fa0e04a7e8943450.tar.gz miasm-68fac2e86cc61eba9adfe520fa0e04a7e8943450.zip | |
symbol_pool -> loc_db
Diffstat (limited to 'example/expression')
| -rw-r--r-- | example/expression/access_c.py | 6 | ||||
| -rw-r--r-- | example/expression/asm_to_ir.py | 10 | ||||
| -rw-r--r-- | example/expression/constant_propagation.py | 2 | ||||
| -rw-r--r-- | example/expression/get_read_write.py | 6 | ||||
| -rw-r--r-- | example/expression/graph_dataflow.py | 4 | ||||
| -rw-r--r-- | example/expression/solve_condition_stp.py | 14 |
6 files changed, 21 insertions, 21 deletions
diff --git a/example/expression/access_c.py b/example/expression/access_c.py index 8856f6f8..9b92d201 100644 --- a/example/expression/access_c.py +++ b/example/expression/access_c.py @@ -141,12 +141,12 @@ cont = Container.fallback_container(data, None, addr=0) machine = Machine("x86_64") dis_engine, ira = machine.dis_engine, machine.ira -mdis = dis_engine(cont.bin_stream, symbol_pool=cont.symbol_pool) +mdis = dis_engine(cont.bin_stream, loc_db=cont.loc_db) addr_head = 0 asmcfg = mdis.dis_multiblock(addr_head) -lbl_head = mdis.symbol_pool.getby_offset(addr_head) +lbl_head = mdis.loc_db.getby_offset(addr_head) -ir_arch_a = ira(mdis.symbol_pool) +ir_arch_a = ira(mdis.loc_db) for block in asmcfg.blocks: ir_arch_a.add_block(block) diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py index 36965bfa..421d0884 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 from miasm2.analysis.data_flow import dead_simp # First, asm code -asmcfg, symbol_pool = parse_asm.parse_txt(mn_x86, 32, ''' +asmcfg, loc_db = parse_asm.parse_txt(mn_x86, 32, ''' main: MOV EAX, 1 MOV EBX, 2 @@ -24,17 +24,17 @@ loop: ''') -symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0) +loc_db.set_offset(loc_db.getby_name("main"), 0x0) for block in asmcfg.blocks: print block print "symbols:" -print symbol_pool -patches = asmblock.asm_resolve_final(mn_x86, asmcfg, symbol_pool) +print loc_db +patches = asmblock.asm_resolve_final(mn_x86, asmcfg, loc_db) # Translate to IR -ir_arch = ir_a_x86_32(symbol_pool) +ir_arch = ir_a_x86_32(loc_db) for block in asmcfg.blocks: print 'add block' print block diff --git a/example/expression/constant_propagation.py b/example/expression/constant_propagation.py index 3a81d909..b39bcafd 100644 --- a/example/expression/constant_propagation.py +++ b/example/expression/constant_propagation.py @@ -28,7 +28,7 @@ machine = Machine("x86_32") cont = Container.from_stream(open(args.filename)) ira, dis_engine = machine.ira, machine.dis_engine mdis = dis_engine(cont.bin_stream) -ir_arch = ira(mdis.symbol_pool) +ir_arch = ira(mdis.loc_db) addr = int(args.address, 0) diff --git a/example/expression/get_read_write.py b/example/expression/get_read_write.py index 9e3b5caf..1bacb251 100644 --- a/example/expression/get_read_write.py +++ b/example/expression/get_read_write.py @@ -1,9 +1,9 @@ from miasm2.arch.x86.arch import mn_x86 from miasm2.expression.expression import get_rw from miasm2.arch.x86.ira import ir_a_x86_32 -from miasm2.core.asmblock import AsmSymbolPool +from miasm2.core.locationdb import LocationDB -symbol_pool = AsmSymbolPool() +loc_db = LocationDB() print """ @@ -14,7 +14,7 @@ Get read/written registers for a given instruction arch = mn_x86 ir_arch = ir_a_x86_32() -l = arch.fromstring('LODSB', symbol_pool, 32) +l = arch.fromstring('LODSB', loc_db, 32) l.offset, l.l = 0, 15 ir_arch.add_instr(l) diff --git a/example/expression/graph_dataflow.py b/example/expression/graph_dataflow.py index 9b45a52d..d0d5564a 100644 --- a/example/expression/graph_dataflow.py +++ b/example/expression/graph_dataflow.py @@ -97,7 +97,7 @@ def gen_block_data_flow_graph(ir_arch, ad, block_flow_cb): irblock_0 = None for irblock in ir_arch.blocks.values(): loc_key = irblock.loc_key - offset = ir_arch.symbol_pool.loc_key_to_offset(loc_key) + offset = ir_arch.loc_db.loc_key_to_offset(loc_key) if offset == ad: irblock_0 = irblock break @@ -139,7 +139,7 @@ print 'ok' print 'generating dataflow graph for:' -ir_arch = ir_a_x86_32(mdis.symbol_pool) +ir_arch = ir_a_x86_32(mdis.loc_db) for block in asmcfg.blocks: print block diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py index 42e6670c..b941f092 100644 --- a/example/expression/solve_condition_stp.py +++ b/example/expression/solve_condition_stp.py @@ -88,23 +88,23 @@ if __name__ == '__main__': symbols_init = dict(machine.mn.regs.regs_init) - ir_arch = machine.ir(mdis.symbol_pool) + ir_arch = machine.ir(mdis.loc_db) symbexec = SymbolicExecutionEngine(ir_arch, symbols_init) - asmcfg, symbol_pool = parse_asm.parse_txt(machine.mn, 32, ''' + asmcfg, loc_db = parse_asm.parse_txt(machine.mn, 32, ''' init: PUSH argv PUSH argc PUSH ret_addr ''', - symbol_pool=mdis.symbol_pool) + loc_db=mdis.loc_db) - argc_lbl = symbol_pool.getby_name('argc') - argv_lbl = symbol_pool.getby_name('argv') - ret_addr_lbl = symbol_pool.getby_name('ret_addr') - init_lbl = symbol_pool.getby_name('init') + argc_lbl = loc_db.getby_name('argc') + argv_lbl = loc_db.getby_name('argv') + ret_addr_lbl = loc_db.getby_name('ret_addr') + init_lbl = loc_db.getby_name('init') argc = ExprLoc(argc_lbl, 32) argv = ExprLoc(argv_lbl, 32) |