Closes out E3's stepping-verification ladder to the extent possible
headlessly.
- Verified `sx build --target ios-sim --emit-obj` produces an
arm64-ios-simulator Mach-O that runs under `simctl spawn` and steps
in lldb (the backtrace shows a dyld_sim frame — the sim runtime).
- Verified the device-applicable .dSYM path: dsymutil collects the
DWARF, and after removing the .o lldb still resolves source via the
.dSYM.
- debug_stepping_smoke.sh gains an optional iOS-sim rung that reuses an
already-booted simulator (never boots one — single-sim policy) and
exercises the .dSYM path; skips cleanly when no sim is booted.
- docs/debugger.md: rungs 1-2 marked verified; the iOS-device rung is
documented as a manual checklist (needs hardware + get-task-allow
signing) — no compiler gap, --emit-obj + standard Apple tools suffice.
E3 is functionally complete and verified across macOS + iOS-simulator.
`sx build --emit-obj` keeps the DWARF-bearing object so a debugger can
step the binary, completing the deep-debug half of the trace story.
- --emit-obj flag + TargetConfig.emit_obj. Implies -O0 (DWARF only
emits at opt none/less); keeps the object at its link-time path
.sx-tmp/main.o so the binary's debug map resolves to it; skips the
Level-1 binary cache; reports the object path. macOS resolves via the
debug map -> .o; Linux carries DWARF in the binary. Build-flow only,
no runtime/codegen change.
- tests/debug_stepping_smoke.sh (3e rung 1; macOS, lldb, not in
run_examples): builds with --emit-obj, drives an lldb file:line
breakpoint, asserts resolution + a source-mapped backtrace. Passing —
proves the slice 1-2 DWARF drives real source-level stepping.
(Also normalizes the 253 .exit trailing newline from the 3c --update.)
Gates: zig build, zig build test, run_examples.sh -> 291 passed.
Each trace frame now shows the offending source line with a `^` caret
under the column — in the catch-handler formatter, the failable-main C
reporter, and the comptime path.
The source line is embedded at compile time as a 5th Frame field
(line_text), not read from disk at runtime: the file field is a
basename and a runtime read would add a filesystem dependency that
fails under the test harness and on locked-down targets.
- errors.lineAt(src, offset): shared helper for the whole source line.
- Frame gains line_text (mirrored in emit_llvm getFrameStructType,
trace.sx Frame, sx_trace.c SxFrame). emitTraceFrame embeds it; the
interp .trace_resolve extracts it from the source map.
- trace.sx (new spaces helper) and the C reporter render the line +
a col-aligned caret, guarded on a non-empty line_text.
Snapshots 243/244/247/253 regenerated. Gates: zig build, zig build
test, run_examples.sh -> 291 passed.
#run failures now print the same `func at file:line:col` trace as
runtime, resolved in-process via the interpreter's IR/source tables.
- Read-side context-split op `.trace_resolve` (mirror of .trace_frame),
lowered from a name-recognized `__trace_resolve_frame(u64) -> Frame`.
- emit_llvm: inttoptr the operand to *Frame + load (the value
.trace_frame stamped in).
- interp: unpack (func_id << 32 | span.start); resolve func/file from
module.functions and line/col via SourceLoc.compute over a new
source_map (setSourceMap wired at every production interp site).
- trace.sx: frame_at -> u64; to_string routes each frame through
__trace_resolve_frame, so one source works in both machines.
Compiled path behavior unchanged (243/244/247 identical; it now loads
via the op). New examples/253-comptime-trace.sx exercises the comptime
path. Gates: zig build, zig build test, run_examples.sh -> 291 passed.
Architecture spec for the debugging subsystem: error return traces
(embedded Frame table, niladic context-split push op, the thread-local
ring buffer), DWARF debug info as a debugger-only artifact, the exact
wiring (file/function map + trace and DWARF data flows), the rationale
for choosing embedded locations over PC+DWARF symbolization, the
runtime-artifacts split, and the macOS -> iOS-sim -> iOS-device stepping
verification ladder.