Closed mitsuhiko closed 4 years ago
This is not yet complete, but will contain a full refactor of Symbols to fix https://github.com/willglynn/pdb/issues/14. Additionally, this helps to expose binary annotations more neatly.
Edit: Updated PR description.
@willglynn This is ready for review now. See https://github.com/willglynn/pdb/pull/47#issuecomment-517625235 for a summary of all changes.
When working on the next feature (Cross Module Imports/Exports), I realized that inlinees are probably better placed on the module info directly than the line program.
Refactors symbol parsing, introduces support for inlinees and parsing of their binary annotations into line records.
Breaking Changes:
Symbol::name
has been removed, since not all symbols have a name. Instead, every symbol with a name now exposes aname
field. To provide uniform access to the name,SymbolData::name
now exposes anOption<RawString>
after parsing. (NB: This felt more robust than maintaining a manual list of offsets)SymbolData::Public
andSymbolData::Data
have been stripped of their*Symbol
prefix, as this is redundant and inconsistent.SymbolData::CompileFlags
, have been fixed with stronger typing.TypeIndex
is now a newtype aroundu32
, and so isIdIndex
. This is in preparation of supporting the IPI stream. I'm yet undecided whether to expose the IPI in a separate type or via directlyTypeFinder
.Public Changes:
Symbol::starts_scope
andSymbol::ends_scope
now indicate which symbols can contain sub-symbols. This helps to deal with a hierarchy of symbols, such as building a tree.Symbol
now exposes anindex
. Also, some symbols may refer to others via that index (e.g. inline sites point to theirparent
and theirend
).SymbolTable
,ModuleInfo
andSymbolIter
now allow jumping to symbols by their index.SymbolData::InlineSite(InlineSiteSymbol)
. It exposes an iterator over its binary annotations, which can be used to evaluate the line program of the inline site.LineProgram::inlinees
allows iteration over inlinees in a module. Each inlinee has aninlinee_lines
function that returns an iterator over line records evaluated from the binary annotations in the inline site symbol.Internal Changes:
Pread
is now implemented for more types, including:Variant
,CPUType
,SourceLanguage
.ParseBuffer
can now parse any type that implementsTryFromCtx
, not just the ones that usescroll::Endian
as context. There's also a new methodparse_with
to pass a custom parse context.SectionOffset
types now implementAddAssign
which has the same semantics asAdd
.Fixes https://github.com/willglynn/pdb/issues/14