一句话:用重编译—验证—对齐的动态反馈闭环引导 LLM 修复反编译伪代码,使其可重编译并通过测试等价验证。
反编译是二进制分析的基础,但传统工具偏重可读性,忽视可编译性与经测试验证的运行时一致性;现有 LLM 精修方法多为静态处理、缺乏动态反馈,易产生语义幻觉,或试图修复整个二进制而难以扩展。PCodeTrans 提出动态反馈驱动的框架,构建重编译、验证与对齐的闭环:抽取最小且全局一致的上下文,借助原位可替换引擎把单独编译后的函数注入原始二进制,从而原生保留真实执行环境;以 trace 级对齐为诊断目标,通过断点匹配的差分追踪产生精确的运行时因果诊断,引导模型迭代修正行为差异。在涵盖 Coreutils、Binutils、PuTTY、SQLite3 的 Linux/Windows 基准上,未去符号二进制达到 100% 函数级编译成功与 99.5% 测试验证一致性,修复 85.6% 的逻辑错误;去符号可执行文件仍保持 97% 以上一致性,优于现有基线。
Decompilation remains foundational for binary analysis, yet conventional tools prioritize human readability over compilation success and test-validated runtime consistency. While recent large language model approaches attempt refining decompiled pseudocode, they often introduce semantic hallucinations. Operating statically without dynamic feedback or attempting whole binary repairs lacking scalability, these existing methods struggle to resolve genuine runtime divergences. We present PCodeTrans, a dynamic feedback driven framework that implements a loop of recompilation, validation, and alignment for the recovery of functional source code. Extracting a minimal yet globally consistent context, PCodeTrans employs an in situ substitutable engine. This mechanism injects isolated compiled functions directly into the original binary, natively preserving authentic execution environments. Utilizing trace-level alignment as a diagnostic objective, PCodeTrans leverages breakpoint matched differential tracing, generating precise runtime causal diagnostics that guide the model through iterative refinement resolving behavioral discrepancies. Evaluated across a comprehensive Linux and Windows Benchmark suite including Coreutils, Binutils, PuTTY, and SQLite3, PCodeTrans achieves substantial translation performance refining raw Hex-Rays outputs. Empirical results confirm PCodeTrans achieves 100% function-level compilation success and 99.5% test-validated consistency on unstripped binaries, resolving up to 85.6% of logic errors. Even for stripped executables, the framework maintains over 97% test-validated consistency, narrowing the gap between raw decompilation and functional source code. Surpassing existing baselines, PCodeTrans paves a practical path toward recovered source that can be recompiled, validated to pass test harnesses, and consumed by source-level security analysis and fuzzing tools.
@inproceedings{paperbot12204,
title = {PCodeTrans: Translate Decompiled Pseudocode to Trace-Level Equivalent Source Code},
author = {Yuxin Cui and Zeyu Gao and Siliang Qin and Yuanda Wang and Jiaming Wang and Xize Luo and Peng Zhou and Chao Zhang},
booktitle = {ASE},
year = {2026},
doi = {10.1145/3832783.3837432}
}