about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/analysis/depgraph.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index 06b5b8b6..72d0176b 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -508,11 +508,15 @@ class DependencyGraph(object):
 
             # No more dependencies
             if len(depdict.pending) == 0:
-                yield depdict
+                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):