Commit graph

21 commits

Author SHA1 Message Date
Fish
3333f39fff
CFGFast: Make the smart scan nodecode ratio O(log n) (#6767) 2026-08-05 01:42:45 -07:00
pre-commit-ci[bot]
d38cc5a019
[pre-commit.ci] pre-commit autoupdate (#6721)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.22...v0.16.0)

* Apply fixes

* Add values()

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kevin Phoenix <kevin@kphoenix.us>
2026-07-29 13:46:11 -07:00
Fish
bc72b9e1a6
MCP: Protect stdio from forked workers. (#6717)
Some checks failed
CI / Rust Check (push) Failing after 6s
CI / rust_test (ubuntu-latest) (push) Failing after 9s
Test with coverage / Build (push) Failing after 8s
Test with coverage / Test (push) Has been skipped
Test with coverage / Test-1 (push) Has been skipped
Test with coverage / Test-2 (push) Has been skipped
Test with coverage / Test-3 (push) Has been skipped
Test with coverage / Test-4 (push) Has been skipped
Test with coverage / Test-5 (push) Has been skipped
Test with coverage / Test-6 (push) Has been skipped
Test with coverage / Test-7 (push) Has been skipped
Test with coverage / Test-8 (push) Has been skipped
Test with coverage / Test-9 (push) Has been skipped
Test with coverage / Test Rust packages (push) Failing after 6s
Test with coverage / Report (push) Has been skipped
CI / ci (push) Has been cancelled
CI / Test installation (macos-26, py3.12) (push) Has been cancelled
CI / Test installation (ubuntu-24.04, py3.14) (push) Has been cancelled
CI / Test installation (windows-2025, py3.12) (push) Has been cancelled
CI / rust_test (macos-latest) (push) Has been cancelled
CI / rust_test (windows-latest) (push) Has been cancelled
2026-07-27 03:01:56 -07:00
volodya
95fa7ea003
utils/graph: answer subgraph_between_nodes reachability in one pass (#6662)
subgraph_between_nodes() copied the whole graph and then ran a fresh
networkx.has_path() search for every (candidate successor, frontier node)
pair, so its worst case was O(candidate_edges * frontier_nodes * (V + E)).
Negative queries are the expensive ones: a successor that cannot reach any
frontier node forces a full traversal of everything reachable from it, once
per frontier node.

RegionIdentifier._find_initial_loop_nodes() calls this for every loop it
recovers, so a loop head whose successors lead into a large region that only
returns to the head (which the function's own "remove all incoming edges of
the source" step makes unable to reach any latch) makes loop recovery
quadratic. On a 1.1k-node AArch64 CFG built to have that shape, decompilation
spends 40.5s of 52.5s inside 608,847 has_path() calls.

Replace the repeated searches with a single reverse multi-source BFS from the
frontier that stops at the source; membership in the resulting set answers
every reachability question the forward walk asks. Stopping the reverse walk
at the source is exactly equivalent to deleting all incoming edges of the
source, so the graph copy is no longer needed either. Also peel dead leaves
with a degree worklist instead of rescanning all nodes after each removal.

Results are unchanged, including node/edge insertion order and edge
attributes: 6,000 randomized fixed-seed comparisons (3,000 graphs x both
include_frontier modes) against the previous implementation are identical, as
is the decompiler output on the CFG above (52.5s -> 12.5s end to end, 0
has_path() calls).

One behaviour change is deliberate: frontier is now turned into a set before
the "source not in graph or any(node not in graph for node in frontier)"
check rather than after it. In the old order an iterator argument was consumed
by that check, so the subsequent set(frontier) was empty and the function
silently sliced with no frontier at all. Every in-tree caller passes a list or
a set, so no in-tree behaviour changes.
2026-07-22 01:41:36 -07:00
Fish
55f5a6a87b
should_use_hex: Remove value saturation rule. (#6593)
* should_use_hex: Remove value saturation rule.

* Fix test cases. Introduce two new rules.
2026-07-08 17:34:26 -07:00
Fish
e2b9d771dd
Decompiler: Unify hex-display rules. (#6547)
* Decompiler: Unify hex-display rules.

* Lint code.

* Update a test case.
2026-06-29 16:55:24 -07:00
Kevin Phoenix
f939c5b88c
Enable ruff isort rule (#6452)
* 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>
2026-06-02 14:48:07 -07:00
Fish
d75c8ecd3c
inst_addrs: Use InsAddrList instead of lists of ints. (#6247)
* inst_addrs: Use InsAddrList instead of lists of ints.

* Add test cases.

* Implement InsAddrList.extend().

* Type check.
2026-03-17 17:55:08 -07:00
Fish
5ee75140ff
Dev: Switch from black to ruff format. (#6097)
* Dev: Switch from black to ruff format.

* Reformat all the files.
2026-02-05 14:29:21 -07:00
Kevin Phoenix
e734c870af
Move balancer to angr (#5974)
* Move balancer to angr

* Add tests and upstream fixes

* Improve lint and type annotations

* Fix all the type errors

* Remove unused import
2026-01-05 12:29:55 -07:00
Fish
a6ebd3c70b
Support normalizing more demangled C++ function names. (#5650) 2025-09-09 11:48:24 -07:00
Fish
46a72dfeb6
CFGFast: Reduce segment list fragmentation for ARMCortexM binaries. (#5588)
- Scan for long repeating byte patterns and mark them as no-decode.
- Reuse the previous segment's segment sort when finding aligned
addresses.
- Mark nodecode when an address cannot be lifted as ARM or THUMB code.
2025-07-07 10:01:03 +08:00
Matt Borgerson
cf09166e72 utils: Add a test for get_cpp_function_name 2025-06-19 19:10:22 -07:00
Matt Borgerson
2b88867a23 AIL: Update ailment imports 2025-05-28 16:00:13 -07:00
Kevin Phoenix
356987c0f9
Add Rust SegmnentList implementation (#5434)
* Add experimental Rust SegmnentList implementation

* Add rust to RTD environment

* Fix cargo check

* Add update method to avoid ._list

* Change rust version to latest

* Fix some inconsistencies with original implementation

* Fix iterator

* Fix lint issues

* Disable setuptools_rust check in setup.py

* Fix import

* Use asdf to install rust

* Specify latest version

* Also set the rust version globally

* Revert "Disable setuptools_rust check in setup.py"

This reverts commit 0fd2a4b61c.

* Add a note about rust in the docs
2025-05-12 20:48:17 -07:00
Kevin Phoenix
405316e6db
Refactor SegmentList tests into own file (#5421)
* Refactor SegmentList tests into own file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint

* [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>
2025-04-21 13:35:59 -07:00
Matt Borgerson
3f0d72c199 GraphUtils: Test quasi-topological-sort panic mode with different node types 2025-04-09 00:42:05 -07:00
Fish
3368dbe1b9
RegionIdentifier: Update dominators after creating regions. (#5192)
* RegionIdentifier: Update dominators after creating regions.

* Generate dominance frontiers for nodes on-demand.

* Update test cases.
2025-02-17 22:30:48 -07:00
Kevin Phoenix
ee464d0338
Adopt from __future__ import annotations (#4790) 2024-08-28 18:31:43 -07:00
Matt Borgerson
0afa863262 utils: Add bits.py for helpful bit manipulation functions 2024-08-28 00:39:47 -07:00
W4terf1re
17d5607d47
Fix bug for DFS when getting dominators (#4414)
* Update graph.py

fix bug for DFS

* add testcase for Dominators

* Update test_graph.py
2024-01-30 03:37:58 -07:00