* Decompiler: Fix re-rendering of decompilation caches reloaded from angrdb.
Re-rendering a deserialized codegen (as angr-management does on display/edit)
dropped variable declarations and string constants and rendered slightly different
C, because several pieces of state were not restored:
- VariableManagerInternal never serialized variable_to_types / variables_with_
manual_types, so get_variable_type() returned None and all locals rendered as int.
- parse_codegen did not attach the project, and left display options that serialize
as None (e.g. max_str_len) unset. Attach project and initialize display options
from the codegen constructor defaults.
- CConstant string references lost MemoryData.content (not serialized); re-read it
from the loader at parse time so strings render as strings, not raw addresses.
- regenerate_text() now refreshes CFunction.unified_local_vars from the (restored or
updated) variable manager so declarations reflect current types.
- CBinaryOp._cstyle_null_cmp is rebuilt from the codegen flag in set_codegen,
restoring !x vs x == 0.
- Compound-assignment folding (x += 1) compared unified variables by identity; use
== so it works across deserialized variables that are equal but not the same
object.
Adds an end-to-end test (1after909::doit) asserting a reloaded cache re-renders
byte-identically.
* Lint code.
Also,
- Refactored variable_kb into kb.dec_variables.
- Spill decompilation cache into RuntimeDb.
- Save decompilation cache into angrDb. Decompilation results can be preserved across runs.
- No longer check in _pb2.py files; they are generated during build.
* Move serialized functions directly into LMDB on load.
* Serialize the callgraph instead of rebuilding it on load.
* Move serialized CFG nodes directly into LMDB on angrdb load.
* Copy clean spilled functions directly from LMDB on dump.
* Do not serialize empty variable managers.
* Serialize CFG edges at the key level to avoid node materialization.
* Bulk-insert function and variable rows via SQLAlchemy Core.
* Skip the CFGNode.function_address fill when node records carry it.
* struct-pack spilled edge data instead of protobuf.
* Avoid O(n^2) full-LRU-order copy in spilling eviction.
* Byte-copy clean spilled CFG nodes when serializing a CFG model.
* Lint code.
* Enable ruff isort rule
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Preliminary implementation of a spilling CFG graph.
* Fix some test cases.
* Fix another test case.
* Fixes.
* Lint code.
* Implement InEdgeView and OutEdgeView.
* Implement InDegreeView and OutDegreeView.
* Fixes.
* Use (Node.addr, Node.size) as key.
* Fix test cases.
* More fixes.
* Fix CFGENode support.
* Fix the remaining issues.
* Get rid of SpillingCFGGraph.reverse().
* Some refactoring.
* Oops
* Fix perf issue.
* Fix set size change error during key iteration.
* Fix db_batch_size assignment. Fix some test cases.
* SpillingCFGNodeDict.__setstate__: Initialize self._all_keys.
* Getting rid of the nodes dictionary.
* Fix logic in cfg_emulated.py
* Multiple fixes.
* Type annotation fix.
* Fix missing edges after merging CFGNodes.
* Fix more logic.
* Add Soot CFGNodes to the CFG model.
* Lint and type check.
* Add USE_SPILLING_CFGNODE_DICT and CFGNode.dirty.
* Oops
* Lint code.
* No more pickling of CFGNodes.
* Fix no_ret being None.
* Lint code.
* Some refactor; Destroy the fallback mechanism.
* Fix node dirty bug after deserialization.
* Fix some bugs in AngrDB
* Mark loaded functions as dirty so SpillingFunctionDict will save it to LMDB upon eviction
* Restore unresolvable target hooks
* AngrDB: Make sure self.project is not None in dump
* Refactor the code.
---------
Co-authored-by: Fish <fishw@asu.edu>
* Initial pass, loosely following angr package layout
* Many updates to use the 'common' module for binaries repo
* Some unused imports and log handlers are cleaned up