ERR/E3.0 (slice 3a): embedded Frame trace resolution

Return-trace frames now resolve to real `func at file:line:col`
in-process — no DWARF, no symbolizer.

- New niladic, span-stamped `.trace_frame` IR op (mirrors is_comptime):
  carries no operands; each backend derives the frame from context.
  lower.zig's placeholderTraceFrame emits it; the existing
  sx_trace_push call consumes it.
- emit_llvm: resolve the op's span + current function to
  {file(basename), line, col, func}, build an interned Frame global
  ({string,i32,i32,string}, strings cached by content), push its
  address (ptrtoint).
- interp: pack (func_id << 32 | span.start) for the comptime resolver
  (slice 3b); never a pointer.
- sx_trace.c report_unhandled derefs SxFrame; trace.sx gains the Frame
  struct, frame_at -> *Frame, and field-reading to_string. Layout
  mirrored in 3 places with cross-ref comments.

Verified JIT + AOT. Snapshots 243/244/247 regenerated (placeholder ->
func at file:line:col). Gates: zig build, zig build test,
run_examples.sh -> 290 passed.
This commit is contained in:
agra
2026-06-01 15:10:46 +03:00
parent 8b8ba3a1bf
commit 1b6cbc17e7
10 changed files with 150 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
[stdout] caught BadInput
error return trace (most recent call last):
frame 0: <location pending DWARF> (raw 1)
frame 1: <location pending DWARF> (raw 1)
leaf at 243-trace-format.sx:20:16
mid at 243-trace-format.sx:25:5
[stdout] recovered; trace buffer now empty (len 0)

View File

@@ -1,5 +1,5 @@
v = 10
error: unhandled error reached main: error.Empty
error return trace (most recent call last):
frame 0: <location pending DWARF> (raw 1)
frame 1: <location pending DWARF> (raw 1)
inner at 244-failable-main.sx:18:17
main at 244-failable-main.sx:26:10

View File

@@ -1,8 +1,8 @@
error: unhandled error reached main: error.A
error return trace (most recent call last):
frame 0: <location pending DWARF> (raw 1)
frame 1: <location pending DWARF> (raw 1)
frame 2: <location pending DWARF> (raw 1)
frame 3: <location pending DWARF> (raw 1)
frame 4: <location pending DWARF> (raw 1)
frame 5: <location pending DWARF> (raw 1)
fa at 247-failable-or-chain-propagate.sx:14:17
main at 247-failable-or-chain-propagate.sx:19:10
fa at 247-failable-or-chain-propagate.sx:14:17
main at 247-failable-or-chain-propagate.sx:19:10
fa at 247-failable-or-chain-propagate.sx:14:17
main at 247-failable-or-chain-propagate.sx:19:10