Skip to content

Commit 2979e77

Browse files
author
Kevin Frei
committed
Moved IsDwp to a local function for now
1 parent 5d1d433 commit 2979e77

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "lldb/Interpreter/OptionValueProperties.h"
4040

4141
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
42-
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
4342
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h"
4443
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
4544
#include "lldb/Symbol/Block.h"
@@ -4348,23 +4347,6 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() {
43484347
return m_debug_map_symfile;
43494348
}
43504349

4351-
bool SymbolFileDWARF::IsDwpSymbolFile(const lldb::ModuleSP &module_sp,
4352-
const FileSpec &file_spec) {
4353-
DataBufferSP dwp_file_data_sp;
4354-
lldb::offset_t dwp_file_data_offset = 0;
4355-
// Try to create an ObjectFileELF frorm the filespace
4356-
ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
4357-
module_sp, &file_spec, 0, FileSystem::Instance().GetByteSize(file_spec),
4358-
dwp_file_data_sp, dwp_file_data_offset);
4359-
if (!ObjectFileELF::classof(dwp_obj_file.get()))
4360-
return false;
4361-
static ConstString sect_name_debug_cu_index(".debug_cu_index");
4362-
if (!dwp_obj_file || !dwp_obj_file->GetSectionList()->FindSectionByName(
4363-
sect_name_debug_cu_index))
4364-
return false;
4365-
return true;
4366-
}
4367-
43684350
const std::shared_ptr<SymbolFileDWARFDwo> &SymbolFileDWARF::GetDwpSymbolFile() {
43694351
llvm::call_once(m_dwp_symfile_once_flag, [this]() {
43704352
// Create a list of files to try and append .dwp to.

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@ class SymbolFileDWARF : public SymbolFileCommon {
280280

281281
DWARFContext &GetDWARFContext() { return m_context; }
282282

283-
static bool IsDwpSymbolFile(const lldb::ModuleSP &module_sp,
284-
const FileSpec &file_spec);
285-
286283
const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();
287284

288285
FileSpec GetFile(DWARFUnit &unit, size_t file_idx);

lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ class PluginProperties : public Properties {
9696
Args m_server_urls;
9797
};
9898

99-
PluginProperties &GetGlobalPluginProperties() {
99+
} // namespace
100+
101+
static PluginProperties &GetGlobalPluginProperties() {
100102
static PluginProperties g_settings;
101103
return g_settings;
102104
}
103105

104-
} // namespace
105-
106106
SymbolLocatorDebuginfod::SymbolLocatorDebuginfod() : SymbolLocator() {}
107107

108108
void SymbolLocatorDebuginfod::Initialize() {

lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <cstring>
1212

1313
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
14-
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
1514
#include "lldb/Core/Module.h"
1615
#include "lldb/Core/ModuleSpec.h"
1716
#include "lldb/Core/PluginManager.h"
@@ -45,6 +44,24 @@ llvm::StringRef SymbolVendorELF::GetPluginDescriptionStatic() {
4544
"executables.";
4645
}
4746

47+
// If this is needed elsewhere, it can be exported/moved.
48+
static bool IsDwpSymbolFile(const lldb::ModuleSP &module_sp,
49+
const FileSpec &file_spec) {
50+
DataBufferSP dwp_file_data_sp;
51+
lldb::offset_t dwp_file_data_offset = 0;
52+
// Try to create an ObjectFileELF frorm the filespace
53+
ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
54+
module_sp, &file_spec, 0, FileSystem::Instance().GetByteSize(file_spec),
55+
dwp_file_data_sp, dwp_file_data_offset);
56+
if (!ObjectFileELF::classof(dwp_obj_file.get()))
57+
return false;
58+
static ConstString sect_name_debug_cu_index(".debug_cu_index");
59+
if (!dwp_obj_file || !dwp_obj_file->GetSectionList()->FindSectionByName(
60+
sect_name_debug_cu_index))
61+
return false;
62+
return true;
63+
}
64+
4865
// CreateInstance
4966
//
5067
// Platforms can register a callback to use when creating symbol vendors to
@@ -88,8 +105,7 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
88105
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
89106
FileSpec dsym_fspec =
90107
PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
91-
if (!dsym_fspec ||
92-
plugin::dwarf::SymbolFileDWARF::IsDwpSymbolFile(module_sp, dsym_fspec)) {
108+
if (!dsym_fspec || IsDwpSymbolFile(module_sp, dsym_fspec)) {
93109
// If we have a stripped binary or if we got a DWP file, we should prefer
94110
// symbols in the executable acquired through a plugin.
95111
ModuleSpec unstripped_spec =

0 commit comments

Comments
 (0)