about summary refs log tree commit diff stats
path: root/miasm2/analysis/depgraph.py
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2015-02-24 09:19:38 +0100
committerCamille Mougey <camille.mougey@cea.fr>2015-02-24 12:46:29 +0100
commit3f0ffb84ccf7cb9d469281129e8c525295e39deb (patch)
tree2e8544881ac4123a09f68054bbc5d354ca6d378c /miasm2/analysis/depgraph.py
parent1ccaeeeab22a3b35d933ee8c752a4b98962b2b55 (diff)
downloadmiasm-3f0ffb84ccf7cb9d469281129e8c525295e39deb.tar.gz
miasm-3f0ffb84ccf7cb9d469281129e8c525295e39deb.zip
DepGraph: Normalize output by including heads from graph
Diffstat (limited to '')
-rw-r--r--miasm2/analysis/depgraph.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index 7c0fc2fc..72d0176b 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -511,8 +511,12 @@ class DependencyGraph(object):
                 yield depdict.copy()
                 continue
 
+            # Has a predecessor ?
+            is_final = True
+
             # Propagate the DependencyDict to all parents
             for label, irb_len in self._get_previousblocks(depdict.label):
+                is_final = False
 
                 ## Duplicate the DependencyDict
                 new_depdict = depdict.extend(label)
@@ -529,8 +533,9 @@ class DependencyGraph(object):
                 ## Manage the new element
                 todo.append(new_depdict)
 
-            # Return the node if it's a final one, ie. it's a head
-            if depdict.label in heads:
+            # Return the node if it's a final one, ie. it's a head (in graph
+            # or defined by caller)
+            if is_final or depdict.label in heads:
                 yield depdict.copy()
 
     def get(self, label, elements, line_nb, heads):