Files
sp00nz 626ee68ad6 Add tools.debug_symbols: recover source-file names from debug builds
Debug builds keep their assert macros, so __FILE__ survives as a string
literal referenced from the function containing the assert. Cross-referencing
those strings against functions.json recovers which original source file each
function was compiled from - no PDB, no disassembler, no external database.

Two passes: direct string references, then an interpolation fill across runs
of unattributed functions bracketed by two functions agreeing on the same
file (the linker emits each object file's functions contiguously). The fill
never crosses a section boundary, since adjacency means nothing between
separate link units.

On Halo build 2276 cachebeta.xbe this attributes 4331/8702 functions (49.8%)
across 295 Bungie source files: 60% of .text, and 0% of the D3D/DSOUND/XNET/
BINK library sections - which is the correctness check, as those are
Microsoft/RAD code with no c:\halo\SOURCE asserts to match.

Names merge into functions.json only where a function is still called
sub_XXXXXXXX, so ghidra_naming/func_id results are never clobbered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 23:42:17 -07:00

8 lines
425 B
Python

# Xbox Static Recompilation Toolchain
# Usage: py -3 -m tools.<module> <args>
# tools.xbe_parser - Parse XBE header and sections
# tools.disasm - Disassemble and detect functions
# tools.func_id - Identify library functions (CRT, RenderWare, etc.)
# tools.debug_symbols - Recover source-file names from a debug build's __FILE__ strings
# tools.recomp - Translate x86 to C (static recompiler)