/* 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 */