about summary refs log tree commit diff stats
path: root/miasm2/core/asmbloc.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-07 11:15:28 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-07 11:15:51 +0100
commit9dc842eb04d675ba5c8ca88a421ea2e4d5be8da0 (patch)
tree582d7df358659c96bffd15b9a4d2ae8f69d91612 /miasm2/core/asmbloc.py
parent05cf38cb26f88daa7ceede90e7766d680e13e425 (diff)
downloadmiasm-9dc842eb04d675ba5c8ca88a421ea2e4d5be8da0.tar.gz
miasm-9dc842eb04d675ba5c8ca88a421ea2e4d5be8da0.zip
Asmbloc: Fix AsmCfg str
Diffstat (limited to 'miasm2/core/asmbloc.py')
-rw-r--r--miasm2/core/asmbloc.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/miasm2/core/asmbloc.py b/miasm2/core/asmbloc.py
index b68b1f1c..ef068a3f 100644
--- a/miasm2/core/asmbloc.py
+++ b/miasm2/core/asmbloc.py
@@ -796,6 +796,16 @@ class AsmCFG(DiGraph):
         if rebuild_needed:
             self.rebuild_edges()
 
+    def __str__(self):
+        out = []
+        for node in self.nodes():
+            out.append(str(node))
+        for nodeA, nodeB in self.edges():
+            out.append("%s -> %s" % (nodeA.label, nodeB.label))
+        return '\n'.join(out)
+
+    def __repr__(self):
+        return "<%s %s>" % (self.__class__.__name__, hex(id(self)))
 
 # Out of _merge_blocks to be computed only once
 _acceptable_block = lambda block: (not isinstance(block, asm_block_bad) and