aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/DebugInfo/PDB
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/DebugInfo/PDB
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/DebugInfo/PDB')
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp116
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp18
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp82
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp184
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp354
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp8
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSession.cpp156
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/SymbolCache.cpp156
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp92
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/PDB.cpp2
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/PDBContext.cpp74
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/PDBExtras.cpp30
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp4
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/PDBSymbol.cpp34
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/UDTLayout.cpp8
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/PDB/ya.make16
21 files changed, 672 insertions, 672 deletions
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
index 4fcf0f60e2..b6f11a942a 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
@@ -74,7 +74,7 @@ void DbiModuleDescriptorBuilder::addSymbolsInBulk(
if (BulkSymbols.empty())
return;
- Symbols.push_back(SymbolListWrapper(BulkSymbols));
+ Symbols.push_back(SymbolListWrapper(BulkSymbols));
// Symbols written to a PDB file are required to be 4 byte aligned. The same
// is not true of object files.
assert(BulkSymbols.size() % alignOf(CodeViewContainer::Pdb) == 0 &&
@@ -82,18 +82,18 @@ void DbiModuleDescriptorBuilder::addSymbolsInBulk(
SymbolByteSize += BulkSymbols.size();
}
-void DbiModuleDescriptorBuilder::addUnmergedSymbols(void *SymSrc,
- uint32_t SymLength) {
- assert(SymLength > 0);
- Symbols.push_back(SymbolListWrapper(SymSrc, SymLength));
-
- // Symbols written to a PDB file are required to be 4 byte aligned. The same
- // is not true of object files.
- assert(SymLength % alignOf(CodeViewContainer::Pdb) == 0 &&
- "Invalid Symbol alignment!");
- SymbolByteSize += SymLength;
-}
-
+void DbiModuleDescriptorBuilder::addUnmergedSymbols(void *SymSrc,
+ uint32_t SymLength) {
+ assert(SymLength > 0);
+ Symbols.push_back(SymbolListWrapper(SymSrc, SymLength));
+
+ // Symbols written to a PDB file are required to be 4 byte aligned. The same
+ // is not true of object files.
+ assert(SymLength % alignOf(CodeViewContainer::Pdb) == 0 &&
+ "Invalid Symbol alignment!");
+ SymbolByteSize += SymLength;
+}
+
void DbiModuleDescriptorBuilder::addSourceFile(StringRef Path) {
SourceFiles.push_back(std::string(Path));
}
@@ -143,7 +143,7 @@ Error DbiModuleDescriptorBuilder::finalizeMsfLayout() {
return Error::success();
}
-Error DbiModuleDescriptorBuilder::commit(BinaryStreamWriter &ModiWriter) {
+Error DbiModuleDescriptorBuilder::commit(BinaryStreamWriter &ModiWriter) {
// We write the Modi record to the `ModiWriter`, but we additionally write its
// symbol stream to a brand new stream.
if (auto EC = ModiWriter.writeObject(Layout))
@@ -154,55 +154,55 @@ Error DbiModuleDescriptorBuilder::commit(BinaryStreamWriter &ModiWriter) {
return EC;
if (auto EC = ModiWriter.padToAlignment(sizeof(uint32_t)))
return EC;
- return Error::success();
-}
-
-Error DbiModuleDescriptorBuilder::commitSymbolStream(
- const msf::MSFLayout &MsfLayout, WritableBinaryStreamRef MsfBuffer) {
- if (Layout.ModDiStream == kInvalidStreamIndex)
- return Error::success();
-
- auto NS = WritableMappedBlockStream::createIndexedStream(
- MsfLayout, MsfBuffer, Layout.ModDiStream, MSF.getAllocator());
- WritableBinaryStreamRef Ref(*NS);
- BinaryStreamWriter SymbolWriter(Ref);
- // Write the symbols.
- if (auto EC = SymbolWriter.writeInteger<uint32_t>(COFF::DEBUG_SECTION_MAGIC))
- return EC;
- for (const SymbolListWrapper &Sym : Symbols) {
- if (Sym.NeedsToBeMerged) {
- assert(MergeSymsCallback);
- if (auto EC = MergeSymsCallback(MergeSymsCtx, Sym.SymPtr, SymbolWriter))
+ return Error::success();
+}
+
+Error DbiModuleDescriptorBuilder::commitSymbolStream(
+ const msf::MSFLayout &MsfLayout, WritableBinaryStreamRef MsfBuffer) {
+ if (Layout.ModDiStream == kInvalidStreamIndex)
+ return Error::success();
+
+ auto NS = WritableMappedBlockStream::createIndexedStream(
+ MsfLayout, MsfBuffer, Layout.ModDiStream, MSF.getAllocator());
+ WritableBinaryStreamRef Ref(*NS);
+ BinaryStreamWriter SymbolWriter(Ref);
+ // Write the symbols.
+ if (auto EC = SymbolWriter.writeInteger<uint32_t>(COFF::DEBUG_SECTION_MAGIC))
+ return EC;
+ for (const SymbolListWrapper &Sym : Symbols) {
+ if (Sym.NeedsToBeMerged) {
+ assert(MergeSymsCallback);
+ if (auto EC = MergeSymsCallback(MergeSymsCtx, Sym.SymPtr, SymbolWriter))
return EC;
- } else {
- if (auto EC = SymbolWriter.writeBytes(Sym.asArray()))
+ } else {
+ if (auto EC = SymbolWriter.writeBytes(Sym.asArray()))
return EC;
}
- }
-
- // Apply the string table fixups.
- auto SavedOffset = SymbolWriter.getOffset();
- for (const StringTableFixup &Fixup : StringTableFixups) {
- SymbolWriter.setOffset(Fixup.SymOffsetOfReference);
- if (auto E = SymbolWriter.writeInteger<uint32_t>(Fixup.StrTabOffset))
- return E;
- }
- SymbolWriter.setOffset(SavedOffset);
-
- assert(SymbolWriter.getOffset() % alignOf(CodeViewContainer::Pdb) == 0 &&
- "Invalid debug section alignment!");
- // TODO: Write C11 Line data
- for (const auto &Builder : C13Builders) {
- if (auto EC = Builder.commit(SymbolWriter, CodeViewContainer::Pdb))
+ }
+
+ // Apply the string table fixups.
+ auto SavedOffset = SymbolWriter.getOffset();
+ for (const StringTableFixup &Fixup : StringTableFixups) {
+ SymbolWriter.setOffset(Fixup.SymOffsetOfReference);
+ if (auto E = SymbolWriter.writeInteger<uint32_t>(Fixup.StrTabOffset))
+ return E;
+ }
+ SymbolWriter.setOffset(SavedOffset);
+
+ assert(SymbolWriter.getOffset() % alignOf(CodeViewContainer::Pdb) == 0 &&
+ "Invalid debug section alignment!");
+ // TODO: Write C11 Line data
+ for (const auto &Builder : C13Builders) {
+ if (auto EC = Builder.commit(SymbolWriter, CodeViewContainer::Pdb))
return EC;
}
-
- // TODO: Figure out what GlobalRefs substream actually is and populate it.
- if (auto EC = SymbolWriter.writeInteger<uint32_t>(0))
- return EC;
- if (SymbolWriter.bytesRemaining() > 0)
- return make_error<RawError>(raw_error_code::stream_too_long);
-
+
+ // TODO: Figure out what GlobalRefs substream actually is and populate it.
+ if (auto EC = SymbolWriter.writeInteger<uint32_t>(0))
+ return EC;
+ if (SymbolWriter.bytesRemaining() > 0)
+ return make_error<RawError>(raw_error_code::stream_too_long);
+
return Error::success();
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index 48321ae3d9..98a8acaffd 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -18,7 +18,7 @@
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/Parallel.h"
+#include "llvm/Support/Parallel.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -395,17 +395,17 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
return EC;
for (auto &M : ModiList) {
- if (auto EC = M->commit(Writer))
+ if (auto EC = M->commit(Writer))
return EC;
}
- // Commit symbol streams. This is a lot of data, so do it in parallel.
- if (auto EC = parallelForEachError(
- ModiList, [&](std::unique_ptr<DbiModuleDescriptorBuilder> &M) {
- return M->commitSymbolStream(Layout, MsfBuffer);
- }))
- return EC;
-
+ // Commit symbol streams. This is a lot of data, so do it in parallel.
+ if (auto EC = parallelForEachError(
+ ModiList, [&](std::unique_ptr<DbiModuleDescriptorBuilder> &M) {
+ return M->commitSymbolStream(Layout, MsfBuffer);
+ }))
+ return EC;
+
if (!SectionContribs.empty()) {
if (auto EC = Writer.writeEnum(DbiSecContribVer60))
return EC;
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
index 6cad5474bb..52df26b679 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
@@ -162,7 +162,7 @@ static int gsiRecordCmp(StringRef S1, StringRef S2) {
if (LLVM_UNLIKELY(!isAsciiString(S1) || !isAsciiString(S2)))
return memcmp(S1.data(), S2.data(), LS);
- // Both strings are ascii, perform a case-insensitive comparison.
+ // Both strings are ascii, perform a case-insensitive comparison.
return S1.compare_lower(S2.data());
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
index dfe545c889..1d873b87b3 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
@@ -116,7 +116,7 @@ StringMap<uint32_t> NamedStreamMap::entries() const {
uint32_t NamedStreamMap::appendStringData(StringRef S) {
uint32_t Offset = NamesBuffer.size();
- llvm::append_range(NamesBuffer, S);
+ llvm::append_range(NamesBuffer, S);
NamesBuffer.push_back('\0');
return Offset;
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
index c861163b3f..feede1dbc9 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
@@ -1,41 +1,41 @@
-//==- NativeEnumSymbols.cpp - Native Symbol Enumerator impl ------*- C++ -*-==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
-
-#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-
-using namespace llvm;
-using namespace llvm::codeview;
-using namespace llvm::pdb;
-
-NativeEnumSymbols::NativeEnumSymbols(NativeSession &PDBSession,
- std::vector<SymIndexId> Symbols)
- : Symbols(std::move(Symbols)), Index(0), Session(PDBSession) {}
-
-uint32_t NativeEnumSymbols::getChildCount() const {
- return static_cast<uint32_t>(Symbols.size());
-}
-
-std::unique_ptr<PDBSymbol>
-NativeEnumSymbols::getChildAtIndex(uint32_t N) const {
- if (N < Symbols.size()) {
- return Session.getSymbolCache().getSymbolById(Symbols[N]);
- }
- return nullptr;
-}
-
-std::unique_ptr<PDBSymbol> NativeEnumSymbols::getNext() {
- return getChildAtIndex(Index++);
-}
-
-void NativeEnumSymbols::reset() { Index = 0; }
+//==- NativeEnumSymbols.cpp - Native Symbol Enumerator impl ------*- C++ -*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
+
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+NativeEnumSymbols::NativeEnumSymbols(NativeSession &PDBSession,
+ std::vector<SymIndexId> Symbols)
+ : Symbols(std::move(Symbols)), Index(0), Session(PDBSession) {}
+
+uint32_t NativeEnumSymbols::getChildCount() const {
+ return static_cast<uint32_t>(Symbols.size());
+}
+
+std::unique_ptr<PDBSymbol>
+NativeEnumSymbols::getChildAtIndex(uint32_t N) const {
+ if (N < Symbols.size()) {
+ return Session.getSymbolCache().getSymbolById(Symbols[N]);
+ }
+ return nullptr;
+}
+
+std::unique_ptr<PDBSymbol> NativeEnumSymbols::getNext() {
+ return getChildAtIndex(Index++);
+}
+
+void NativeEnumSymbols::reset() { Index = 0; }
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
index 0a8d3de330..7f3b35c297 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
@@ -8,9 +8,9 @@
#include "llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h"
-#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
+#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
@@ -20,10 +20,10 @@ using namespace llvm::pdb;
NativeFunctionSymbol::NativeFunctionSymbol(NativeSession &Session,
SymIndexId Id,
- const codeview::ProcSym &Sym,
- uint32_t Offset)
- : NativeRawSymbol(Session, PDB_SymType::Function, Id), Sym(Sym),
- RecordOffset(Offset) {}
+ const codeview::ProcSym &Sym,
+ uint32_t Offset)
+ : NativeRawSymbol(Session, PDB_SymType::Function, Id), Sym(Sym),
+ RecordOffset(Offset) {}
NativeFunctionSymbol::~NativeFunctionSymbol() {}
@@ -55,89 +55,89 @@ uint32_t NativeFunctionSymbol::getRelativeVirtualAddress() const {
uint64_t NativeFunctionSymbol::getVirtualAddress() const {
return Session.getVAFromSectOffset(Sym.Segment, Sym.CodeOffset);
}
-
-static bool inlineSiteContainsAddress(InlineSiteSym &IS,
- uint32_t OffsetInFunc) {
- // Returns true if inline site contains the offset.
- bool Found = false;
- uint32_t CodeOffset = 0;
- for (auto &Annot : IS.annotations()) {
- switch (Annot.OpCode) {
- case BinaryAnnotationsOpCode::CodeOffset:
- case BinaryAnnotationsOpCode::ChangeCodeOffset:
- case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
- CodeOffset += Annot.U1;
- if (OffsetInFunc >= CodeOffset)
- Found = true;
- break;
- case BinaryAnnotationsOpCode::ChangeCodeLength:
- CodeOffset += Annot.U1;
- if (Found && OffsetInFunc < CodeOffset)
- return true;
- Found = false;
- break;
- case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
- CodeOffset += Annot.U2;
- if (OffsetInFunc >= CodeOffset && OffsetInFunc < CodeOffset + Annot.U1)
- return true;
- Found = false;
- break;
- default:
- break;
- }
- }
- return false;
-}
-
-std::unique_ptr<IPDBEnumSymbols>
-NativeFunctionSymbol::findInlineFramesByVA(uint64_t VA) const {
- uint16_t Modi;
- if (!Session.moduleIndexForVA(VA, Modi))
- return nullptr;
-
- Expected<ModuleDebugStreamRef> ModS = Session.getModuleDebugStream(Modi);
- if (!ModS) {
- consumeError(ModS.takeError());
- return nullptr;
- }
- CVSymbolArray Syms = ModS->getSymbolArray();
-
- // Search for inline sites. There should be one matching top level inline
- // site. Then search in its nested inline sites.
- std::vector<SymIndexId> Frames;
- uint32_t CodeOffset = VA - getVirtualAddress();
- auto Start = Syms.at(RecordOffset);
- auto End = Syms.at(Sym.End);
- while (Start != End) {
- bool Found = false;
- // Find matching inline site within Start and End.
- for (; Start != End; ++Start) {
- if (Start->kind() != S_INLINESITE)
- continue;
-
- InlineSiteSym IS =
- cantFail(SymbolDeserializer::deserializeAs<InlineSiteSym>(*Start));
- if (inlineSiteContainsAddress(IS, CodeOffset)) {
- // Insert frames in reverse order.
- SymIndexId Id = Session.getSymbolCache().getOrCreateInlineSymbol(
- IS, getVirtualAddress(), Modi, Start.offset());
- Frames.insert(Frames.begin(), Id);
-
- // Update offsets to search within this inline site.
- ++Start;
- End = Syms.at(IS.End);
- Found = true;
- break;
- }
-
- Start = Syms.at(IS.End);
- if (Start == End)
- break;
- }
-
- if (!Found)
- break;
- }
-
- return std::make_unique<NativeEnumSymbols>(Session, std::move(Frames));
-}
+
+static bool inlineSiteContainsAddress(InlineSiteSym &IS,
+ uint32_t OffsetInFunc) {
+ // Returns true if inline site contains the offset.
+ bool Found = false;
+ uint32_t CodeOffset = 0;
+ for (auto &Annot : IS.annotations()) {
+ switch (Annot.OpCode) {
+ case BinaryAnnotationsOpCode::CodeOffset:
+ case BinaryAnnotationsOpCode::ChangeCodeOffset:
+ case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
+ CodeOffset += Annot.U1;
+ if (OffsetInFunc >= CodeOffset)
+ Found = true;
+ break;
+ case BinaryAnnotationsOpCode::ChangeCodeLength:
+ CodeOffset += Annot.U1;
+ if (Found && OffsetInFunc < CodeOffset)
+ return true;
+ Found = false;
+ break;
+ case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
+ CodeOffset += Annot.U2;
+ if (OffsetInFunc >= CodeOffset && OffsetInFunc < CodeOffset + Annot.U1)
+ return true;
+ Found = false;
+ break;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+NativeFunctionSymbol::findInlineFramesByVA(uint64_t VA) const {
+ uint16_t Modi;
+ if (!Session.moduleIndexForVA(VA, Modi))
+ return nullptr;
+
+ Expected<ModuleDebugStreamRef> ModS = Session.getModuleDebugStream(Modi);
+ if (!ModS) {
+ consumeError(ModS.takeError());
+ return nullptr;
+ }
+ CVSymbolArray Syms = ModS->getSymbolArray();
+
+ // Search for inline sites. There should be one matching top level inline
+ // site. Then search in its nested inline sites.
+ std::vector<SymIndexId> Frames;
+ uint32_t CodeOffset = VA - getVirtualAddress();
+ auto Start = Syms.at(RecordOffset);
+ auto End = Syms.at(Sym.End);
+ while (Start != End) {
+ bool Found = false;
+ // Find matching inline site within Start and End.
+ for (; Start != End; ++Start) {
+ if (Start->kind() != S_INLINESITE)
+ continue;
+
+ InlineSiteSym IS =
+ cantFail(SymbolDeserializer::deserializeAs<InlineSiteSym>(*Start));
+ if (inlineSiteContainsAddress(IS, CodeOffset)) {
+ // Insert frames in reverse order.
+ SymIndexId Id = Session.getSymbolCache().getOrCreateInlineSymbol(
+ IS, getVirtualAddress(), Modi, Start.offset());
+ Frames.insert(Frames.begin(), Id);
+
+ // Update offsets to search within this inline site.
+ ++Start;
+ End = Syms.at(IS.End);
+ Found = true;
+ break;
+ }
+
+ Start = Syms.at(IS.End);
+ if (Start == End)
+ break;
+ }
+
+ if (!Found)
+ break;
+ }
+
+ return std::make_unique<NativeEnumSymbols>(Session, std::move(Frames));
+}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
index 9708976f28..8314353c38 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
@@ -1,177 +1,177 @@
-//===- NativeInlineSiteSymbol.cpp - info about inline sites -----*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h"
-
-#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
-#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
-#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
-
-using namespace llvm;
-using namespace llvm::codeview;
-using namespace llvm::pdb;
-
-NativeInlineSiteSymbol::NativeInlineSiteSymbol(
- NativeSession &Session, SymIndexId Id, const codeview::InlineSiteSym &Sym,
- uint64_t ParentAddr)
- : NativeRawSymbol(Session, PDB_SymType::InlineSite, Id), Sym(Sym),
- ParentAddr(ParentAddr) {}
-
-NativeInlineSiteSymbol::~NativeInlineSiteSymbol() {}
-
-void NativeInlineSiteSymbol::dump(raw_ostream &OS, int Indent,
- PdbSymbolIdField ShowIdFields,
- PdbSymbolIdField RecurseIdFields) const {
- NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
- dumpSymbolField(OS, "name", getName(), Indent);
-}
-
-static Optional<InlineeSourceLine>
-findInlineeByTypeIndex(TypeIndex Id, ModuleDebugStreamRef &ModS) {
- for (const auto &SS : ModS.getSubsectionsArray()) {
- if (SS.kind() != DebugSubsectionKind::InlineeLines)
- continue;
-
- DebugInlineeLinesSubsectionRef InlineeLines;
- BinaryStreamReader Reader(SS.getRecordData());
- if (auto EC = InlineeLines.initialize(Reader)) {
- consumeError(std::move(EC));
- continue;
- }
-
- for (const InlineeSourceLine &Line : InlineeLines)
- if (Line.Header->Inlinee == Id)
- return Line;
- }
- return None;
-}
-
-std::string NativeInlineSiteSymbol::getName() const {
- auto Tpi = Session.getPDBFile().getPDBTpiStream();
- if (!Tpi) {
- consumeError(Tpi.takeError());
- return "";
- }
- auto Ipi = Session.getPDBFile().getPDBIpiStream();
- if (!Ipi) {
- consumeError(Ipi.takeError());
- return "";
- }
-
- LazyRandomTypeCollection &Types = Tpi->typeCollection();
- LazyRandomTypeCollection &Ids = Ipi->typeCollection();
- CVType InlineeType = Ids.getType(Sym.Inlinee);
- std::string QualifiedName;
- if (InlineeType.kind() == LF_MFUNC_ID) {
- MemberFuncIdRecord MFRecord;
- cantFail(TypeDeserializer::deserializeAs<MemberFuncIdRecord>(InlineeType,
- MFRecord));
- TypeIndex ClassTy = MFRecord.getClassType();
- QualifiedName.append(std::string(Types.getTypeName(ClassTy)));
- QualifiedName.append("::");
- } else if (InlineeType.kind() == LF_FUNC_ID) {
- FuncIdRecord FRecord;
- cantFail(
- TypeDeserializer::deserializeAs<FuncIdRecord>(InlineeType, FRecord));
- TypeIndex ParentScope = FRecord.getParentScope();
- if (!ParentScope.isNoneType()) {
- QualifiedName.append(std::string(Ids.getTypeName(ParentScope)));
- QualifiedName.append("::");
- }
- }
-
- QualifiedName.append(std::string(Ids.getTypeName(Sym.Inlinee)));
- return QualifiedName;
-}
-
-void NativeInlineSiteSymbol::getLineOffset(uint32_t OffsetInFunc,
- uint32_t &LineOffset,
- uint32_t &FileOffset) const {
- LineOffset = 0;
- FileOffset = 0;
- uint32_t CodeOffset = 0;
- for (const auto &Annot : Sym.annotations()) {
- switch (Annot.OpCode) {
- case BinaryAnnotationsOpCode::CodeOffset:
- case BinaryAnnotationsOpCode::ChangeCodeOffset:
- case BinaryAnnotationsOpCode::ChangeCodeLength:
- CodeOffset += Annot.U1;
- break;
- case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
- CodeOffset += Annot.U2;
- break;
- case BinaryAnnotationsOpCode::ChangeLineOffset:
- case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
- CodeOffset += Annot.U1;
- LineOffset += Annot.S1;
- break;
- case BinaryAnnotationsOpCode::ChangeFile:
- FileOffset = Annot.U1;
- break;
- default:
- break;
- }
-
- if (CodeOffset >= OffsetInFunc)
- return;
- }
-}
-
-std::unique_ptr<IPDBEnumLineNumbers>
-NativeInlineSiteSymbol::findInlineeLinesByVA(uint64_t VA,
- uint32_t Length) const {
- uint16_t Modi;
- if (!Session.moduleIndexForVA(VA, Modi))
- return nullptr;
-
- Expected<ModuleDebugStreamRef> ModS = Session.getModuleDebugStream(Modi);
- if (!ModS) {
- consumeError(ModS.takeError());
- return nullptr;
- }
-
- Expected<DebugChecksumsSubsectionRef> Checksums =
- ModS->findChecksumsSubsection();
- if (!Checksums) {
- consumeError(Checksums.takeError());
- return nullptr;
- }
-
- // Get the line number offset and source file offset.
- uint32_t SrcLineOffset;
- uint32_t SrcFileOffset;
- getLineOffset(VA - ParentAddr, SrcLineOffset, SrcFileOffset);
-
- // Get line info from inlinee line table.
- Optional<InlineeSourceLine> Inlinee =
- findInlineeByTypeIndex(Sym.Inlinee, ModS.get());
-
- if (!Inlinee)
- return nullptr;
-
- uint32_t SrcLine = Inlinee->Header->SourceLineNum + SrcLineOffset;
- uint32_t SrcCol = 0; // Inline sites don't seem to have column info.
- uint32_t FileChecksumOffset =
- (SrcFileOffset == 0) ? Inlinee->Header->FileID : SrcFileOffset;
-
- auto ChecksumIter = Checksums->getArray().at(FileChecksumOffset);
- uint32_t SrcFileId =
- Session.getSymbolCache().getOrCreateSourceFile(*ChecksumIter);
-
- uint32_t LineSect, LineOff;
- Session.addressForVA(VA, LineSect, LineOff);
- NativeLineNumber LineNum(Session, SrcLine, SrcCol, LineSect, LineOff, Length,
- SrcFileId, Modi);
- auto SrcFile = Session.getSymbolCache().getSourceFileById(SrcFileId);
- std::vector<NativeLineNumber> Lines{LineNum};
-
- return std::make_unique<NativeEnumLineNumbers>(std::move(Lines));
-}
+//===- NativeInlineSiteSymbol.cpp - info about inline sites -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h"
+
+#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
+#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+NativeInlineSiteSymbol::NativeInlineSiteSymbol(
+ NativeSession &Session, SymIndexId Id, const codeview::InlineSiteSym &Sym,
+ uint64_t ParentAddr)
+ : NativeRawSymbol(Session, PDB_SymType::InlineSite, Id), Sym(Sym),
+ ParentAddr(ParentAddr) {}
+
+NativeInlineSiteSymbol::~NativeInlineSiteSymbol() {}
+
+void NativeInlineSiteSymbol::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
+ dumpSymbolField(OS, "name", getName(), Indent);
+}
+
+static Optional<InlineeSourceLine>
+findInlineeByTypeIndex(TypeIndex Id, ModuleDebugStreamRef &ModS) {
+ for (const auto &SS : ModS.getSubsectionsArray()) {
+ if (SS.kind() != DebugSubsectionKind::InlineeLines)
+ continue;
+
+ DebugInlineeLinesSubsectionRef InlineeLines;
+ BinaryStreamReader Reader(SS.getRecordData());
+ if (auto EC = InlineeLines.initialize(Reader)) {
+ consumeError(std::move(EC));
+ continue;
+ }
+
+ for (const InlineeSourceLine &Line : InlineeLines)
+ if (Line.Header->Inlinee == Id)
+ return Line;
+ }
+ return None;
+}
+
+std::string NativeInlineSiteSymbol::getName() const {
+ auto Tpi = Session.getPDBFile().getPDBTpiStream();
+ if (!Tpi) {
+ consumeError(Tpi.takeError());
+ return "";
+ }
+ auto Ipi = Session.getPDBFile().getPDBIpiStream();
+ if (!Ipi) {
+ consumeError(Ipi.takeError());
+ return "";
+ }
+
+ LazyRandomTypeCollection &Types = Tpi->typeCollection();
+ LazyRandomTypeCollection &Ids = Ipi->typeCollection();
+ CVType InlineeType = Ids.getType(Sym.Inlinee);
+ std::string QualifiedName;
+ if (InlineeType.kind() == LF_MFUNC_ID) {
+ MemberFuncIdRecord MFRecord;
+ cantFail(TypeDeserializer::deserializeAs<MemberFuncIdRecord>(InlineeType,
+ MFRecord));
+ TypeIndex ClassTy = MFRecord.getClassType();
+ QualifiedName.append(std::string(Types.getTypeName(ClassTy)));
+ QualifiedName.append("::");
+ } else if (InlineeType.kind() == LF_FUNC_ID) {
+ FuncIdRecord FRecord;
+ cantFail(
+ TypeDeserializer::deserializeAs<FuncIdRecord>(InlineeType, FRecord));
+ TypeIndex ParentScope = FRecord.getParentScope();
+ if (!ParentScope.isNoneType()) {
+ QualifiedName.append(std::string(Ids.getTypeName(ParentScope)));
+ QualifiedName.append("::");
+ }
+ }
+
+ QualifiedName.append(std::string(Ids.getTypeName(Sym.Inlinee)));
+ return QualifiedName;
+}
+
+void NativeInlineSiteSymbol::getLineOffset(uint32_t OffsetInFunc,
+ uint32_t &LineOffset,
+ uint32_t &FileOffset) const {
+ LineOffset = 0;
+ FileOffset = 0;
+ uint32_t CodeOffset = 0;
+ for (const auto &Annot : Sym.annotations()) {
+ switch (Annot.OpCode) {
+ case BinaryAnnotationsOpCode::CodeOffset:
+ case BinaryAnnotationsOpCode::ChangeCodeOffset:
+ case BinaryAnnotationsOpCode::ChangeCodeLength:
+ CodeOffset += Annot.U1;
+ break;
+ case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
+ CodeOffset += Annot.U2;
+ break;
+ case BinaryAnnotationsOpCode::ChangeLineOffset:
+ case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
+ CodeOffset += Annot.U1;
+ LineOffset += Annot.S1;
+ break;
+ case BinaryAnnotationsOpCode::ChangeFile:
+ FileOffset = Annot.U1;
+ break;
+ default:
+ break;
+ }
+
+ if (CodeOffset >= OffsetInFunc)
+ return;
+ }
+}
+
+std::unique_ptr<IPDBEnumLineNumbers>
+NativeInlineSiteSymbol::findInlineeLinesByVA(uint64_t VA,
+ uint32_t Length) const {
+ uint16_t Modi;
+ if (!Session.moduleIndexForVA(VA, Modi))
+ return nullptr;
+
+ Expected<ModuleDebugStreamRef> ModS = Session.getModuleDebugStream(Modi);
+ if (!ModS) {
+ consumeError(ModS.takeError());
+ return nullptr;
+ }
+
+ Expected<DebugChecksumsSubsectionRef> Checksums =
+ ModS->findChecksumsSubsection();
+ if (!Checksums) {
+ consumeError(Checksums.takeError());
+ return nullptr;
+ }
+
+ // Get the line number offset and source file offset.
+ uint32_t SrcLineOffset;
+ uint32_t SrcFileOffset;
+ getLineOffset(VA - ParentAddr, SrcLineOffset, SrcFileOffset);
+
+ // Get line info from inlinee line table.
+ Optional<InlineeSourceLine> Inlinee =
+ findInlineeByTypeIndex(Sym.Inlinee, ModS.get());
+
+ if (!Inlinee)
+ return nullptr;
+
+ uint32_t SrcLine = Inlinee->Header->SourceLineNum + SrcLineOffset;
+ uint32_t SrcCol = 0; // Inline sites don't seem to have column info.
+ uint32_t FileChecksumOffset =
+ (SrcFileOffset == 0) ? Inlinee->Header->FileID : SrcFileOffset;
+
+ auto ChecksumIter = Checksums->getArray().at(FileChecksumOffset);
+ uint32_t SrcFileId =
+ Session.getSymbolCache().getOrCreateSourceFile(*ChecksumIter);
+
+ uint32_t LineSect, LineOff;
+ Session.addressForVA(VA, LineSect, LineOff);
+ NativeLineNumber LineNum(Session, SrcLine, SrcCol, LineSect, LineOff, Length,
+ SrcFileId, Modi);
+ auto SrcFile = Session.getSymbolCache().getSourceFileById(SrcFileId);
+ std::vector<NativeLineNumber> Lines{LineNum};
+
+ return std::make_unique<NativeEnumLineNumbers>(std::move(Lines));
+}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
index aefacfd23f..155ed0cdb8 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
@@ -15,10 +15,10 @@ NativeLineNumber::NativeLineNumber(const NativeSession &Session,
const codeview::LineInfo Line,
uint32_t ColumnNumber, uint32_t Section,
uint32_t Offset, uint32_t Length,
- uint32_t SrcFileId, uint32_t CompilandId)
+ uint32_t SrcFileId, uint32_t CompilandId)
: Session(Session), Line(Line), ColumnNumber(ColumnNumber),
- Section(Section), Offset(Offset), Length(Length), SrcFileId(SrcFileId),
- CompilandId(CompilandId) {}
+ Section(Section), Offset(Offset), Length(Length), SrcFileId(SrcFileId),
+ CompilandId(CompilandId) {}
uint32_t NativeLineNumber::getLineNumber() const { return Line.getStartLine(); }
@@ -46,6 +46,6 @@ uint32_t NativeLineNumber::getLength() const { return Length; }
uint32_t NativeLineNumber::getSourceFileId() const { return SrcFileId; }
-uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; }
+uint32_t NativeLineNumber::getCompilandId() const { return CompilandId; }
bool NativeLineNumber::isStatement() const { return Line.isStatement(); }
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
index 501b3003ba..1265e688b8 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
@@ -18,7 +18,7 @@ using namespace llvm::pdb;
NativePublicSymbol::NativePublicSymbol(NativeSession &Session, SymIndexId Id,
const codeview::PublicSym32 &Sym)
- : NativeRawSymbol(Session, PDB_SymType::PublicSymbol, Id), Sym(Sym) {}
+ : NativeRawSymbol(Session, PDB_SymType::PublicSymbol, Id), Sym(Sym) {}
NativePublicSymbol::~NativePublicSymbol() {}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSession.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSession.cpp
index 6a7e7ee4d8..5d7946cdc2 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSession.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSession.cpp
@@ -13,7 +13,7 @@
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
-#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
+#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
@@ -57,7 +57,7 @@ static DbiStream *getDbiStreamPtr(PDBFile &File) {
NativeSession::NativeSession(std::unique_ptr<PDBFile> PdbFile,
std::unique_ptr<BumpPtrAllocator> Allocator)
: Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)),
- Cache(*this, getDbiStreamPtr(*Pdb)), AddrToModuleIndex(IMapAllocator) {}
+ Cache(*this, getDbiStreamPtr(*Pdb)), AddrToModuleIndex(IMapAllocator) {}
NativeSession::~NativeSession() = default;
@@ -256,9 +256,9 @@ std::unique_ptr<PDBSymbol> NativeSession::findSymbolByRVA(uint32_t RVA,
std::unique_ptr<PDBSymbol>
NativeSession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
PDB_SymType Type) {
- if (AddrToModuleIndex.empty())
- parseSectionContribs();
-
+ if (AddrToModuleIndex.empty())
+ parseSectionContribs();
+
return Cache.findSymbolBySectOffset(Sect, Offset, Type);
}
@@ -276,14 +276,14 @@ NativeSession::findLineNumbersByAddress(uint64_t Address,
std::unique_ptr<IPDBEnumLineNumbers>
NativeSession::findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const {
- return Cache.findLineNumbersByVA(getLoadAddress() + RVA, Length);
+ return Cache.findLineNumbersByVA(getLoadAddress() + RVA, Length);
}
std::unique_ptr<IPDBEnumLineNumbers>
NativeSession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
uint32_t Length) const {
uint64_t VA = getVAFromSectOffset(Section, Offset);
- return Cache.findLineNumbersByVA(VA, Length);
+ return Cache.findLineNumbersByVA(VA, Length);
}
std::unique_ptr<IPDBEnumSourceFiles>
@@ -390,74 +390,74 @@ uint64_t NativeSession::getVAFromSectOffset(uint32_t Section,
uint32_t Offset) const {
return LoadAddress + getRVAFromSectOffset(Section, Offset);
}
-
-bool NativeSession::moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const {
- ModuleIndex = 0;
- auto Iter = AddrToModuleIndex.find(VA);
- if (Iter == AddrToModuleIndex.end())
- return false;
- ModuleIndex = Iter.value();
- return true;
-}
-
-bool NativeSession::moduleIndexForSectOffset(uint32_t Sect, uint32_t Offset,
- uint16_t &ModuleIndex) const {
- ModuleIndex = 0;
- auto Iter = AddrToModuleIndex.find(getVAFromSectOffset(Sect, Offset));
- if (Iter == AddrToModuleIndex.end())
- return false;
- ModuleIndex = Iter.value();
- return true;
-}
-
-void NativeSession::parseSectionContribs() {
- auto Dbi = Pdb->getPDBDbiStream();
- if (!Dbi)
- return;
-
- class Visitor : public ISectionContribVisitor {
- NativeSession &Session;
- IMap &AddrMap;
-
- public:
- Visitor(NativeSession &Session, IMap &AddrMap)
- : Session(Session), AddrMap(AddrMap) {}
- void visit(const SectionContrib &C) override {
- if (C.Size == 0)
- return;
-
- uint64_t VA = Session.getVAFromSectOffset(C.ISect, C.Off);
- uint64_t End = VA + C.Size;
-
- // Ignore overlapping sections based on the assumption that a valid
- // PDB file should not have overlaps.
- if (!AddrMap.overlaps(VA, End))
- AddrMap.insert(VA, End, C.Imod);
- }
- void visit(const SectionContrib2 &C) override { visit(C.Base); }
- };
-
- Visitor V(*this, AddrToModuleIndex);
- Dbi->visitSectionContributions(V);
-}
-
-Expected<ModuleDebugStreamRef>
-NativeSession::getModuleDebugStream(uint32_t Index) const {
- auto *Dbi = getDbiStreamPtr(*Pdb);
- assert(Dbi && "Dbi stream not present");
-
- DbiModuleDescriptor Modi = Dbi->modules().getModuleDescriptor(Index);
-
- uint16_t ModiStream = Modi.getModuleStreamIndex();
- if (ModiStream == kInvalidStreamIndex)
- return make_error<RawError>("Module stream not present");
-
- std::unique_ptr<msf::MappedBlockStream> ModStreamData =
- Pdb->createIndexedStream(ModiStream);
-
- ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
- if (auto EC = ModS.reload())
- return std::move(EC);
-
- return std::move(ModS);
-}
+
+bool NativeSession::moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const {
+ ModuleIndex = 0;
+ auto Iter = AddrToModuleIndex.find(VA);
+ if (Iter == AddrToModuleIndex.end())
+ return false;
+ ModuleIndex = Iter.value();
+ return true;
+}
+
+bool NativeSession::moduleIndexForSectOffset(uint32_t Sect, uint32_t Offset,
+ uint16_t &ModuleIndex) const {
+ ModuleIndex = 0;
+ auto Iter = AddrToModuleIndex.find(getVAFromSectOffset(Sect, Offset));
+ if (Iter == AddrToModuleIndex.end())
+ return false;
+ ModuleIndex = Iter.value();
+ return true;
+}
+
+void NativeSession::parseSectionContribs() {
+ auto Dbi = Pdb->getPDBDbiStream();
+ if (!Dbi)
+ return;
+
+ class Visitor : public ISectionContribVisitor {
+ NativeSession &Session;
+ IMap &AddrMap;
+
+ public:
+ Visitor(NativeSession &Session, IMap &AddrMap)
+ : Session(Session), AddrMap(AddrMap) {}
+ void visit(const SectionContrib &C) override {
+ if (C.Size == 0)
+ return;
+
+ uint64_t VA = Session.getVAFromSectOffset(C.ISect, C.Off);
+ uint64_t End = VA + C.Size;
+
+ // Ignore overlapping sections based on the assumption that a valid
+ // PDB file should not have overlaps.
+ if (!AddrMap.overlaps(VA, End))
+ AddrMap.insert(VA, End, C.Imod);
+ }
+ void visit(const SectionContrib2 &C) override { visit(C.Base); }
+ };
+
+ Visitor V(*this, AddrToModuleIndex);
+ Dbi->visitSectionContributions(V);
+}
+
+Expected<ModuleDebugStreamRef>
+NativeSession::getModuleDebugStream(uint32_t Index) const {
+ auto *Dbi = getDbiStreamPtr(*Pdb);
+ assert(Dbi && "Dbi stream not present");
+
+ DbiModuleDescriptor Modi = Dbi->modules().getModuleDescriptor(Index);
+
+ uint16_t ModiStream = Modi.getModuleStreamIndex();
+ if (ModiStream == kInvalidStreamIndex)
+ return make_error<RawError>("Module stream not present");
+
+ std::unique_ptr<msf::MappedBlockStream> ModStreamData =
+ Pdb->createIndexedStream(ModiStream);
+
+ ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
+ if (auto EC = ModS.reload())
+ return std::move(EC);
+
+ return std::move(ModS);
+}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
index e494635182..fd813dee6b 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
@@ -1,4 +1,4 @@
-//===- NativeSourceFile.cpp - Native line number implementation -*- C++ -*-===//
+//===- NativeSourceFile.cpp - Native line number implementation -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
index 401efc0511..917ec14e58 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
@@ -120,7 +120,7 @@ PDB_UdtType NativeTypeUDT::getUdtKind() const {
case TypeRecordKind::Interface:
return PDB_UdtType::Interface;
default:
- llvm_unreachable("Unexpected udt kind");
+ llvm_unreachable("Unexpected udt kind");
}
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/SymbolCache.cpp
index 5bf434f845..fd9a0deb54 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/SymbolCache.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/SymbolCache.cpp
@@ -1,6 +1,6 @@
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
-#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
+#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
@@ -11,10 +11,10 @@
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
+#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativePublicSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
@@ -71,7 +71,7 @@ static const struct BuiltinTypeEntry {
};
SymbolCache::SymbolCache(NativeSession &Session, DbiStream *Dbi)
- : Session(Session), Dbi(Dbi) {
+ : Session(Session), Dbi(Dbi) {
// Id 0 is reserved for the invalid symbol.
Cache.push_back(nullptr);
SourceFiles.push_back(nullptr);
@@ -104,15 +104,15 @@ SymbolCache::createGlobalsEnumerator(codeview::SymbolKind Kind) {
}
SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
- ModifierOptions Mods) const {
+ ModifierOptions Mods) const {
if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct)
return createSymbol<NativeTypePointer>(Index);
const auto Kind = Index.getSimpleKind();
- const auto It =
- llvm::find_if(BuiltinTypes, [Kind](const BuiltinTypeEntry &Builtin) {
- return Builtin.Kind == Kind;
- });
+ const auto It =
+ llvm::find_if(BuiltinTypes, [Kind](const BuiltinTypeEntry &Builtin) {
+ return Builtin.Kind == Kind;
+ });
if (It == std::end(BuiltinTypes))
return 0;
return createSymbol<NativeTypeBuiltin>(Mods, It->Type, It->Size);
@@ -120,7 +120,7 @@ SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
SymIndexId
SymbolCache::createSymbolForModifiedType(codeview::TypeIndex ModifierTI,
- codeview::CVType CVT) const {
+ codeview::CVType CVT) const {
ModifierRecord Record;
if (auto EC = TypeDeserializer::deserializeAs<ModifierRecord>(CVT, Record)) {
consumeError(std::move(EC));
@@ -150,7 +150,7 @@ SymbolCache::createSymbolForModifiedType(codeview::TypeIndex ModifierTI,
return 0;
}
-SymIndexId SymbolCache::findSymbolByTypeIndex(codeview::TypeIndex Index) const {
+SymIndexId SymbolCache::findSymbolByTypeIndex(codeview::TypeIndex Index) const {
// First see if it's already in our cache.
const auto Entry = TypeIndexToSymbolId.find(Index);
if (Entry != TypeIndexToSymbolId.end())
@@ -247,7 +247,7 @@ SymbolCache::getSymbolById(SymIndexId SymbolId) const {
return nullptr;
// Make sure to handle the case where we've inserted a placeholder symbol
- // for types we don't yet support.
+ // for types we don't yet support.
NativeRawSymbol *NRS = Cache[SymbolId].get();
if (!NRS)
return nullptr;
@@ -292,17 +292,17 @@ SymIndexId SymbolCache::getOrCreateGlobalSymbolByOffset(uint32_t Offset) {
return Id;
}
-SymIndexId SymbolCache::getOrCreateInlineSymbol(InlineSiteSym Sym,
- uint64_t ParentAddr,
- uint16_t Modi,
- uint32_t RecordOffset) const {
- auto Iter = SymTabOffsetToSymbolId.find({Modi, RecordOffset});
- if (Iter != SymTabOffsetToSymbolId.end())
- return Iter->second;
-
- SymIndexId Id = createSymbol<NativeInlineSiteSymbol>(Sym, ParentAddr);
- SymTabOffsetToSymbolId.insert({{Modi, RecordOffset}, Id});
- return Id;
+SymIndexId SymbolCache::getOrCreateInlineSymbol(InlineSiteSym Sym,
+ uint64_t ParentAddr,
+ uint16_t Modi,
+ uint32_t RecordOffset) const {
+ auto Iter = SymTabOffsetToSymbolId.find({Modi, RecordOffset});
+ if (Iter != SymTabOffsetToSymbolId.end())
+ return Iter->second;
+
+ SymIndexId Id = createSymbol<NativeInlineSiteSymbol>(Sym, ParentAddr);
+ SymTabOffsetToSymbolId.insert({{Modi, RecordOffset}, Id});
+ return Id;
}
std::unique_ptr<PDBSymbol>
@@ -313,15 +313,15 @@ SymbolCache::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
return findFunctionSymbolBySectOffset(Sect, Offset);
case PDB_SymType::PublicSymbol:
return findPublicSymbolBySectOffset(Sect, Offset);
- case PDB_SymType::Compiland: {
- uint16_t Modi;
- if (!Session.moduleIndexForSectOffset(Sect, Offset, Modi))
- return nullptr;
- return getOrCreateCompiland(Modi);
- }
+ case PDB_SymType::Compiland: {
+ uint16_t Modi;
+ if (!Session.moduleIndexForSectOffset(Sect, Offset, Modi))
+ return nullptr;
+ return getOrCreateCompiland(Modi);
+ }
case PDB_SymType::None: {
- // FIXME: Implement for PDB_SymType::Data. The symbolizer calls this but
- // only uses it to find the symbol length.
+ // FIXME: Implement for PDB_SymType::Data. The symbolizer calls this but
+ // only uses it to find the symbol length.
if (auto Sym = findFunctionSymbolBySectOffset(Sect, Offset))
return Sym;
return nullptr;
@@ -333,19 +333,19 @@ SymbolCache::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
std::unique_ptr<PDBSymbol>
SymbolCache::findFunctionSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
- auto Iter = AddressToSymbolId.find({Sect, Offset});
- if (Iter != AddressToSymbolId.end())
+ auto Iter = AddressToSymbolId.find({Sect, Offset});
+ if (Iter != AddressToSymbolId.end())
return getSymbolById(Iter->second);
if (!Dbi)
return nullptr;
- uint16_t Modi;
- if (!Session.moduleIndexForSectOffset(Sect, Offset, Modi))
+ uint16_t Modi;
+ if (!Session.moduleIndexForSectOffset(Sect, Offset, Modi))
return nullptr;
- Expected<ModuleDebugStreamRef> ExpectedModS =
- Session.getModuleDebugStream(Modi);
+ Expected<ModuleDebugStreamRef> ExpectedModS =
+ Session.getModuleDebugStream(Modi);
if (!ExpectedModS) {
consumeError(ExpectedModS.takeError());
return nullptr;
@@ -359,14 +359,14 @@ SymbolCache::findFunctionSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
auto PS = cantFail(SymbolDeserializer::deserializeAs<ProcSym>(*I));
if (Sect == PS.Segment && Offset >= PS.CodeOffset &&
Offset < PS.CodeOffset + PS.CodeSize) {
- // Check if the symbol is already cached.
- auto Found = AddressToSymbolId.find({PS.Segment, PS.CodeOffset});
- if (Found != AddressToSymbolId.end())
- return getSymbolById(Found->second);
-
- // Otherwise, create a new symbol.
- SymIndexId Id = createSymbol<NativeFunctionSymbol>(PS, I.offset());
- AddressToSymbolId.insert({{PS.Segment, PS.CodeOffset}, Id});
+ // Check if the symbol is already cached.
+ auto Found = AddressToSymbolId.find({PS.Segment, PS.CodeOffset});
+ if (Found != AddressToSymbolId.end())
+ return getSymbolById(Found->second);
+
+ // Otherwise, create a new symbol.
+ SymIndexId Id = createSymbol<NativeFunctionSymbol>(PS, I.offset());
+ AddressToSymbolId.insert({{PS.Segment, PS.CodeOffset}, Id});
return getSymbolById(Id);
}
@@ -426,16 +426,16 @@ SymbolCache::findPublicSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
consumeError(Sym.takeError());
return nullptr;
}
-
- // Check if the symbol is already cached.
+
+ // Check if the symbol is already cached.
auto PS = cantFail(SymbolDeserializer::deserializeAs<PublicSym32>(Sym.get()));
- auto Found = AddressToPublicSymId.find({PS.Segment, PS.Offset});
- if (Found != AddressToPublicSymId.end())
- return getSymbolById(Found->second);
-
- // Otherwise, create a new symbol.
+ auto Found = AddressToPublicSymId.find({PS.Segment, PS.Offset});
+ if (Found != AddressToPublicSymId.end())
+ return getSymbolById(Found->second);
+
+ // Otherwise, create a new symbol.
SymIndexId Id = createSymbol<NativePublicSymbol>(PS);
- AddressToPublicSymId.insert({{PS.Segment, PS.Offset}, Id});
+ AddressToPublicSymId.insert({{PS.Segment, PS.Offset}, Id});
return getSymbolById(Id);
}
@@ -450,8 +450,8 @@ SymbolCache::findLineTable(uint16_t Modi) const {
// If there is an error or there are no lines, just return the
// empty vector.
- Expected<ModuleDebugStreamRef> ExpectedModS =
- Session.getModuleDebugStream(Modi);
+ Expected<ModuleDebugStreamRef> ExpectedModS =
+ Session.getModuleDebugStream(Modi);
if (!ExpectedModS) {
consumeError(ExpectedModS.takeError());
return ModuleLineTable;
@@ -482,19 +482,19 @@ SymbolCache::findLineTable(uint16_t Modi) const {
auto ColIt = Group.Columns.begin();
auto ColsEnd = Group.Columns.end();
- // Add a line to mark the beginning of this section.
- uint64_t StartAddr =
- Session.getVAFromSectOffset(RelocSegment, RelocOffset);
- LineInfo FirstLine(Group.LineNumbers.front().Flags);
- uint32_t ColNum =
- (Lines.hasColumnInfo()) ? Group.Columns.front().StartColumn : 0;
- Entries.push_back({StartAddr, FirstLine, ColNum, Group.NameIndex, false});
-
+ // Add a line to mark the beginning of this section.
+ uint64_t StartAddr =
+ Session.getVAFromSectOffset(RelocSegment, RelocOffset);
+ LineInfo FirstLine(Group.LineNumbers.front().Flags);
+ uint32_t ColNum =
+ (Lines.hasColumnInfo()) ? Group.Columns.front().StartColumn : 0;
+ Entries.push_back({StartAddr, FirstLine, ColNum, Group.NameIndex, false});
+
for (const LineNumberEntry &LN : Group.LineNumbers) {
uint64_t VA =
Session.getVAFromSectOffset(RelocSegment, RelocOffset + LN.Offset);
LineInfo Line(LN.Flags);
- ColNum = 0;
+ ColNum = 0;
if (Lines.hasColumnInfo() && ColIt != ColsEnd) {
ColNum = ColIt->StartColumn;
@@ -504,30 +504,30 @@ SymbolCache::findLineTable(uint16_t Modi) const {
}
// Add a terminal entry line to mark the end of this subsection.
- uint64_t EndAddr = StartAddr + Lines.header()->CodeSize;
+ uint64_t EndAddr = StartAddr + Lines.header()->CodeSize;
LineInfo LastLine(Group.LineNumbers.back().Flags);
- ColNum = (Lines.hasColumnInfo()) ? Group.Columns.back().StartColumn : 0;
- Entries.push_back({EndAddr, LastLine, ColNum, Group.NameIndex, true});
+ ColNum = (Lines.hasColumnInfo()) ? Group.Columns.back().StartColumn : 0;
+ Entries.push_back({EndAddr, LastLine, ColNum, Group.NameIndex, true});
EntryList.push_back(Entries);
}
}
// Sort EntryList, and add flattened contents to the line table.
- llvm::sort(EntryList, [](const std::vector<LineTableEntry> &LHS,
- const std::vector<LineTableEntry> &RHS) {
- return LHS[0].Addr < RHS[0].Addr;
- });
+ llvm::sort(EntryList, [](const std::vector<LineTableEntry> &LHS,
+ const std::vector<LineTableEntry> &RHS) {
+ return LHS[0].Addr < RHS[0].Addr;
+ });
for (size_t I = 0; I < EntryList.size(); ++I)
- llvm::append_range(ModuleLineTable, EntryList[I]);
+ llvm::append_range(ModuleLineTable, EntryList[I]);
return ModuleLineTable;
}
std::unique_ptr<IPDBEnumLineNumbers>
SymbolCache::findLineNumbersByVA(uint64_t VA, uint32_t Length) const {
- uint16_t Modi;
- if (!Session.moduleIndexForVA(VA, Modi))
+ uint16_t Modi;
+ if (!Session.moduleIndexForVA(VA, Modi))
return nullptr;
std::vector<LineTableEntry> Lines = findLineTable(Modi);
@@ -547,8 +547,8 @@ SymbolCache::findLineNumbersByVA(uint64_t VA, uint32_t Length) const {
--LineIter;
}
- Expected<ModuleDebugStreamRef> ExpectedModS =
- Session.getModuleDebugStream(Modi);
+ Expected<ModuleDebugStreamRef> ExpectedModS =
+ Session.getModuleDebugStream(Modi);
if (!ExpectedModS) {
consumeError(ExpectedModS.takeError());
return nullptr;
@@ -563,7 +563,7 @@ SymbolCache::findLineNumbersByVA(uint64_t VA, uint32_t Length) const {
// Populate a vector of NativeLineNumbers that have addresses in the given
// address range.
std::vector<NativeLineNumber> LineNumbers;
- while (LineIter != Lines.end()) {
+ while (LineIter != Lines.end()) {
if (LineIter->IsTerminalEntry) {
++LineIter;
continue;
@@ -581,7 +581,7 @@ SymbolCache::findLineNumbersByVA(uint64_t VA, uint32_t Length) const {
ExpectedChecksums->getArray().at(LineIter->FileNameIndex);
uint32_t SrcFileId = getOrCreateSourceFile(*ChecksumIter);
NativeLineNumber LineNum(Session, LineIter->Line, LineIter->ColumnNumber,
- LineSect, LineOff, LineLength, SrcFileId, Modi);
+ LineSect, LineOff, LineLength, SrcFileId, Modi);
LineNumbers.push_back(LineNum);
++LineIter;
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
index da44463f39..5f4f497690 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
@@ -25,7 +25,7 @@
#include "llvm/Support/Error.h"
#include <algorithm>
#include <cstdint>
-#include <numeric>
+#include <numeric>
using namespace llvm;
using namespace llvm::msf;
@@ -42,58 +42,58 @@ void TpiStreamBuilder::setVersionHeader(PdbRaw_TpiVer Version) {
VerHeader = Version;
}
-void TpiStreamBuilder::updateTypeIndexOffsets(ArrayRef<uint16_t> Sizes) {
- // If we just crossed an 8KB threshold, add a type index offset.
- for (uint16_t Size : Sizes) {
- size_t NewSize = TypeRecordBytes + Size;
- constexpr size_t EightKB = 8 * 1024;
- if (NewSize / EightKB > TypeRecordBytes / EightKB || TypeRecordCount == 0) {
- TypeIndexOffsets.push_back(
- {codeview::TypeIndex(codeview::TypeIndex::FirstNonSimpleIndex +
- TypeRecordCount),
- ulittle32_t(TypeRecordBytes)});
- }
- ++TypeRecordCount;
- TypeRecordBytes = NewSize;
- }
-}
-
+void TpiStreamBuilder::updateTypeIndexOffsets(ArrayRef<uint16_t> Sizes) {
+ // If we just crossed an 8KB threshold, add a type index offset.
+ for (uint16_t Size : Sizes) {
+ size_t NewSize = TypeRecordBytes + Size;
+ constexpr size_t EightKB = 8 * 1024;
+ if (NewSize / EightKB > TypeRecordBytes / EightKB || TypeRecordCount == 0) {
+ TypeIndexOffsets.push_back(
+ {codeview::TypeIndex(codeview::TypeIndex::FirstNonSimpleIndex +
+ TypeRecordCount),
+ ulittle32_t(TypeRecordBytes)});
+ }
+ ++TypeRecordCount;
+ TypeRecordBytes = NewSize;
+ }
+}
+
void TpiStreamBuilder::addTypeRecord(ArrayRef<uint8_t> Record,
Optional<uint32_t> Hash) {
assert(((Record.size() & 3) == 0) &&
"The type record's size is not a multiple of 4 bytes which will "
"cause misalignment in the output TPI stream!");
- assert(Record.size() <= codeview::MaxRecordLength);
- uint16_t OneSize = (uint16_t)Record.size();
- updateTypeIndexOffsets(makeArrayRef(&OneSize, 1));
+ assert(Record.size() <= codeview::MaxRecordLength);
+ uint16_t OneSize = (uint16_t)Record.size();
+ updateTypeIndexOffsets(makeArrayRef(&OneSize, 1));
- TypeRecBuffers.push_back(Record);
- // FIXME: Require it.
+ TypeRecBuffers.push_back(Record);
+ // FIXME: Require it.
if (Hash)
TypeHashes.push_back(*Hash);
}
-void TpiStreamBuilder::addTypeRecords(ArrayRef<uint8_t> Types,
- ArrayRef<uint16_t> Sizes,
- ArrayRef<uint32_t> Hashes) {
- // Ignore empty type buffers. There should be no hashes or sizes in this case.
- if (Types.empty()) {
- assert(Sizes.empty() && Hashes.empty());
- return;
- }
-
- assert(((Types.size() & 3) == 0) &&
- "The type record's size is not a multiple of 4 bytes which will "
- "cause misalignment in the output TPI stream!");
- assert(Sizes.size() == Hashes.size() && "sizes and hashes should be in sync");
- assert(std::accumulate(Sizes.begin(), Sizes.end(), 0U) == Types.size() &&
- "sizes of type records should sum to the size of the types");
- updateTypeIndexOffsets(Sizes);
-
- TypeRecBuffers.push_back(Types);
- llvm::append_range(TypeHashes, Hashes);
-}
-
+void TpiStreamBuilder::addTypeRecords(ArrayRef<uint8_t> Types,
+ ArrayRef<uint16_t> Sizes,
+ ArrayRef<uint32_t> Hashes) {
+ // Ignore empty type buffers. There should be no hashes or sizes in this case.
+ if (Types.empty()) {
+ assert(Sizes.empty() && Hashes.empty());
+ return;
+ }
+
+ assert(((Types.size() & 3) == 0) &&
+ "The type record's size is not a multiple of 4 bytes which will "
+ "cause misalignment in the output TPI stream!");
+ assert(Sizes.size() == Hashes.size() && "sizes and hashes should be in sync");
+ assert(std::accumulate(Sizes.begin(), Sizes.end(), 0U) == Types.size() &&
+ "sizes of type records should sum to the size of the types");
+ updateTypeIndexOffsets(Sizes);
+
+ TypeRecBuffers.push_back(Types);
+ llvm::append_range(TypeHashes, Hashes);
+}
+
Error TpiStreamBuilder::finalize() {
if (Header)
return Error::success();
@@ -103,7 +103,7 @@ Error TpiStreamBuilder::finalize() {
H->Version = VerHeader;
H->HeaderSize = sizeof(TpiStreamHeader);
H->TypeIndexBegin = codeview::TypeIndex::FirstNonSimpleIndex;
- H->TypeIndexEnd = H->TypeIndexBegin + TypeRecordCount;
+ H->TypeIndexEnd = H->TypeIndexBegin + TypeRecordCount;
H->TypeRecordBytes = TypeRecordBytes;
H->HashStreamIndex = HashStreamIndex;
@@ -134,7 +134,7 @@ uint32_t TpiStreamBuilder::calculateSerializedLength() {
}
uint32_t TpiStreamBuilder::calculateHashBufferSize() const {
- assert((TypeRecordCount == TypeHashes.size() || TypeHashes.empty()) &&
+ assert((TypeRecordCount == TypeHashes.size() || TypeHashes.empty()) &&
"either all or no type records should have hashes");
return TypeHashes.size() * sizeof(ulittle32_t);
}
@@ -185,7 +185,7 @@ Error TpiStreamBuilder::commit(const msf::MSFLayout &Layout,
if (auto EC = Writer.writeObject(*Header))
return EC;
- for (auto Rec : TypeRecBuffers) {
+ for (auto Rec : TypeRecBuffers) {
assert(!Rec.empty() && "Attempting to write an empty type record shifts "
"all offsets in the TPI stream!");
assert(((Rec.size() & 3) == 0) &&
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDB.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDB.cpp
index 50e48bfbdb..6dc42715fb 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDB.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDB.cpp
@@ -11,7 +11,7 @@
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#if LLVM_ENABLE_DIA_SDK
-#error #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#error #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
#endif
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/Support/Error.h"
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBContext.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBContext.cpp
index 2fca37dd38..0ebb70e010 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBContext.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBContext.cpp
@@ -86,43 +86,43 @@ DIInliningInfo
PDBContext::getInliningInfoForAddress(object::SectionedAddress Address,
DILineInfoSpecifier Specifier) {
DIInliningInfo InlineInfo;
- DILineInfo CurrentLine = getLineInfoForAddress(Address, Specifier);
-
- // Find the function at this address.
- std::unique_ptr<PDBSymbol> ParentFunc =
- Session->findSymbolByAddress(Address.Address, PDB_SymType::Function);
- if (!ParentFunc) {
- InlineInfo.addFrame(CurrentLine);
- return InlineInfo;
- }
-
- auto Frames = ParentFunc->findInlineFramesByVA(Address.Address);
- if (!Frames || Frames->getChildCount() == 0) {
- InlineInfo.addFrame(CurrentLine);
- return InlineInfo;
- }
-
- while (auto Frame = Frames->getNext()) {
- uint32_t Length = 1;
- auto LineNumbers = Frame->findInlineeLinesByVA(Address.Address, Length);
- if (!LineNumbers || LineNumbers->getChildCount() == 0)
- break;
-
- std::unique_ptr<IPDBLineNumber> Line = LineNumbers->getNext();
- assert(Line);
-
- DILineInfo LineInfo;
- LineInfo.FunctionName = Frame->getName();
- auto SourceFile = Session->getSourceFileById(Line->getSourceFileId());
- if (SourceFile &&
- Specifier.FLIKind != DILineInfoSpecifier::FileLineInfoKind::None)
- LineInfo.FileName = SourceFile->getFileName();
- LineInfo.Line = Line->getLineNumber();
- LineInfo.Column = Line->getColumnNumber();
- InlineInfo.addFrame(LineInfo);
- }
-
- InlineInfo.addFrame(CurrentLine);
+ DILineInfo CurrentLine = getLineInfoForAddress(Address, Specifier);
+
+ // Find the function at this address.
+ std::unique_ptr<PDBSymbol> ParentFunc =
+ Session->findSymbolByAddress(Address.Address, PDB_SymType::Function);
+ if (!ParentFunc) {
+ InlineInfo.addFrame(CurrentLine);
+ return InlineInfo;
+ }
+
+ auto Frames = ParentFunc->findInlineFramesByVA(Address.Address);
+ if (!Frames || Frames->getChildCount() == 0) {
+ InlineInfo.addFrame(CurrentLine);
+ return InlineInfo;
+ }
+
+ while (auto Frame = Frames->getNext()) {
+ uint32_t Length = 1;
+ auto LineNumbers = Frame->findInlineeLinesByVA(Address.Address, Length);
+ if (!LineNumbers || LineNumbers->getChildCount() == 0)
+ break;
+
+ std::unique_ptr<IPDBLineNumber> Line = LineNumbers->getNext();
+ assert(Line);
+
+ DILineInfo LineInfo;
+ LineInfo.FunctionName = Frame->getName();
+ auto SourceFile = Session->getSourceFileById(Line->getSourceFileId());
+ if (SourceFile &&
+ Specifier.FLIKind != DILineInfoSpecifier::FileLineInfoKind::None)
+ LineInfo.FileName = SourceFile->getFileName();
+ LineInfo.Line = Line->getLineNumber();
+ LineInfo.Column = Line->getColumnNumber();
+ InlineInfo.addFrame(LineInfo);
+ }
+
+ InlineInfo.addFrame(CurrentLine);
return InlineInfo;
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBExtras.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBExtras.cpp
index 1be88c16a5..25962e5152 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -118,22 +118,22 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
const llvm::codeview::CPURegister &CpuReg) {
- if (CpuReg.Cpu == llvm::codeview::CPUType::ARMNT) {
+ if (CpuReg.Cpu == llvm::codeview::CPUType::ARMNT) {
+ switch (CpuReg.Reg) {
+#define CV_REGISTERS_ARM
+#define CV_REGISTER(name, val) \
+ case codeview::RegisterId::name: \
+ OS << #name; \
+ return OS;
+#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
+#undef CV_REGISTER
+#undef CV_REGISTERS_ARM
+
+ default:
+ break;
+ }
+ } else if (CpuReg.Cpu == llvm::codeview::CPUType::ARM64) {
switch (CpuReg.Reg) {
-#define CV_REGISTERS_ARM
-#define CV_REGISTER(name, val) \
- case codeview::RegisterId::name: \
- OS << #name; \
- return OS;
-#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
-#undef CV_REGISTER
-#undef CV_REGISTERS_ARM
-
- default:
- break;
- }
- } else if (CpuReg.Cpu == llvm::codeview::CPUType::ARM64) {
- switch (CpuReg.Reg) {
#define CV_REGISTERS_ARM64
#define CV_REGISTER(name, val) \
case codeview::RegisterId::name: \
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
index 325e937dac..d51091d809 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
@@ -1,4 +1,4 @@
-//===- PDBInterfaceAnchors.h - defines class anchor functions ---*- C++ -*-===//
+//===- PDBInterfaceAnchors.h - defines class anchor functions ---*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// Class anchors are necessary per the LLVM Coding style guide, to ensure that
// the vtable is only generated in this object file, and not in every object
-// file that includes the corresponding header.
+// file that includes the corresponding header.
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBSymbol.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBSymbol.cpp
index c60065b9cc..d6bc7ee9c9 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBSymbol.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/PDBSymbol.cpp
@@ -161,27 +161,27 @@ PDBSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
}
std::unique_ptr<IPDBEnumSymbols>
-PDBSymbol::findInlineFramesByVA(uint64_t VA) const {
- return RawSymbol->findInlineFramesByVA(VA);
-}
-
-std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::findInlineFramesByVA(uint64_t VA) const {
+ return RawSymbol->findInlineFramesByVA(VA);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
PDBSymbol::findInlineFramesByRVA(uint32_t RVA) const {
return RawSymbol->findInlineFramesByRVA(RVA);
}
-std::unique_ptr<IPDBEnumLineNumbers>
-PDBSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const {
- return RawSymbol->findInlineeLinesByVA(VA, Length);
-}
-
-std::unique_ptr<IPDBEnumLineNumbers>
-PDBSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const {
- return RawSymbol->findInlineeLinesByRVA(RVA, Length);
-}
-
-std::string PDBSymbol::getName() const { return RawSymbol->getName(); }
-
+std::unique_ptr<IPDBEnumLineNumbers>
+PDBSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const {
+ return RawSymbol->findInlineeLinesByVA(VA, Length);
+}
+
+std::unique_ptr<IPDBEnumLineNumbers>
+PDBSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const {
+ return RawSymbol->findInlineeLinesByRVA(RVA, Length);
+}
+
+std::string PDBSymbol::getName() const { return RawSymbol->getName(); }
+
std::unique_ptr<IPDBEnumSymbols>
PDBSymbol::getChildStats(TagStats &Stats) const {
std::unique_ptr<IPDBEnumSymbols> Result(findAllChildren());
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/UDTLayout.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/UDTLayout.cpp
index b6e5fe2612..55854bb498 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/UDTLayout.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/UDTLayout.cpp
@@ -289,10 +289,10 @@ void UDTLayoutBase::addChildToLayout(std::unique_ptr<LayoutItemBase> Child) {
UsedBytes |= ChildBytes;
if (ChildBytes.count() > 0) {
- auto Loc = llvm::upper_bound(
- LayoutItems, Begin, [](uint32_t Off, const LayoutItemBase *Item) {
- return (Off < Item->getOffsetInParent());
- });
+ auto Loc = llvm::upper_bound(
+ LayoutItems, Begin, [](uint32_t Off, const LayoutItemBase *Item) {
+ return (Off < Item->getOffsetInParent());
+ });
LayoutItems.insert(Loc, Child.get());
}
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/ya.make b/contrib/libs/llvm12/lib/DebugInfo/PDB/ya.make
index 6a5df3009b..daa2f8ed3a 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/PDB/ya.make
+++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/ya.make
@@ -12,12 +12,12 @@ LICENSE(Apache-2.0 WITH LLVM-exception)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
PEERDIR(
- contrib/libs/llvm12
- contrib/libs/llvm12/lib/BinaryFormat
- contrib/libs/llvm12/lib/DebugInfo/CodeView
- contrib/libs/llvm12/lib/DebugInfo/MSF
- contrib/libs/llvm12/lib/Object
- contrib/libs/llvm12/lib/Support
+ contrib/libs/llvm12
+ contrib/libs/llvm12/lib/BinaryFormat
+ contrib/libs/llvm12/lib/DebugInfo/CodeView
+ contrib/libs/llvm12/lib/DebugInfo/MSF
+ contrib/libs/llvm12/lib/Object
+ contrib/libs/llvm12/lib/Support
)
ADDINCL(
@@ -51,11 +51,11 @@ SRCS(
Native/NativeEnumInjectedSources.cpp
Native/NativeEnumLineNumbers.cpp
Native/NativeEnumModules.cpp
- Native/NativeEnumSymbols.cpp
+ Native/NativeEnumSymbols.cpp
Native/NativeEnumTypes.cpp
Native/NativeExeSymbol.cpp
Native/NativeFunctionSymbol.cpp
- Native/NativeInlineSiteSymbol.cpp
+ Native/NativeInlineSiteSymbol.cpp
Native/NativeLineNumber.cpp
Native/NativePublicSymbol.cpp
Native/NativeRawSymbol.cpp