aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/SymbolFile
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r--lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp29
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp10
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h13
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt1
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp62
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp13
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h31
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h8
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp19
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h13
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp51
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h13
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp60
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp11
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp8
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp100
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h34
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp5
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp5
25 files changed, 401 insertions, 109 deletions
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 81c6731..591fded 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -738,9 +738,29 @@ size_t SymbolFileCTF::ParseTypes(CompileUnit &cu) {
LLDB_LOG(log, "Parsed {0} CTF types", m_ctf_types.size());
- for (lldb::user_id_t uid = 1; uid < type_uid; ++uid)
+ for (lldb::user_id_t uid = 1; uid < type_uid; ++uid) {
ResolveTypeUID(uid);
+ // Remove the CTF type because we don't need it anymore, except for record
+ // types which we may need to complete later.
+ auto ctf_type_it = m_ctf_types.find(uid);
+ if (ctf_type_it != m_ctf_types.end()) {
+ CTFType *ctf_type = ctf_type_it->second.get();
+ if (!llvm::isa<CTFRecord>(ctf_type))
+ m_ctf_types.erase(uid);
+ }
+ }
+
+#ifndef NDEBUG
+ // Verify that the only CTF types left at this point are record types.
+ for (auto &t : m_ctf_types) {
+ CTFType *ctf_type = t.second.get();
+ assert(ctf_type && "invalid type in m_ctf_types");
+ assert(llvm::isa<CTFRecord>(ctf_type) && "leaking non record type");
+ }
+
+#endif
+
LLDB_LOG(log, "Created {0} CTF types", m_types.size());
return m_types.size();
@@ -994,6 +1014,8 @@ lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) {
CTFType *ctf_type = ctf_type_it->second.get();
assert(ctf_type && "m_ctf_types should only contain valid CTF types");
+ assert(ctf_type->uid == type_uid &&
+ "CTF type UID doesn't match UID in m_ctf_types");
Log *log = GetLog(LLDBLog::Symbols);
@@ -1015,11 +1037,6 @@ lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) {
m_types[type_uid] = type_sp;
- // Except for record types which we'll need to complete later, we don't need
- // the CTF type anymore.
- if (!isa<CTFRecord>(ctf_type))
- m_ctf_types.erase(type_uid);
-
return type_sp.get();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index 4bfbb4d..9762ead 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Function.h"
+#include "lldb/lldb-private-enumerations.h"
#include "llvm/Support/DJB.h"
using namespace lldb;
@@ -275,7 +276,7 @@ void AppleDWARFIndex::GetNamespaces(
void AppleDWARFIndex::GetFunctions(
const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
@@ -288,15 +289,16 @@ void AppleDWARFIndex::GetFunctions(
ReportInvalidDIERef(die_ref, name);
continue;
}
- if (!ProcessFunctionDIE(lookup_info, die, parent_decl_ctx, callback))
+ if (ProcessFunctionDIE(lookup_info, die, parent_decl_ctx, callback) ==
+ IterationAction::Stop)
return;
}
}
void AppleDWARFIndex::GetFunctions(
const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
- return GetGlobalVariables(regex, callback);
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ return GetGlobalVariables(regex, IterationActionAdaptor(callback));
}
void AppleDWARFIndex::Dump(Stream &s) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
index 73de75b..c0f0eb6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
@@ -61,12 +61,13 @@ public:
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetNamespaces(ConstString name,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const Module::LookupInfo &lookup_info,
- SymbolFileDWARF &dwarf,
- const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
+ const CompilerDeclContext &parent_decl_ctx,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const RegularExpression &regex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void Dump(Stream &s) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index 212cc36..c3f1bb5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -35,6 +35,7 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
SymbolFileDWARF.cpp
SymbolFileDWARFDwo.cpp
SymbolFileDWARFDebugMap.cpp
+ SymbolFileWasm.cpp
UniqueDWARFASTType.cpp
LINK_COMPONENTS
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index ba65f50..781c1c6c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -24,6 +24,7 @@
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Value.h"
+#include "lldb/Expression/Expression.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
@@ -249,6 +250,47 @@ static unsigned GetCXXMethodCVQuals(const DWARFDIE &subprogram,
return cv_quals;
}
+static std::string MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
+ char const *name = die.GetMangledName(/*substitute_name_allowed*/ false);
+ if (!name)
+ return {};
+
+ SymbolFileDWARF *dwarf = die.GetDWARF();
+ if (!dwarf)
+ return {};
+
+ auto get_module_id = [&](SymbolFile *sym) {
+ if (!sym)
+ return LLDB_INVALID_UID;
+
+ auto *obj = sym->GetMainObjectFile();
+ if (!obj)
+ return LLDB_INVALID_UID;
+
+ auto module_sp = obj->GetModule();
+ if (!module_sp)
+ return LLDB_INVALID_UID;
+
+ return module_sp->GetID();
+ };
+
+ lldb::user_id_t module_id = get_module_id(dwarf->GetDebugMapSymfile());
+ if (module_id == LLDB_INVALID_UID)
+ module_id = get_module_id(dwarf);
+
+ if (module_id == LLDB_INVALID_UID)
+ return {};
+
+ const auto die_id = die.GetID();
+ if (die_id == LLDB_INVALID_UID)
+ return {};
+
+ return FunctionCallLabel{/*module_id=*/module_id,
+ /*symbol_id=*/die_id,
+ /*.lookup_name=*/name}
+ .toString();
+}
+
TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc,
const DWARFDIE &die,
Log *log) {
@@ -1231,7 +1273,7 @@ std::pair<bool, TypeSP> DWARFASTParserClang::ParseCXXMethod(
clang::CXXMethodDecl *cxx_method_decl = m_ast.AddMethodToCXXRecordType(
class_opaque_type.GetOpaqueQualType(), attrs.name.GetCString(),
- attrs.mangled_name, clang_type, accessibility, attrs.is_virtual,
+ MakeLLDBFuncAsmLabel(die), clang_type, accessibility, attrs.is_virtual,
is_static, attrs.is_inline, attrs.is_explicit, is_attr_used,
attrs.is_artificial);
@@ -1384,7 +1426,7 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
ignore_containing_context ? m_ast.GetTranslationUnitDecl()
: containing_decl_ctx,
GetOwningClangModule(die), name, clang_type, attrs.storage,
- attrs.is_inline);
+ attrs.is_inline, MakeLLDBFuncAsmLabel(die));
std::free(name_buf);
if (has_template_params) {
@@ -1394,7 +1436,7 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
ignore_containing_context ? m_ast.GetTranslationUnitDecl()
: containing_decl_ctx,
GetOwningClangModule(die), attrs.name.GetStringRef(), clang_type,
- attrs.storage, attrs.is_inline);
+ attrs.storage, attrs.is_inline, /*asm_label=*/{});
clang::FunctionTemplateDecl *func_template_decl =
m_ast.CreateFunctionTemplateDecl(
containing_decl_ctx, GetOwningClangModule(die),
@@ -1406,20 +1448,6 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
lldbassert(function_decl);
if (function_decl) {
- // Attach an asm(<mangled_name>) label to the FunctionDecl.
- // This ensures that clang::CodeGen emits function calls
- // using symbols that are mangled according to the DW_AT_linkage_name.
- // If we didn't do this, the external symbols wouldn't exactly
- // match the mangled name LLDB knows about and the IRExecutionUnit
- // would have to fall back to searching object files for
- // approximately matching function names. The motivating
- // example is generating calls to ABI-tagged template functions.
- // This is done separately for member functions in
- // AddMethodToCXXRecordType.
- if (attrs.mangled_name)
- function_decl->addAttr(clang::AsmLabelAttr::CreateImplicit(
- m_ast.getASTContext(), attrs.mangled_name, /*literal=*/false));
-
LinkDeclContextToDIE(function_decl, die);
const clang::FunctionProtoType *function_prototype(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
index 30c890d..a806506 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
@@ -16,6 +16,7 @@
#include "lldb/Core/Mangled.h"
#include "lldb/Core/Module.h"
#include "lldb/Target/Language.h"
+#include "lldb/lldb-private-enumerations.h"
using namespace lldb_private;
using namespace lldb;
@@ -23,10 +24,10 @@ using namespace lldb_private::plugin::dwarf;
DWARFIndex::~DWARFIndex() = default;
-bool DWARFIndex::ProcessFunctionDIE(
+IterationAction DWARFIndex::ProcessFunctionDIE(
const Module::LookupInfo &lookup_info, DWARFDIE die,
const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
llvm::StringRef name = lookup_info.GetLookupName().GetStringRef();
FunctionNameType name_type_mask = lookup_info.GetNameTypeMask();
@@ -43,7 +44,7 @@ bool DWARFIndex::ProcessFunctionDIE(
if (!lookup_info.NameMatchesLookupInfo(name_to_match_against,
lookup_info.GetLanguageType()))
- return true;
+ return IterationAction::Continue;
}
// Exit early if we're searching exclusively for methods or selectors and
@@ -51,12 +52,12 @@ bool DWARFIndex::ProcessFunctionDIE(
uint32_t looking_for_nonmethods =
name_type_mask & ~(eFunctionNameTypeMethod | eFunctionNameTypeSelector);
if (!looking_for_nonmethods && parent_decl_ctx.IsValid())
- return true;
+ return IterationAction::Continue;
// Otherwise, we need to also check that the context matches. If it does not
// match, we do nothing.
if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx, die))
- return true;
+ return IterationAction::Continue;
// In case of a full match, we just insert everything we find.
if (name_type_mask & eFunctionNameTypeFull && die.GetMangledName() == name)
@@ -79,7 +80,7 @@ bool DWARFIndex::ProcessFunctionDIE(
return callback(die);
}
- return true;
+ return IterationAction::Continue;
}
DWARFIndex::DIERefCallbackImpl::DIERefCallbackImpl(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
index 15d8503..3578824 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
@@ -16,6 +16,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Target/Statistics.h"
+#include "lldb/lldb-private-enumerations.h"
namespace lldb_private::plugin {
namespace dwarf {
@@ -82,10 +83,10 @@ public:
virtual void
GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
virtual void
GetFunctions(const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
virtual void Dump(Stream &s) = 0;
@@ -101,9 +102,10 @@ protected:
/// the function given by "die" matches search criteria given by
/// "parent_decl_ctx" and "name_type_mask", it calls the callback with the
/// given die.
- bool ProcessFunctionDIE(const Module::LookupInfo &lookup_info, DWARFDIE die,
- const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback);
+ IterationAction ProcessFunctionDIE(
+ const Module::LookupInfo &lookup_info, DWARFDIE die,
+ const CompilerDeclContext &parent_decl_ctx,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback);
class DIERefCallbackImpl {
public:
@@ -140,6 +142,25 @@ protected:
bool ProcessNamespaceDieMatchParents(
const CompilerDeclContext &parent_decl_ctx, DWARFDIE die,
llvm::function_ref<bool(DWARFDIE die)> callback);
+
+ /// Helper to convert callbacks that return an \c IterationAction
+ /// to a callback that returns a \c bool, where \c true indicates
+ /// we should continue iterating. This will be used to incrementally
+ /// migrate the callbacks to return an \c IterationAction.
+ ///
+ /// FIXME: remove once all callbacks in the DWARFIndex APIs return
+ /// IterationAction.
+ struct IterationActionAdaptor {
+ IterationActionAdaptor(
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback)
+ : m_callback_ref(callback) {}
+
+ bool operator()(DWARFDIE die) {
+ return m_callback_ref(std::move(die)) == IterationAction::Continue;
+ }
+
+ llvm::function_ref<IterationAction(DWARFDIE die)> m_callback_ref;
+ };
};
} // namespace dwarf
} // namespace lldb_private::plugin
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index a66af5b..94fc2e83 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -736,9 +736,11 @@ DWARFUnit::GetVendorDWARFOpcodeSize(const DataExtractor &data,
bool DWARFUnit::ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset,
+ RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
std::vector<Value> &stack) const {
return GetSymbolFileDWARF().ParseVendorDWARFOpcode(op, opcodes, offset,
- stack);
+ reg_ctx, reg_kind, stack);
}
bool DWARFUnit::ParseDWARFLocationList(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index f55400e..91a6938 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -164,9 +164,11 @@ public:
const lldb::offset_t data_offset,
const uint8_t op) const override;
- bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
- lldb::offset_t &offset,
- std::vector<Value> &stack) const override;
+ virtual bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
+ lldb::offset_t &offset,
+ RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
+ std::vector<Value> &stack) const override;
bool ParseDWARFLocationList(const DataExtractor &data,
DWARFExpressionList &loc_list) const;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index ff1a76b..3ae9fcc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -14,6 +14,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-private-enumerations.h"
#include "llvm/ADT/Sequence.h"
#include <optional>
@@ -607,7 +608,7 @@ void DebugNamesDWARFIndex::GetNamespacesWithParents(
void DebugNamesDWARFIndex::GetFunctions(
const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
ConstString name = lookup_info.GetLookupName();
std::set<DWARFDebugInfoEntry *> seen;
for (const DebugNames::Entry &entry :
@@ -617,12 +618,12 @@ void DebugNamesDWARFIndex::GetFunctions(
continue;
if (DWARFDIE die = GetDIE(entry)) {
- if (!ProcessFunctionDIE(lookup_info, die, parent_decl_ctx,
- [&](DWARFDIE die) {
- if (!seen.insert(die.GetDIE()).second)
- return true;
- return callback(die);
- }))
+ if (ProcessFunctionDIE(lookup_info, die, parent_decl_ctx,
+ [&](DWARFDIE die) {
+ if (!seen.insert(die.GetDIE()).second)
+ return IterationAction::Continue;
+ return callback(die);
+ }) == IterationAction::Stop)
return;
}
}
@@ -632,7 +633,7 @@ void DebugNamesDWARFIndex::GetFunctions(
void DebugNamesDWARFIndex::GetFunctions(
const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
for (DebugNames::NameTableEntry nte: ni) {
if (!regex.Execute(nte.getString()))
@@ -645,7 +646,7 @@ void DebugNamesDWARFIndex::GetFunctions(
if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine)
continue;
- if (!ProcessEntry(*entry_or, callback))
+ if (!ProcessEntry(*entry_or, IterationActionAdaptor(callback)))
return;
}
MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index ab6cde1..2105919 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -58,12 +58,13 @@ public:
void GetNamespacesWithParents(
ConstString name, const CompilerDeclContext &parent_decl_ctx,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const Module::LookupInfo &lookup_info,
- SymbolFileDWARF &dwarf,
- const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
+ const CompilerDeclContext &parent_decl_ctx,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const RegularExpression &regex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void Dump(Stream &s) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index c858ce2..f96ac7e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -21,6 +21,7 @@
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
+#include "lldb/lldb-private-enumerations.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ThreadPool.h"
#include <atomic>
@@ -471,60 +472,62 @@ void ManualDWARFIndex::GetNamespaces(
void ManualDWARFIndex::GetFunctions(
const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
ConstString name = lookup_info.GetLookupName();
FunctionNameType name_type_mask = lookup_info.GetNameTypeMask();
if (name_type_mask & eFunctionNameTypeFull) {
if (!m_set.function_fullnames.Find(
- name, DIERefCallback(
- [&](DWARFDIE die) {
- if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx,
- die))
- return true;
- return callback(die);
- },
- name.GetStringRef())))
+ name, DIERefCallback(IterationActionAdaptor([&](DWARFDIE die) {
+ if (!SymbolFileDWARF::DIEInDeclContext(
+ parent_decl_ctx, die))
+ return IterationAction::Continue;
+ return callback(die);
+ }),
+ name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeBase) {
if (!m_set.function_basenames.Find(
- name, DIERefCallback(
- [&](DWARFDIE die) {
- if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx,
- die))
- return true;
- return callback(die);
- },
- name.GetStringRef())))
+ name, DIERefCallback(IterationActionAdaptor([&](DWARFDIE die) {
+ if (!SymbolFileDWARF::DIEInDeclContext(
+ parent_decl_ctx, die))
+ return IterationAction::Continue;
+ return callback(die);
+ }),
+ name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeMethod && !parent_decl_ctx.IsValid()) {
if (!m_set.function_methods.Find(
- name, DIERefCallback(callback, name.GetStringRef())))
+ name, DIERefCallback(IterationActionAdaptor(callback),
+ name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeSelector &&
!parent_decl_ctx.IsValid()) {
if (!m_set.function_selectors.Find(
- name, DIERefCallback(callback, name.GetStringRef())))
+ name, DIERefCallback(IterationActionAdaptor(callback),
+ name.GetStringRef())))
return;
}
}
void ManualDWARFIndex::GetFunctions(
const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) {
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
- if (!m_set.function_basenames.Find(regex,
- DIERefCallback(callback, regex.GetText())))
+ if (!m_set.function_basenames.Find(
+ regex,
+ DIERefCallback(IterationActionAdaptor(callback), regex.GetText())))
return;
- if (!m_set.function_fullnames.Find(regex,
- DIERefCallback(callback, regex.GetText())))
+ if (!m_set.function_fullnames.Find(
+ regex,
+ DIERefCallback(IterationActionAdaptor(callback), regex.GetText())))
return;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
index 04627b0..5685ba4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
@@ -50,12 +50,13 @@ public:
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetNamespaces(ConstString name,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const Module::LookupInfo &lookup_info,
- SymbolFileDWARF &dwarf,
- const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetFunctions(const RegularExpression &regex,
- llvm::function_ref<bool(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
+ const CompilerDeclContext &parent_decl_ctx,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetFunctions(
+ const RegularExpression &regex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void Dump(Stream &s) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 4b4a582..a3ba061 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -41,6 +41,7 @@
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileWasm.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -73,6 +74,7 @@
#include "ManualDWARFIndex.h"
#include "SymbolFileDWARFDebugMap.h"
#include "SymbolFileDWARFDwo.h"
+#include "lldb/lldb-private-enumerations.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
@@ -327,6 +329,9 @@ llvm::StringRef SymbolFileDWARF::GetPluginDescriptionStatic() {
}
SymbolFile *SymbolFileDWARF::CreateInstance(ObjectFileSP objfile_sp) {
+ if (objfile_sp->GetArchitecture().GetTriple().isWasm())
+ return new SymbolFileWasm(std::move(objfile_sp),
+ /*dwo_section_list*/ nullptr);
return new SymbolFileDWARF(std::move(objfile_sp),
/*dwo_section_list*/ nullptr);
}
@@ -2471,6 +2476,55 @@ bool SymbolFileDWARF::ResolveFunction(const DWARFDIE &orig_die,
return false;
}
+llvm::Expected<SymbolContext>
+SymbolFileDWARF::ResolveFunctionCallLabel(const FunctionCallLabel &label) {
+ std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
+
+ DWARFDIE die = GetDIE(label.symbol_id);
+ if (!die.IsValid())
+ return llvm::createStringError(
+ llvm::formatv("invalid DIE ID in {0}", label));
+
+ // Label was created using a declaration DIE. Need to fetch the definition
+ // to resolve the function call.
+ if (die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0)) {
+ Module::LookupInfo info(ConstString(label.lookup_name),
+ lldb::eFunctionNameTypeFull,
+ lldb::eLanguageTypeUnknown);
+
+ m_index->GetFunctions(info, *this, {}, [&](DWARFDIE entry) {
+ if (entry.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0))
+ return IterationAction::Continue;
+
+ // We don't check whether the specification DIE for this function
+ // corresponds to the declaration DIE because the declaration might be in
+ // a type-unit but the definition in the compile-unit (and it's
+ // specifcation would point to the declaration in the compile-unit). We
+ // rely on the mangled name within the module to be enough to find us the
+ // unique definition.
+ die = entry;
+ return IterationAction::Stop;
+ });
+
+ if (die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0))
+ return llvm::createStringError(
+ llvm::formatv("failed to find definition DIE for {0}", label));
+ }
+
+ SymbolContextList sc_list;
+ if (!ResolveFunction(die, /*include_inlines=*/false, sc_list))
+ return llvm::createStringError(
+ llvm::formatv("failed to resolve function for {0}", label));
+
+ if (sc_list.IsEmpty())
+ return llvm::createStringError(
+ llvm::formatv("failed to find function for {0}", label));
+
+ assert(sc_list.GetSize() == 1);
+
+ return sc_list[0];
+}
+
bool SymbolFileDWARF::DIEInDeclContext(const CompilerDeclContext &decl_ctx,
const DWARFDIE &die,
bool only_root_namespaces) {
@@ -2535,7 +2589,7 @@ void SymbolFileDWARF::FindFunctions(const Module::LookupInfo &lookup_info,
m_index->GetFunctions(lookup_info, *this, parent_decl_ctx, [&](DWARFDIE die) {
if (resolved_dies.insert(die.GetDIE()).second)
ResolveFunction(die, include_inlines, sc_list);
- return true;
+ return IterationAction::Continue;
});
// With -gsimple-template-names, a templated type's DW_AT_name will not
// contain the template parameters. Try again stripping '<' and anything
@@ -2552,7 +2606,7 @@ void SymbolFileDWARF::FindFunctions(const Module::LookupInfo &lookup_info,
[&](DWARFDIE die) {
if (resolved_dies.insert(die.GetDIE()).second)
ResolveFunction(die, include_inlines, sc_list);
- return true;
+ return IterationAction::Continue;
});
}
}
@@ -2588,7 +2642,7 @@ void SymbolFileDWARF::FindFunctions(const RegularExpression &regex,
m_index->GetFunctions(regex, [&](DWARFDIE die) {
if (resolved_dies.insert(die.GetDIE()).second)
ResolveFunction(die, include_inlines, sc_list);
- return true;
+ return IterationAction::Continue;
});
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 2dc862c..3ec538d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -329,6 +329,8 @@ public:
virtual bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset,
+ RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
std::vector<Value> &stack) const {
return false;
}
@@ -434,6 +436,9 @@ protected:
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die,
DIEArray &&variable_dies);
+ llvm::Expected<SymbolContext>
+ ResolveFunctionCallLabel(const FunctionCallLabel &label) override;
+
// Given a die_offset, figure out the symbol context representing that die.
bool ResolveFunction(const DWARFDIE &die, bool include_inlines,
SymbolContextList &sc_list);
@@ -556,6 +561,7 @@ protected:
/// an index that identifies the .DWO or .o file.
std::optional<uint64_t> m_file_index;
};
+
} // namespace dwarf
} // namespace lldb_private::plugin
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index dd94f0b..9d7452a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1602,3 +1602,14 @@ void SymbolFileDWARFDebugMap::GetCompileOptions(
return IterationAction::Continue;
});
}
+
+llvm::Expected<SymbolContext> SymbolFileDWARFDebugMap::ResolveFunctionCallLabel(
+ const FunctionCallLabel &label) {
+ const uint64_t oso_idx = GetOSOIndexFromUserID(label.symbol_id);
+ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
+ if (!oso_dwarf)
+ return llvm::createStringError(llvm::formatv(
+ "couldn't find symbol file for {0} in debug-map.", label));
+
+ return oso_dwarf->ResolveFunctionCallLabel(label);
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index f074b17..e1f1df23 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -144,6 +144,9 @@ public:
void
GetCompileOptions(std::unordered_map<lldb::CompUnitSP, Args> &args) override;
+ llvm::Expected<SymbolContext>
+ ResolveFunctionCallLabel(const FunctionCallLabel &label) override;
+
protected:
enum { kHaveInitializedOSOs = (1 << 0), kNumFlags };
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index c1829ab..52de3ab 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -97,9 +97,11 @@ uint64_t SymbolFileDWARFDwo::GetDebugInfoSize(bool load_all_debug_info) {
}
bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
- uint8_t op, const lldb_private::DataExtractor &opcodes,
- lldb::offset_t &offset, std::vector<lldb_private::Value> &stack) const {
- return GetBaseSymbolFile().ParseVendorDWARFOpcode(op, opcodes, offset, stack);
+ uint8_t op, const DataExtractor &opcodes, lldb::offset_t &offset,
+ RegisterContext *reg_ctx, lldb::RegisterKind reg_kind,
+ std::vector<Value> &stack) const {
+ return GetBaseSymbolFile().ParseVendorDWARFOpcode(op, opcodes, offset,
+ reg_ctx, reg_kind, stack);
}
llvm::DenseMap<const DWARFDebugInfoEntry *, Type *> &
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 75f5986..1ab6494 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -50,7 +50,8 @@ public:
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
- lldb::offset_t &offset,
+ lldb::offset_t &offset, RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
std::vector<Value> &stack) const override;
void FindGlobalVariables(ConstString name,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp
new file mode 100644
index 0000000..e25a89c
--- /dev/null
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "SymbolFileWasm.h"
+#include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
+#include "Utility/WasmVirtualRegisters.h"
+#include "lldb/Utility/LLDBLog.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::plugin::dwarf;
+
+SymbolFileWasm::SymbolFileWasm(ObjectFileSP objfile_sp,
+ SectionList *dwo_section_list)
+ : SymbolFileDWARF(objfile_sp, dwo_section_list) {}
+
+SymbolFileWasm::~SymbolFileWasm() = default;
+
+lldb::offset_t
+SymbolFileWasm::GetVendorDWARFOpcodeSize(const DataExtractor &data,
+ const lldb::offset_t data_offset,
+ const uint8_t op) const {
+ if (op != llvm::dwarf::DW_OP_WASM_location)
+ return LLDB_INVALID_OFFSET;
+
+ lldb::offset_t offset = data_offset;
+ const uint8_t wasm_op = data.GetU8(&offset);
+ switch (wasm_op) {
+ case 0: // LOCAL
+ case 1: // GLOBAL_FIXED
+ case 2: // OPERAND_STACK
+ data.GetULEB128(&offset);
+ break;
+ case 3: // GLOBAL_RELOC
+ data.GetU32(&offset);
+ break;
+ default:
+ return LLDB_INVALID_OFFSET;
+ }
+
+ return offset - data_offset;
+}
+
+bool SymbolFileWasm::ParseVendorDWARFOpcode(uint8_t op,
+ const DataExtractor &opcodes,
+ lldb::offset_t &offset,
+ RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
+ std::vector<Value> &stack) const {
+ if (op != llvm::dwarf::DW_OP_WASM_location)
+ return false;
+
+ uint32_t index = 0;
+ uint8_t tag = eWasmTagNotAWasmLocation;
+
+ /// |DWARF Location Index | WebAssembly Construct |
+ /// |---------------------|-----------------------|
+ /// |0 | Local |
+ /// |1 or 3 | Global |
+ /// |2 | Operand Stack |
+ const uint8_t wasm_op = opcodes.GetU8(&offset);
+ switch (wasm_op) {
+ case 0: // LOCAL
+ index = opcodes.GetULEB128(&offset);
+ tag = eWasmTagLocal;
+ break;
+ case 1: // GLOBAL_FIXED
+ index = opcodes.GetULEB128(&offset);
+ tag = eWasmTagGlobal;
+ break;
+ case 2: // OPERAND_STACK
+ index = opcodes.GetULEB128(&offset);
+ tag = eWasmTagOperandStack;
+ break;
+ case 3: // GLOBAL_RELOC
+ index = opcodes.GetU32(&offset);
+ tag = eWasmTagGlobal;
+ break;
+ default:
+ return false;
+ }
+
+ const uint32_t reg_num = GetWasmRegister(tag, index);
+
+ Value tmp;
+ llvm::Error error = DWARFExpression::ReadRegisterValueAsScalar(
+ reg_ctx, reg_kind, reg_num, tmp);
+ if (error) {
+ LLDB_LOG_ERROR(GetLog(DWARFLog::DebugInfo), std::move(error), "{0}");
+ return false;
+ }
+
+ stack.push_back(tmp);
+ return true;
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h
new file mode 100644
index 0000000..0e0b742
--- /dev/null
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEWASM_H
+#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEWASM_H
+
+#include "SymbolFileDWARF.h"
+
+namespace lldb_private::plugin {
+namespace dwarf {
+class SymbolFileWasm : public SymbolFileDWARF {
+public:
+ SymbolFileWasm(lldb::ObjectFileSP objfile_sp, SectionList *dwo_section_list);
+
+ ~SymbolFileWasm() override;
+
+ lldb::offset_t GetVendorDWARFOpcodeSize(const DataExtractor &data,
+ const lldb::offset_t data_offset,
+ const uint8_t op) const override;
+
+ bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
+ lldb::offset_t &offset, RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
+ std::vector<Value> &stack) const override;
+};
+} // namespace dwarf
+} // namespace lldb_private::plugin
+
+#endif
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 702ec5e..8137622 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -88,7 +88,7 @@ struct CreateMethodDecl : public TypeVisitorCallbacks {
MethodOptions::CompilerGenerated;
function_decl = m_clang.AddMethodToCXXRecordType(
parent_ty, proc_name,
- /*mangled_name=*/nullptr, func_ct, /*access=*/access_type,
+ /*asm_label=*/{}, func_ct, /*access=*/access_type,
/*is_virtual=*/is_virtual, /*is_static=*/is_static,
/*is_inline=*/false, /*is_explicit=*/false,
/*is_attr_used=*/false, /*is_artificial=*/is_artificial);
@@ -903,7 +903,7 @@ PdbAstBuilder::CreateFunctionDecl(PdbCompilandSymId func_id,
if (!function_decl) {
function_decl = m_clang.AddMethodToCXXRecordType(
parent_opaque_ty, func_name,
- /*mangled_name=*/nullptr, func_ct,
+ /*asm_label=*/{}, func_ct,
/*access=*/lldb::AccessType::eAccessPublic,
/*is_virtual=*/false, /*is_static=*/false,
/*is_inline=*/false, /*is_explicit=*/false,
@@ -913,7 +913,7 @@ PdbAstBuilder::CreateFunctionDecl(PdbCompilandSymId func_id,
} else {
function_decl = m_clang.CreateFunctionDeclaration(
parent, OptionalClangModuleID(), func_name, func_ct, func_storage,
- is_inline);
+ is_inline, /*asm_label=*/{});
CreateFunctionParameters(func_id, *function_decl, param_count);
}
return function_decl;
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
index 1f888f4..98b965c 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
@@ -65,7 +65,7 @@ struct CVTagRecord {
}
llvm::StringRef name() const {
- if (m_kind == Struct || m_kind == Union)
+ if (m_kind == Struct || m_kind == Class)
return cvclass.Name;
if (m_kind == Enum)
return cvenum.Name;
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
index 807ee5b..1c575e9 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -111,9 +111,8 @@ void UdtRecordCompleter::AddMethod(llvm::StringRef name, TypeIndex type_idx,
bool is_artificial = (options & MethodOptions::CompilerGenerated) ==
MethodOptions::CompilerGenerated;
m_ast_builder.clang().AddMethodToCXXRecordType(
- derived_opaque_ty, name.data(), nullptr, method_ct,
- access_type, attrs.isVirtual(), attrs.isStatic(), false, false, false,
- is_artificial);
+ derived_opaque_ty, name.data(), /*asm_label=*/{}, method_ct, access_type,
+ attrs.isVirtual(), attrs.isStatic(), false, false, false, is_artificial);
m_cxx_record_map[derived_opaque_ty].insert({name, method_ct});
}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 0090d8f..8b8eac6e 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -954,7 +954,8 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
auto decl = m_ast.CreateFunctionDeclaration(
decl_context, OptionalClangModuleID(), name,
- type->GetForwardCompilerType(), storage, func->hasInlineAttribute());
+ type->GetForwardCompilerType(), storage, func->hasInlineAttribute(),
+ /*asm_label=*/{});
std::vector<clang::ParmVarDecl *> params;
if (std::unique_ptr<PDBSymbolTypeFunctionSig> sig = func->getSignature()) {
@@ -1446,7 +1447,7 @@ PDBASTParser::AddRecordMethod(lldb_private::SymbolFile &symbol_file,
// TODO: get mangled name for the method.
return m_ast.AddMethodToCXXRecordType(
record_type.GetOpaqueQualType(), name.c_str(),
- /*mangled_name*/ nullptr, method_comp_type, access, method.isVirtual(),
+ /*asm_label=*/{}, method_comp_type, access, method.isVirtual(),
method.isStatic(), method.hasInlineAttribute(),
/*is_explicit*/ false, // FIXME: Need this field in CodeView.
/*is_attr_used*/ false,