[Lldb-commits] [PATCH] D79384: Explicitly pass a module to register Xcode SDKs with to ParseXcodeSDK. Was: Add an API that allows iterating over a debug map's OSO's Modules
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 6 17:04:34 PDT 2020
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG01fc85dc9618: ParseXcodeSDK: Register both the CU module and the SymbolFile module. (authored by aprantl).
Herald added a project: LLDB.
Changed prior to commit:
https://reviews.llvm.org/D79384?vs=262208&id=262504#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79384/new/
https://reviews.llvm.org/D79384
Files:
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
Index: lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
===================================================================
--- lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
+++ lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
@@ -70,7 +70,10 @@
SymbolFileDWARF &sym_file = dwarf_cu->GetSymbolFileDWARF();
CompUnitSP comp_unit = sym_file.GetCompileUnitAtIndex(0);
ASSERT_TRUE((bool)comp_unit.get());
+ ModuleSP module = t.GetModule();
+ ASSERT_EQ(module->GetSourceMappingList().GetSize(), 0u);
XcodeSDK sdk = sym_file.ParseXcodeSDK(*comp_unit);
ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
+ ASSERT_EQ(module->GetSourceMappingList().GetSize(), 1u);
}
#endif
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -57,14 +57,10 @@
// Compile Unit function calls
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
-
lldb_private::XcodeSDK
ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override;
-
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override;
-
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override;
-
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override;
bool ForEachExternalModule(
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -628,8 +628,7 @@
return eLanguageTypeUnknown;
}
-XcodeSDK
-SymbolFileDWARFDebugMap::ParseXcodeSDK(CompileUnit &comp_unit) {
+XcodeSDK SymbolFileDWARFDebugMap::ParseXcodeSDK(CompileUnit &comp_unit) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
if (oso_dwarf)
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -777,9 +777,6 @@
DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
if (!dwarf_cu)
return {};
- ModuleSP module_sp = m_objfile_sp->GetModule();
- if (!module_sp)
- return {};
const DWARFBaseDIE cu_die = dwarf_cu->GetNonSkeletonUnit().GetUnitDIEOnly();
if (!cu_die)
return {};
@@ -788,7 +785,18 @@
return {};
const char *sysroot =
cu_die.GetAttributeValueAsString(DW_AT_LLVM_sysroot, "");
- module_sp->RegisterXcodeSDK(sdk, sysroot);
+ // Register the sysroot path remapping with the module belonging to
+ // the CU as well as the one belonging to the symbol file. The two
+ // would be different if this is an OSO object and module is the
+ // corresponding debug map, in which case both should be updated.
+ ModuleSP module_sp = comp_unit.GetModule();
+ if (module_sp)
+ module_sp->RegisterXcodeSDK(sdk, sysroot);
+
+ ModuleSP local_module_sp = m_objfile_sp->GetModule();
+ if (local_module_sp && local_module_sp != module_sp)
+ local_module_sp->RegisterXcodeSDK(sdk, sysroot);
+
return {sdk};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79384.262504.patch
Type: text/x-patch
Size: 3418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200507/c1b82fcf/attachment-0001.bin>
More information about the lldb-commits
mailing list