about summary refs log tree commit diff stats
path: root/example/disas_and_graph.py
diff options
context:
space:
mode:
Diffstat (limited to 'example/disas_and_graph.py')
-rwxr-xr-xexample/disas_and_graph.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/example/disas_and_graph.py b/example/disas_and_graph.py
index 71f943ec..124b8f4a 100755
--- a/example/disas_and_graph.py
+++ b/example/disas_and_graph.py
@@ -162,19 +162,21 @@ for (n,f), ads in dll_dyn_funcs.items():
 
 
 def my_disasm_callback(ad):
-    admode = opmode = u32
-    kargs = {}
-    if options.machine_options:
-        if options.machine_options in ['u16', 'u32']:
-            admode = opmode = options.machine_options
-            kargs = {"admode":admode, "opmode":admode}
-        else:
-            raise ValueError('bad machine options')
+    attrib = {}
+    if mnemo == ia32_arch.x86_mn:
+        if options.machine_options:
+            if options.machine_options in ['u16', 'u32']:
+                admode = opmode = u32
+                admode = opmode = options.machine_options
+                attrib = {"admode":admode, "opmode":admode}
+            else:
+                raise ValueError('bad machine options')
+
     all_bloc = asmbloc.dis_bloc_all(mnemo, in_str, ad, set(),
                                     symbol_pool=symbol_pool,
                                     dontdis_retcall = options.dontdiscallret,
                                     follow_call = options.followcall,
-                                    **kargs)
+                                    attrib = attrib)
     g = asmbloc.bloc2graph(all_bloc)
     open('graph.txt', 'w').write(g)
     if mnemo == ia32_arch.x86_mn: