I'm looking at adding support for parsing more symbol records.
Currently, Symbol assumes that every symbol has a name, which is returned by Symbol::name. The name isn't stored in the symbol variants. Instead, it is found at a fixed offset given by Symbol::data_length().
This is fine for most symbols. However, some symbols consist of multiple records, and the additional records don't always have a name, such as the S_DEFRANGE records for local symbols, or S_BLOCK and S_END within local procedures.
The simplest fix is to change Symbol::name to return an Option. This still relies on the name being at a fixed offset in records, but so far that seems to be a valid assumption. However, I was wondering if it would be better to add the name to the Symbol variants, in the same manner as TypeData. This avoids callers needing to unwrap the Option for records that always have a name.
I'm looking at adding support for parsing more symbol records.
Currently,
Symbol
assumes that every symbol has a name, which is returned bySymbol::name
. The name isn't stored in the symbol variants. Instead, it is found at a fixed offset given bySymbol::data_length()
.This is fine for most symbols. However, some symbols consist of multiple records, and the additional records don't always have a name, such as the
S_DEFRANGE
records for local symbols, orS_BLOCK
andS_END
within local procedures.The simplest fix is to change
Symbol::name
to return anOption
. This still relies on the name being at a fixed offset in records, but so far that seems to be a valid assumption. However, I was wondering if it would be better to add the name to theSymbol
variants, in the same manner asTypeData
. This avoids callers needing to unwrap theOption
for records that always have a name.