docs: fix stale error-trace output format + markers
The trace docs predated the current formatter. Corrected against the real
output (library/modules/trace.sx to_string + examples/expected/1025-errors-
trace-format.stderr):
- error-handling.md: replace the obsolete trace example ("error trace:" /
"raised error.X" / "at func (file:line)") with the real format —
"error return trace (most recent call last):" + per-frame "func at
file:line:col" + source line + caret.
- debugger.md: drop the stale "(planned)" marker on the trace formatter
(it is implemented); the tag-name table note now cites the failable-main
reporter's "unhandled error reached main: error.X" line, not a
nonexistent "raised error.X" trace line.
This commit is contained in:
@@ -280,7 +280,7 @@ traces and DWARF can never disagree:
|
||||
which file a function's spans index.
|
||||
- ✅ `errors.SourceLoc.compute(source, span.start)` turns an offset into
|
||||
`{line, col}`. Used by the diagnostics renderer, `#caller_location`,
|
||||
the DWARF emitter, and (planned) the trace formatter — one function,
|
||||
the DWARF emitter, and the trace formatter — one function,
|
||||
every consumer.
|
||||
|
||||
### Trace path: compile → run → format
|
||||
@@ -397,7 +397,7 @@ symbolization is delegated to the platform debugger — sx ships none.
|
||||
|
||||
| Artifact | Lookup | Size | Shipped in release? |
|
||||
|---|---|---|---|
|
||||
| **Tag-name table** | tag id → name string | tiny (per distinct tag) | **yes, always** — `{}` interpolation, the `main` wrapper, and the trace's "raised error.X" line need names even in release |
|
||||
| **Tag-name table** | tag id → name string | tiny (per distinct tag) | **yes, always** — `{}` interpolation and the failable-`main` reporter's `error: unhandled error reached main: error.X` line need names even in release |
|
||||
| **`Frame` location table** | push site → `{file,line,col,func}` | small (interned strings; per push site) | **debug / `--release-traces` only** — rides the trace-mode gate |
|
||||
| **DWARF (`.debug_line` / `DISubprogram`)** | PC → file:line:col, for *debuggers* | larger (per source position) | **debug / `--release-traces` only**, strippable; consumed by `lldb`/`gdb`, never by the trace formatter |
|
||||
|
||||
|
||||
@@ -317,11 +317,16 @@ v := parse(s) catch e {
|
||||
```
|
||||
|
||||
```
|
||||
error trace:
|
||||
raised error.BadDigit
|
||||
at parse_digit (parse.sx:12:5)
|
||||
at parse_int (parse.sx:34:13)
|
||||
at handle_line (main.sx:21:8)
|
||||
error return trace (most recent call last):
|
||||
parse_digit at parse.sx:12:5
|
||||
c := s[i] or raise error.BadDigit;
|
||||
^
|
||||
parse_int at parse.sx:34:13
|
||||
try parse_digit(s);
|
||||
^
|
||||
handle_line at main.sx:21:8
|
||||
try parse_int(line);
|
||||
^
|
||||
```
|
||||
|
||||
Traces are on by default in debug builds and compiled out in release
|
||||
|
||||
Reference in New Issue
Block a user