Build an isolated compiler binary with source locations:
.\build.ps1 -DebugThe results are build\debug\mlc_win64.exe and its matching
build\debug\mlc_win64.pdb. The script uses the sibling Python bootstrap
compiler for this mode, leaves the normal compiler binary alone, and
smoke-tests the staged result before publishing the executable and PDB.
The Windows debug build requires the Microsoft Visual C++ x64 linker
(link.exe) to generate the PDB.
On Linux:
./build.sh --debugThe result is build/debug/mlc_linux_x64. By default, both scripts use the
sibling MiniLangCompilerPy source tree as their bootstrap. An updated native
compiler can be selected explicitly with -Compiler or --compiler.
For native self-builds in debug mode, the scripts raise the compiler GC limit
to 3 GiB because the monolithic emitter retains more source-location records.
Both the Python compiler and the self-hosted ML compiler accept --debug-info
for an individual unpacked MiniLang program. On Windows, add --pdb to write
a matching PDB:
python ..\MiniLangCompilerPy\mlc_win64.py example.ml example.exe --debug-info --pdb
build\mlc_win64.exe example.ml example-native.exe --debug-info --pdbOn Linux:
build/mlc_linux_x64 example.ml example --target linux-x64 --debug-infoThe Linux image embeds DWARF; PDB output applies only to Windows PE files.
Debug metadata increases compile time, memory use and file size. It does not
insert runtime tracing, but the compiler disables selected inlining while
--debug-info is active so source locations remain useful. Hot code can
therefore run slower. A native debug self-build of the complete compiler can
take much longer than a normal build. Builds without the flag keep their usual
code generation.
The self-hosted compiler currently uses its monolithic pipeline for debug
output. Explicit --object-pipeline, packing, library output and incremental
cache reuse are unavailable with --debug-info. The ordinary build without
these flags remains the release build. To build the compiler's own debuggable
binary using an updated native compiler, pass it explicitly:
.\build.ps1 -Debug -Compiler .\build\mlc_win64.exeDebug builds carry DWARF function, source-line and stack-frame records inside the native image. GDB can load them on both Windows and Linux. For example:
gdb build/debug/mlc_win64.exe
(gdb) break mlc/compiler.ml:7000
(gdb) run example.ml example.exe -I .
(gdb) backtrace
(gdb) step
Use the source file from the exact compiler revision used to build the binary.
When cross-compiling Windows-to-Linux, tell GDB how to translate the embedded
Windows source root to the Linux mount point with set substitute-path.
The current debug format covers function names and source lines. It does not yet include MiniLang local-variable types or guaranteed stack unwinding for every generated frame. On Windows, the matching PDB also exposes function names and source lines to Visual Studio, WinDbg, and other DbgHelp clients. Keep the EXE and PDB from the same build together.