Files
LithosAnanke/v4/include/v4/dump.h
T
Claude 45b11aec25 feat(v4, ci): the fault dump on a node's stop, and the EMERGENCY diagnostic build after a failed stage
Captain Bob's CI directive (2026-11-17) and the design he ruled point by point
(docs/v4.0.0/plans/2026-11-17-emergency-diagnostic-build.md).

- v4/system/dump.c, v4/include/v4/dump.h: what a node was doing when it stopped -- the fault's kind,
  address and count; P A B; the data stack, T first; the return stack, R first, each entry named by
  the word it falls in (the backtrace; ROM and below-every-word said so); the running line. Bounded
  dictionary walk; no C library. Ruled: every build, on a stop only (a handled fault keeps its line).
- kernel/src/v4/sk_v4.c: the dump before each of the three halts (not started; POST's blocks not
  let go; a node stopped on a fault) -- Hera and any stopped node. kernel/Makefile links dump.o.
- scripts/nightly.sh diagnose [<stage>]: after a failed stage, that configuration built again with
  EMERGENCY_CONSOLE_ENABLED=1 -- build only, nothing booted (ruled) -- its artifacts kept in
  logs/<TS>/diagnose/ only from a build that passed, with a README saying how to launch it with
  --log-level=debug. Always exits 0: evidence, never a result. The protocol runs it after a failed
  stage and still exits with that stage's code; acceptance.yml, nightly.yml and release.yml run it
  `if: failure()`, before the logs are kept. Any failed stage triggers it (ruled).
- capsules/BLOCK_MAP.md: as the build writes it -- the v4:physics.4th row, missing since 28ffed8f
  (ruled: commit the regenerated map).
- Test first: test_dump.c failed with no dump.c (logs/20261117-dump), then 15 checks at both widths
  and under ASan+UBSan. The diagnose stage: a real EMERGENCY amd64 build; a failing build exits 0 and
  keeps no artifacts (a defect found and fixed this way); the protocol path keeps the stage's exit.
- Also the write-up of the regression at 046ce0be, for ruling.

Not yet: acceptance on a clean tree (the next run); the kernel's stop wiring is compile-tested only
-- no boot reaches a stop on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-17 19:14:40 +00:00

33 lines
1.5 KiB
C

/* SPDX-License-Identifier: LicenseRef-Starship-1.0
* Copyright (c) 2023-2026 Robert A. James
*/
/* dump.h -- what a node was doing when it stopped (docs/v4.0.0/plans/2026-11-17-emergency-diagnostic-build.md;
* ruled by Captain Bob, 2026-11-17: in every build, on a stop only -- a fault the node's own handler takes
* keeps its one-line message).
*
* The dump says:
* - the latest fault's kind, its address for an address fault, how many there have been, and whether
* the node is stopped;
* - P, A and B;
* - the data stack, T first, every value it holds;
* - the return stack, R first, each entry named by the dictionary word whose code it falls in: the
* node's backtrace (an address in the ROM says so, and one below every word says so);
* - the line that was running, if one was.
*
* A word is found by walking the dictionary from LATEST (dict.f18: the link at xt-1, the name's word
* address at xt-2, its count byte first); the walk is bounded, so a damaged dictionary cannot hold the
* dump. An address is named by the newest word whose xt is at or below it: code with no header of its
* own that follows a word is named by that word. Nothing here uses the C library. */
#ifndef V4_DUMP_H
#define V4_DUMP_H
#include "v4/node.h"
#include "v4/image.h"
typedef void (*v4_dump_out)(void *self, const char *s, unsigned n);
void v4_dump_node(const v4_node *n, const v4_image *im, const char *line, unsigned len,
v4_dump_out out, void *self);
#endif /* V4_DUMP_H */