[comp.sys.mips] Mips symbol table questions

bothner@decwrl.dec.com (Per Bothner) (12/02/89)

I'm making quite good progess on porting gdb to the DECstation-3100
- I think it's gotten to the point where it can debug itself.
(Don't ask me for it; I'll make an announcement when it's available.)
But I have some questions on the symbol table format:

* /usr/include/sym.h lists the AUXU entries, and claims that
the width (for bitfields) comes after rndx. My experience is that
it's the other way round.

* How do I enter enum/struct/union tags and enum names into the symbol table?
All of the local symbols are nicely nested within stBlock/stEnd pairs,
but there is no way to tell what kind of thing an stBlock is.
I can tell by going via the type information in the AUX table,
but then I lose the block structure.

I guess I can defer what to do until there is a variable/field
whose type references the stBlock (thorugh an AUX entry),
and then patch the names into the file-global symbol table.
But I see two problems:

1) I lose the nesting information, which would occasionally lose.
2) I get no definition for non-referenced types.

The only solution I see requires two passes:
Read all the symbols to extract type information (patching the stBlock
symbol to point to (struct type) as we go).
Then re-read all of the symbols to get scopes right.
(Now the pointer to (struct type) that we patched into the stBlock
symbol tells us if the stBlock is an enum, struct or union.)

This solves the nesting problem, doesn't help with non-references types,
and is rather disgusting.

An alternative is that instead of the first pass of the SYM table
gdb does a pass of the AUX table. This would basically replace all the AUX
information by a table of (pointers to) gdb type records.
Is this a valid approach? Unfortunately, it doesn't seem as if
one can safely read the AUX table in sequence.

Any suggestions?

	--Per
-- 
	--Per Bothner
Western Software Lab, Digital Equipment, 181 Lytton Ave, Palo Alto CA 94301
bothner@wsl.dec.com ...!decwrl!bothner