A symbol table says which memory, and where the name was written
The dump was an address and a name. Both of the questions it gets asked were only half answered. "What is at this address" was ambiguous, because Program and Data are separate memories and an address alone does not say which one. That is easy to miss in a loadable program, where the segments are usually based far apart - and immediate in a boot image, where both start at zero: replCalculator has a Program 0003 and a Data 0003 and the old file printed both as "0003 <name>". "Where is this defined" was not answered at all, and it is the one that matters more as a program grows. A name defined once and called in forty places is hard to find by searching. Lander's table names five files besides its own; CosmOS and its libraries define over a thousand names across a dozen. So: memory, address, name, file, line, separated by tabs, sorted by memory and then address with Program first. Tabs because that makes it a table cut, awk and sort already read, and no heading line because nothing should have to know to skip one. Everything needed was already being passed to addLabel and thrown away; the file name points at the copy the include list owns, which outlives the label table. The manual describes the five fields, and docs.sh now settles that description against a real dump - the shape, not the values, so that an example cannot go stale and turn editing a program into editing a manual. Verified with break.sh three ways: a reordered field, a dropped field, and a field renamed in the manual. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
7a55cfe151
commit
3527812c41
@@ -27,6 +27,15 @@ typedef struct {
|
||||
char* label;
|
||||
uint16_t address;
|
||||
int type;
|
||||
// Where the name was written. Only the symbol file reads these, and it is the source
|
||||
// of the whole feature: an address tells you a routine exists and a file and line tell
|
||||
// you where to go and read it.
|
||||
//
|
||||
// NEITHER IS OWNED HERE. fileName points at the copy the include list keeps, the same
|
||||
// storage every intermediateElement points at, and the include list outlives the label
|
||||
// table - assemblerCleanup frees the labels first. So freeLabelList must not free it.
|
||||
const char* fileName;
|
||||
int lineNumber;
|
||||
} Label;
|
||||
|
||||
// Every label and the address it was given, in address order, so that a tally of
|
||||
|
||||
Reference in New Issue
Block a user