summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-11-16 02:42:32 +0000
committerZachary Turner <zturner@google.com>2018-11-16 02:42:32 +0000
commit6284aee9f811d596b941e44b30dee5befbc22f20 (patch)
tree479104d0244245dadeb614f36a02ec44c44f1553 /lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
parentab73426c68747fb5221f7ef818de1f71d873dca8 (diff)
downloadbcm5719-llvm-6284aee9f811d596b941e44b30dee5befbc22f20.tar.gz
bcm5719-llvm-6284aee9f811d596b941e44b30dee5befbc22f20.zip
[NativePDB] Rewrite the PdbSymUid to use our own custom namespacing scheme.
Originally we created our 64-bit UID scheme by using the first byte as sort of a "tag" to represent what kind of symbol this was, and we re-used the PDB_SymType enumeration for this. For native pdb support, this is not really the right abstraction layer, because what we really want is something that tells us *how* to find the symbol. This means, specifically, is in the globals stream / public stream / module stream / TPI stream / etc, and for whichever one it is in, where is it within that stream? A good example of why the old namespacing scheme was insufficient is that it is more or less impossible to create a uid for a field list member of a class/struction/union/enum that tells you how to locate the original record. With this new scheme, the first byte is no longer a PDB_SymType enum but a new enum created specifically to identify where in the PDB this record lives. This gives us much better flexibility in what kinds of symbols the uids can identify. llvm-svn: 347018
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
index cda9508c07a..46504720224 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
@@ -122,7 +122,7 @@ void PdbIndex::ParseSectionContribs() {
void PdbIndex::BuildAddrToSymbolMap(CompilandIndexItem &cci) {
lldbassert(cci.m_symbols_by_va.empty() &&
"Addr to symbol map is already built!");
- uint16_t modi = cci.m_uid.asCompiland().modi;
+ uint16_t modi = cci.m_id.modi;
const CVSymbolArray &syms = cci.m_debug_stream.getSymbolArray();
for (auto iter = syms.begin(); iter != syms.end(); ++iter) {
if (!SymbolHasAddress(*iter))
@@ -134,14 +134,13 @@ void PdbIndex::BuildAddrToSymbolMap(CompilandIndexItem &cci) {
// We need to add 4 here to adjust for the codeview debug magic
// at the beginning of the debug info stream.
uint32_t sym_offset = iter.offset() + 4;
- PdbSymUid cu_sym_uid =
- PdbSymUid::makeCuSymId(CVSymToPDBSym(iter->kind()), modi, sym_offset);
+ PdbCompilandSymId cu_sym_id{modi, sym_offset};
// If the debug info is incorrect, we could have multiple symbols with the
// same address. So use try_emplace instead of insert, and the first one
// will win.
auto insert_result =
- cci.m_symbols_by_va.insert(std::make_pair(va, cu_sym_uid));
+ cci.m_symbols_by_va.insert(std::make_pair(va, PdbSymUid(cu_sym_id)));
(void)insert_result;
// The odds of an error in some function such as GetSegmentAndOffset or
@@ -180,7 +179,7 @@ std::vector<SymbolAndUid> PdbIndex::FindSymbolsByVa(lldb::addr_t va) {
auto ub = cci.m_symbols_by_va.upper_bound(va);
for (auto iter = cci.m_symbols_by_va.begin(); iter != ub; ++iter) {
- const PdbCuSymId &cu_sym_id = iter->second.asCuSym();
+ PdbCompilandSymId cu_sym_id = iter->second.asCompilandSym();
CVSymbol sym = ReadSymbolRecord(cu_sym_id);
SegmentOffsetLength sol;
@@ -198,11 +197,10 @@ std::vector<SymbolAndUid> PdbIndex::FindSymbolsByVa(lldb::addr_t va) {
return result;
}
-CVSymbol PdbIndex::ReadSymbolRecord(PdbCuSymId cu_sym) const {
+CVSymbol PdbIndex::ReadSymbolRecord(PdbCompilandSymId cu_sym) const {
// We need to subtract 4 here to adjust for the codeview debug magic
// at the beginning of the debug info stream.
- PdbSymUid cuid = PdbSymUid::makeCompilandId(cu_sym.modi);
- const CompilandIndexItem *cci = compilands().GetCompiland(cuid);
+ const CompilandIndexItem *cci = compilands().GetCompiland(cu_sym.modi);
auto iter = cci->m_debug_stream.getSymbolArray().at(cu_sym.offset - 4);
lldbassert(iter != cci->m_debug_stream.getSymbolArray().end());
return *iter;
OpenPOWER on IntegriCloud