pcode-graph 4.2.0__py3-none-any.whl → 4.2.1__py3-none-any.whl
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.
- pcode_graph/analysis/alias_analysis.py +26 -4
- {pcode_graph-4.2.0.dist-info → pcode_graph-4.2.1.dist-info}/METADATA +1 -1
- {pcode_graph-4.2.0.dist-info → pcode_graph-4.2.1.dist-info}/RECORD +6 -6
- {pcode_graph-4.2.0.dist-info → pcode_graph-4.2.1.dist-info}/WHEEL +0 -0
- {pcode_graph-4.2.0.dist-info → pcode_graph-4.2.1.dist-info}/entry_points.txt +0 -0
- {pcode_graph-4.2.0.dist-info → pcode_graph-4.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -148,6 +148,8 @@ class MemoryAnalyzer(PassBase):
|
|
|
148
148
|
|
|
149
149
|
self.stack_pointer = STACK_POINTERS.get(program.arch)
|
|
150
150
|
self._output_values: dict[OpIndex, AbstractValue] = {}
|
|
151
|
+
# Unevaluated definitions met by _evaluate_from
|
|
152
|
+
self._missing: list[OpIndex] | None = None
|
|
151
153
|
self._loads: dict[OpIndex, MemoryAccess] = {}
|
|
152
154
|
self._stores: dict[OpIndex, MemoryAccess | None] = {}
|
|
153
155
|
|
|
@@ -163,7 +165,6 @@ class MemoryAnalyzer(PassBase):
|
|
|
163
165
|
if not self.program.reachable(index):
|
|
164
166
|
continue
|
|
165
167
|
if op.output is not None:
|
|
166
|
-
# Evaluating in program order bounds the recursion depth
|
|
167
168
|
self._output_value(index, wrap(op.output))
|
|
168
169
|
if op.opcode == OpCode.LOAD:
|
|
169
170
|
access = self._compute_access(index, op.output.size)
|
|
@@ -198,10 +199,31 @@ class MemoryAnalyzer(PassBase):
|
|
|
198
199
|
if op.output is None or wrap(op.output) != var:
|
|
199
200
|
return None
|
|
200
201
|
if index not in self._output_values:
|
|
202
|
+
if op.opcode not in ADDRESS_OPCODES:
|
|
203
|
+
self._output_values[index] = None
|
|
204
|
+
elif self._missing is None:
|
|
205
|
+
self._evaluate_from(index)
|
|
206
|
+
else:
|
|
207
|
+
# Evaluated later by _evaluate_from
|
|
208
|
+
self._missing.append(index)
|
|
209
|
+
return self._output_values.get(index)
|
|
210
|
+
|
|
211
|
+
def _evaluate_from(self, root: OpIndex) -> None:
|
|
212
|
+
"""Evaluates the given operation after its dependencies, without recursion."""
|
|
213
|
+
|
|
214
|
+
pending = [root]
|
|
215
|
+
while pending:
|
|
216
|
+
index = pending[-1]
|
|
201
217
|
# Breaks cycles in loops
|
|
202
|
-
self._output_values
|
|
203
|
-
self.
|
|
204
|
-
|
|
218
|
+
self._output_values.setdefault(index, None)
|
|
219
|
+
self._missing = []
|
|
220
|
+
value = self._evaluate(index, self.program.operations[index])
|
|
221
|
+
if self._missing:
|
|
222
|
+
pending += self._missing
|
|
223
|
+
else:
|
|
224
|
+
self._output_values[index] = value
|
|
225
|
+
pending.pop()
|
|
226
|
+
self._missing = None
|
|
205
227
|
|
|
206
228
|
def _evaluate(self, index: OpIndex, op: PcodeOp) -> AbstractValue:
|
|
207
229
|
if op.opcode not in ADDRESS_OPCODES:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pcode_graph
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.1
|
|
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
|
|
@@ -21,7 +21,7 @@ pcode_graph/torch_utils.py,sha256=GwVjWKL5Lqhm94b69o-rCilzNRu237gyJo6T6xWQHQc,96
|
|
|
21
21
|
pcode_graph/translator.py,sha256=h90ay8VnCsgWRpK9fcYa0iu6CKXY0YDKl8CtH_gIx3U,7619
|
|
22
22
|
pcode_graph/view.py,sha256=Qj935NNo7n0-ecGMusEy_QLb6yx3pckLAbztji9Po2U,2452
|
|
23
23
|
pcode_graph/visitor.py,sha256=bxaQ9q0lTw8ysPOrta5G7LeHZYnq3IBxMafM_-8FruM,6990
|
|
24
|
-
pcode_graph/analysis/alias_analysis.py,sha256=
|
|
24
|
+
pcode_graph/analysis/alias_analysis.py,sha256=7GcN62AYvRN2nI1iUBoUeGQExSWPNnHEw4Kqhx0dVM4,12429
|
|
25
25
|
pcode_graph/analysis/cfg.py,sha256=PhMLzMcNhvNTNjO7MvhffKFUWzG_UFf8tO7r5hlQ_Zc,4484
|
|
26
26
|
pcode_graph/analysis/def_use.py,sha256=XkBZpb4aaO1gJMdQDbd-kjsR-MbcPUnYKChzbAX_YX4,4300
|
|
27
27
|
pcode_graph/analysis/interning.py,sha256=a6RcoeYH6JeoX-bAsebAjnFDzx8N5kTJPXsq8QLygAc,322
|
|
@@ -31,8 +31,8 @@ pcode_graph/analysis/pass_base.py,sha256=IeG5NiEz_Mez-ftjPA2GmC_oT7j7gPAQ6fRClGh
|
|
|
31
31
|
pcode_graph/analysis/passes.py,sha256=aRzbEqP5uoXZxPcwQppMOZQencOhI8A6xUbyEQoeEKQ,429
|
|
32
32
|
pcode_graph/analysis/program.py,sha256=VjSSgoASXma7Oj0nSXRGJdpnDmPmHKzMatBZC5HRD_M,10097
|
|
33
33
|
pcode_graph/analysis/unreachable.py,sha256=Poza5XjP5Nf9fAR_5srGLU2E0Jsl7pmk3m3QEYBgDgo,505
|
|
34
|
-
pcode_graph-4.2.
|
|
35
|
-
pcode_graph-4.2.
|
|
36
|
-
pcode_graph-4.2.
|
|
37
|
-
pcode_graph-4.2.
|
|
38
|
-
pcode_graph-4.2.
|
|
34
|
+
pcode_graph-4.2.1.dist-info/METADATA,sha256=HOz5Cpu8kZck45w9MWT7W3Up7dQPHz3mXvJKKEFtSYs,6675
|
|
35
|
+
pcode_graph-4.2.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
36
|
+
pcode_graph-4.2.1.dist-info/entry_points.txt,sha256=7pTTgqjYSRYwmBdA0GwJYXPfOmdk8I_mGsJOHHx-PXQ,45
|
|
37
|
+
pcode_graph-4.2.1.dist-info/licenses/LICENSE,sha256=iVkUrjpGBX_59jOK6a7mKkvjHUCGfiCFQRgrziEh-nY,1066
|
|
38
|
+
pcode_graph-4.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|