$ show avast/retdec
RetDec is a retargetable machine-code decompiler based on LLVM, designed to convert binary executables (supporting ELF, PE, Mach-O, COFF, Intel HEX, and raw machine code) into high-level code (primarily C-like) and perform various analyses. The architecture is modular, consisting of stages: binary loading and format detection, conversion to LLVM IR, optimization and analysis on the IR, lifting to a high-level intermediate representation, and finally generation of readable code or other outputs (like JSON, debug information, etc.). Key entry points include the command-line tools `retdec-decompiler`, `retdec-fileinfo`, and `retdec-unpacker`, as well as a library interface for integration into other tools. The project demonstrates strong software engineering practices with a clear separation of concerns, extensive use of design patterns (such as visitor, factory, and smart pointers), and a focus on reusability. Notable reusable components include a thread-safe smart pointer implementation with weak pointer support and a comprehensive C type system that enables type-safe representation and manipulation of C language constructs. These components are sufficiently isolated to be extracted and used in other projects with minimal modification. Despite its strengths, the repository shows signs of technical drift due to delayed dependency updates and operates under a limited maintenance mode where issue responses may be delayed and only critical fixes are prioritized. However, the core functionality remains robust and well-tested, making it a reliable tool for reverse engineering tasks.
The LLM identified 2 files worth highlighting for reuse:
A thread-safe implementation of shared and weak pointers with enable_shared_from_this functionality. Requires only retdec::utils::counter and retdec::utils::non_copyable, making it easy to extract and use in projects needing lightweight smart pointers.
A comprehensive type system for representing C types (primitives, pointers, arrays, functions, aggregates, etc.) with support for type equality, hashing, and visitor-based traversal. Built on top of the custom smart pointer, it is isolated from LLVM and suitable for extraction in projects requiring C type modeling.