about summary refs log tree commit diff stats
path: root/example/disasm/full.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2016-03-21 16:27:09 +0100
committerAjax <commial@gmail.com>2016-03-21 16:28:23 +0100
commit1d9924a4f753d335ed12a0dc9e6b816414338e18 (patch)
tree33d344aeb151d00aa9dd1d5b94fe1d93a38c5f9b /example/disasm/full.py
parent786d97b5ac3d32090cb67a35c43c64eb34041ec7 (diff)
downloadfocaccia-miasm-1d9924a4f753d335ed12a0dc9e6b816414338e18.tar.gz
focaccia-miasm-1d9924a4f753d335ed12a0dc9e6b816414338e18.zip
Introduce Container.symbol_pool, containing container symbols (if any)
Diffstat (limited to 'example/disasm/full.py')
-rw-r--r--example/disasm/full.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/example/disasm/full.py b/example/disasm/full.py
index ee0b88dd..7ff60d3b 100644
--- a/example/disasm/full.py
+++ b/example/disasm/full.py
@@ -78,7 +78,7 @@ mn, dis_engine = machine.mn, machine.dis_engine
 ira, ir = machine.ira, machine.ir
 log.info('ok')
 
-mdis = dis_engine(bs)
+mdis = dis_engine(bs, symbol_pool=cont.symbol_pool)
 # configure disasm engine
 mdis.dontdis_retcall = args.dontdis_retcall
 mdis.blocs_wd = args.blockwatchdog
@@ -86,7 +86,13 @@ mdis.dont_dis_nulstart_bloc = not args.dis_nulstart_block
 mdis.follow_call = args.followcall
 
 todo = []
-addrs = [int(a, 0) for a in args.address]
+addrs = []
+for addr in args.address:
+    try:
+        addrs.append(int(addr, 0))
+    except ValueError:
+        # Second chance, try with symbol
+        addrs.append(mdis.symbol_pool.getby_name(addr).offset)
 
 if len(addrs) == 0 and default_addr is not None:
     addrs.append(default_addr)