Skip to content

[AUTOMATED] [PROPOSAL] shared-project-export: export the same C from the browser as from decompile-project - #1960

Merged
mahaloz merged 2 commits into
Noelo-Lab:mainfrom
kanonl125:shared-project-export
Nov 25, 2026
Merged

mahaloz merged 2 commits into
Noelo-Lab:mainfrom
kanonl125:shared-project-export

Conversation

@kanonl125

Copy link
Copy Markdown
Contributor

decompile.run's "C code" download (kuna_wasm <binary> <specs> project) exports different C than kuna decompile-project does for the same binary:

cd decompiler && cargo build --release -p kuna-cli -p kuna-wasm && cd ..
F=decompiler/crates/kuna-analysis/tests/fixtures/fauxware
decompiler/target/release/kuna decompile-project $F -o /tmp/fx >/dev/null; grep -n 'accepted(void)' /tmp/fx/fauxware.h
#   84:int accepted(void);
decompiler/target/release/kuna_wasm $F specs project | jq -r '.files["fauxware.h"]' | grep -n 'accepted(void)'
#   84:void accepted(void);

On mcount_x86_64, 36,213 of the .c's 172,079 lines differ, and 3,210 of the .h's 3,638. The differences are record names (struct_16 against struct_31) and argument types (void *v1 against unsigned long v1). kuna_wasm's project copies the export but decompiles in address order. It cannot reach the callee-first order (protoorder) the CLI takes by default on a whole binary, which lives in kuna-cli with the call graph it walks.

This draft is docs only (docs/features/shared-project-export/):

  • Move callgraph and decompile_all/callee_first.rs into kuna-console, unchanged, with kuna-cli re-exporting them.
  • Add kuna_console::project::export: the decompile in the decided order, the sort, the prelude and types, and the four builders. decompile_project and kuna_wasm::project both call it. --jobs, --stream and the two loaders stay as they are.
  • A parity test: the native kuna_wasm project artifacts must equal decompile-project's on the export fixtures, except the README path row. It fails today.

The analysis lists what callee-first needs: eight CallGraph queries and six Args fields. It also asks where the call graph should live.

Model: anthropic/claude-opus-5-5

kanonl125 and others added 2 commits November 25, 2026 12:25
[AUTOMATED] Docs-only proposal (docs/features/shared-project-export/):
kuna_wasm's `project` re-implements the decompile-project export in
address order and differs from it on fauxware and mcount_x86_64. Move
the call graph and the callee-first decompile into kuna-console and
give both surfaces one export.
The CallGraph query and Args field lists named the wrong items: is_ok is
Result::is_ok, and recording/stated belong to the kuna_callerargs ledger.
List what callee_first actually reads, add custom_reg_callers, image.rs and
the result store's codec to what moves, and record that tempfile::tempfile()
panics on wasm32-wasip1. kuna_wasm does not accept --option. Name the diff
tool behind the line counts, add the .asm difference and the protoorder-off
identity, and the errortoomanyinstructions loader difference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
@mahaloz

mahaloz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Pushed 0d3444f, a docs-only correction to the bundle. The repro, the numbers and the cause all check out at a3351f8. kuna decompile-project --option protoorder off writes a .c, .h and .asm byte-identical to kuna_wasm ... project on fauxware and mcount_x86_64, and the README differs only in its Path row. The commit fixes these points:

  • The line counts come from Python's difflib.unified_diff(n=0). GNU diff -U0 counts 36,019 .c lines and 2,568 .h lines. The .asm also differs, by 2,009 lines.
  • is_ok is Result::is_ok, not a CallGraph query. recording and stated are fields of the kuna_callerargs ledger, not of Args. The callee-first path also needs custom_reg_callers.rs, image.rs and the result codec in jobs::wire.
  • ResultStore::new calls tempfile::tempfile(). On wasm32-wasip1 that call panics (no filesystem on wasm), so the browser has to keep results in memory.
  • kuna_wasm rejects --option (exit 64).
  • The CLI loader also sets errortoomanyinstructions off, and the browser loader does not. A function over 100,000 instructions is therefore a truncated body in the CLI export and an error: record in the browser's.

@mahaloz
mahaloz marked this pull request as ready for review November 25, 2026 11:48
@mahaloz
mahaloz merged commit af36b9e into Noelo-Lab:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants