Skip to content

DX: debuggable binaries — DWARF line info via LLVM DIBuilder, PHP-level stack traces with file:line on uncaught exceptions, phpc build --debug, --asan, and a phpc profile that maps perf samples back to PHP functions (lib/JIT/AotDebugSymbols.php, lib/JIT/Context.php, lib/AOT/Linker.php) #36394

Description

@PurHur

Category

Tooling: · developer experience when something goes wrong · child of #36379

Why

When an AOT binary misbehaves today the user gets phpc: fatal signal (segfault) after c:main_before_php or a 672 KB IR dump. There is no line info in the binary (AotDebugSymbols.php exists but emits no DWARF), uncaught exceptions print no PHP trace with file:line under AOT, and profiling shows PHPCompiler_ext_standard_… symbols with no mapping to user code. Every wave-1 diagnosis needed objdump and /proc — that is not a workflow users will follow.

Deliverable

  • --debug: emit DICompileUnit/DISubprogram/DILocation for user functions and statements via the bound LLVMDIBuilder* API (in ffi/llvm9.php), keep symbols, no -s; gdb/perf show file.php:line.
  • Uncaught exception / fatal under AOT prints the Zend-shaped trace (#0 file(line): fn()), including for exceptions crossing helper units; debug_backtrace() returns file/line/function.
  • --asan: link with -fsanitize=address runtime and the runtime's own allocations instrumented (poison on free); used by Stdlib: count, array_key_exists, is_object and VM fixes #19's CI job.
  • phpc profile <binary> [args]: runs under perf record, resolves symbols through a generated symbol → PHP function map, prints a flat + callgraph report; documented in docs/performance.md.
  • Crash handler: on SIGSEGV/SIGABRT print the PHP-level trace of the current frame stack (frame pointers are kept in debug builds) before exiting 139.

Done when

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    IMPORTANTCritical patharea:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions