pcode-graph 3.0.1__tar.gz → 3.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/CHANGELOG +4 -0
  2. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/PKG-INFO +1 -1
  3. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/simplifier.py +20 -21
  4. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/.github/workflows/release.yml +0 -0
  5. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/.github/workflows/test.yml +0 -0
  6. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/.gitignore +0 -0
  7. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/LICENSE +0 -0
  8. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/README.md +0 -0
  9. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/__init__.py +0 -0
  10. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/__main__.py +0 -0
  11. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/analysis.py +0 -0
  12. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/arch.py +0 -0
  13. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/asm.py +0 -0
  14. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/basic_blocks.py +0 -0
  15. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/bit_utils.py +0 -0
  16. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/characterization.py +0 -0
  17. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/checker.py +0 -0
  18. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/cli.py +0 -0
  19. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/emulator.py +0 -0
  20. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/gnn_exporter.py +0 -0
  21. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/graph.py +0 -0
  22. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/lief_importer.py +0 -0
  23. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/log.py +0 -0
  24. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/maker.py +0 -0
  25. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/memory.py +0 -0
  26. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/nx_exporter.py +0 -0
  27. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/pcode.py +0 -0
  28. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/registers.py +0 -0
  29. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/torch_utils.py +0 -0
  30. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/translator.py +0 -0
  31. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/view.py +0 -0
  32. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pcode_graph/visitor.py +0 -0
  33. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/pyproject.toml +0 -0
  34. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/requirements.txt +0 -0
  35. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/__init__.py +0 -0
  36. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/analysis_test.py +0 -0
  37. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/basic_block_test.py +0 -0
  38. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/callother_test.py +0 -0
  39. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/charac_test.py +0 -0
  40. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/cli_test.py +0 -0
  41. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/conftest.py +0 -0
  42. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/emulator_test.py +0 -0
  43. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/exporter_test.py +0 -0
  44. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/fixtures.py +0 -0
  45. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/helpers.py +0 -0
  46. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/lief_importer_test.py +0 -0
  47. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/maker_test.py +0 -0
  48. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/memory_test.py +0 -0
  49. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/translator_test.py +0 -0
  50. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/tests/utils_test.py +0 -0
  51. {pcode_graph-3.0.1 → pcode_graph-3.0.2}/todo.md +0 -0
@@ -1,3 +1,7 @@
1
+ # 3.0.2
2
+
3
+ - Improve simplifier complexity (for graph with many edges.)
4
+
1
5
  # 3.0.1
2
6
 
3
7
  - Fix bug in lief_exporter.iter_functions for non relocatable files.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pcode_graph
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Build, display and vectorize semantic graphs from binary code
5
5
  Project-URL: Homepage, https://github.com/quarkslab/pcode_graph
6
6
  Project-URL: Issues, https://github.com/quarkslab/pcode_graph/issues
@@ -13,6 +13,9 @@ from pathlib import Path
13
13
 
14
14
 
15
15
  class GraphSimplifier:
16
+ """This simplifier is built to work with flat CFG, Basic Block nodes
17
+ and Membership edges are not taken into account.
18
+ """
16
19
 
17
20
  def __init__(
18
21
  self,
@@ -64,27 +67,23 @@ class GraphSimplifier:
64
67
  self.graph.nodes[index].kind == NodeKinds.Phi and len(set(data_preds)) == 1
65
68
  ), "More than one data predecessor to the node to remove"
66
69
 
67
- for i, e in enumerate(self.graph.edges):
68
- if e is None:
69
- continue
70
- remove = False
71
- if e.source_node == index:
72
- if e.kind == EdgeKinds.Data:
73
- self._proxy[e.source_node].out_edge_indexes.remove(i)
74
- e.source_node = data_preds[0]
75
- self._proxy[e.source_node].out_edge_indexes.append(i)
76
- else:
77
- remove = True
78
-
79
- if e.destination_node == index:
80
- if e.kind == EdgeKinds.Control:
81
- self._proxy[e.destination_node].in_edge_indexes.remove(i)
82
- e.destination_node = control_succs[0]
83
- self._proxy[e.destination_node].in_edge_indexes.append(i)
84
- else:
85
- remove = True
86
-
87
- if remove:
70
+
71
+ for i in list(proxy.out_edge_indexes):
72
+ e = self.graph.edges[i]
73
+ if e.kind == EdgeKinds.Data:
74
+ self._proxy[e.source_node].out_edge_indexes.remove(i)
75
+ e.source_node = data_preds[0]
76
+ self._proxy[e.source_node].out_edge_indexes.append(i)
77
+ else:
78
+ self._remove_edge(i)
79
+
80
+ for i in list(proxy.in_edge_indexes):
81
+ e = self.graph.edges[i]
82
+ if e.kind == EdgeKinds.Control:
83
+ self._proxy[e.destination_node].in_edge_indexes.remove(i)
84
+ e.destination_node = control_succs[0]
85
+ self._proxy[e.destination_node].in_edge_indexes.append(i)
86
+ else:
88
87
  self._remove_edge(i)
89
88
 
90
89
  # Patch the graph
File without changes
File without changes
File without changes
File without changes
File without changes