Skip to content

Commit 27b2f4f

Browse files
author
walter erquinigo
committed
[LLDB] Revert llvm#98351 and llvm#98344
This reverts commit 2fa1220. This reverts commit b9496a7. The patch llvm#98344 causes a crash in LLDB when parsing some files like `numpy.libs/libgfortran-daac5196.so.5.0.0` on graviton (you can download it in https://drive.google.com/file/d/12ygLjJwWpzdYsrzBPp1JGiFHxcgM0-XY/view?usp=drive_link if you want to troubleshoot yourself). The assert that is hit is the following: ``` llvm-project/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2452: std::pair<unsigned int, std::map<long unsigned int, lldb_private::AddressClass> > ObjectFileELF::ParseSymbolTable(lldb_private::Symtab*, lldb::user_id_t, lldb_private::Section*): Assertion `strtab->GetObjectFile() == this' failed. [383588:383636:20240716,025305.572639:ERROR crashpad_client_linux.cc:780] Crashpad isn't enabled ``` This object file doesn't have apparently a strings table but LLDB still tries to process it due to the code that is being reverted.
1 parent d82c75e commit 27b2f4f

File tree

13 files changed

+22
-545
lines changed

13 files changed

+22
-545
lines changed

lldb/include/lldb/Host/Config.h.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
#cmakedefine01 LLDB_ENABLE_LZMA
3535

36-
#cmakedefine01 LLVM_ENABLE_CURL
37-
3836
#cmakedefine01 LLDB_ENABLE_CURSES
3937

4038
#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H

lldb/packages/Python/lldbsuite/test/decorators.py

-4
Original file line numberDiff line numberDiff line change
@@ -1053,10 +1053,6 @@ def _get_bool_config_skip_if_decorator(key):
10531053
return unittest.skipIf(not have, "requires " + key)
10541054

10551055

1056-
def skipIfCurlSupportMissing(func):
1057-
return _get_bool_config_skip_if_decorator("curl")(func)
1058-
1059-
10601056
def skipIfCursesSupportMissing(func):
10611057
return _get_bool_config_skip_if_decorator("curses")(func)
10621058

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

+1-35
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
5151
#
5252
# GNUWin32 uname gives "windows32" or "server version windows32" while
5353
# some versions of MSYS uname return "MSYS_NT*", but most environments
54-
# standardize on "Windows_NT", so we'll make it consistent here.
54+
# standardize on "Windows_NT", so we'll make it consistent here.
5555
# When running tests from Visual Studio, the environment variable isn't
5656
# inherited all the way down to the process spawned for make.
5757
#----------------------------------------------------------------------
@@ -213,12 +213,6 @@ else
213213
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
214214
DSYM = $(EXE).debug
215215
endif
216-
217-
ifeq "$(MAKE_DWP)" "YES"
218-
MAKE_DWO := YES
219-
DWP_NAME = $(EXE).dwp
220-
DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
221-
endif
222216
endif
223217

224218
LIMIT_DEBUG_INFO_FLAGS =
@@ -367,17 +361,6 @@ ifneq "$(OS)" "Darwin"
367361

368362
OBJCOPY ?= $(call replace_cc_with,objcopy)
369363
ARCHIVER ?= $(call replace_cc_with,ar)
370-
# Look for llvm-dwp or gnu dwp
371-
DWP ?= $(call replace_cc_with,llvm-dwp)
372-
ifeq ($(wildcard $(DWP)),)
373-
DWP = $(call replace_cc_with,dwp)
374-
ifeq ($(wildcard $(DWP)),)
375-
DWP = $(shell command -v llvm-dwp 2> /dev/null)
376-
ifeq ($(wildcard $(DWP)),)
377-
DWP = $(shell command -v dwp 2> /dev/null)
378-
endif
379-
endif
380-
endif
381364
override AR = $(ARCHIVER)
382365
endif
383366

@@ -548,10 +531,6 @@ ifneq "$(CXX)" ""
548531
endif
549532
endif
550533

551-
ifeq "$(GEN_GNU_BUILD_ID)" "YES"
552-
LDFLAGS += -Wl,--build-id
553-
endif
554-
555534
#----------------------------------------------------------------------
556535
# DYLIB_ONLY variable can be used to skip the building of a.out.
557536
# See the sections below regarding dSYM file as well as the building of
@@ -590,18 +569,11 @@ else
590569
endif
591570
else
592571
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
593-
ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
594-
cp "$(EXE)" "$(EXE).unstripped"
595-
endif
596572
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
597573
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
598574
endif
599-
ifeq "$(MAKE_DWP)" "YES"
600-
$(DWP) -o "$(DWP_NAME)" $(DWOS)
601-
endif
602575
endif
603576

604-
605577
#----------------------------------------------------------------------
606578
# Make the dylib
607579
#----------------------------------------------------------------------
@@ -642,15 +614,9 @@ endif
642614
else
643615
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
644616
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
645-
ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
646-
cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
647-
endif
648617
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
649618
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
650619
endif
651-
ifeq "$(MAKE_DWP)" "YES"
652-
$(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
653-
endif
654620
endif
655621

656622
#----------------------------------------------------------------------

lldb/source/API/SBDebugger.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,6 @@ SBStructuredData SBDebugger::GetBuildConfiguration() {
775775
AddBoolConfigEntry(
776776
*config_up, "xml", XMLDocument::XMLEnabled(),
777777
"A boolean value that indicates if XML support is enabled in LLDB");
778-
AddBoolConfigEntry(
779-
*config_up, "curl", LLVM_ENABLE_CURL,
780-
"A boolean value that indicates if CURL support is enabled in LLDB");
781778
AddBoolConfigEntry(
782779
*config_up, "curses", LLDB_ENABLE_CURSES,
783780
"A boolean value that indicates if curses support is enabled in LLDB");
@@ -1727,20 +1724,20 @@ SBDebugger::LoadTraceFromFile(SBError &error,
17271724

17281725
void SBDebugger::RequestInterrupt() {
17291726
LLDB_INSTRUMENT_VA(this);
1730-
1727+
17311728
if (m_opaque_sp)
1732-
m_opaque_sp->RequestInterrupt();
1729+
m_opaque_sp->RequestInterrupt();
17331730
}
17341731
void SBDebugger::CancelInterruptRequest() {
17351732
LLDB_INSTRUMENT_VA(this);
1736-
1733+
17371734
if (m_opaque_sp)
1738-
m_opaque_sp->CancelInterruptRequest();
1735+
m_opaque_sp->CancelInterruptRequest();
17391736
}
17401737

17411738
bool SBDebugger::InterruptRequested() {
17421739
LLDB_INSTRUMENT_VA(this);
1743-
1740+
17441741
if (m_opaque_sp)
17451742
return m_opaque_sp->InterruptRequested();
17461743
return false;

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

+13-25
Original file line numberDiff line numberDiff line change
@@ -4299,38 +4299,26 @@ const std::shared_ptr<SymbolFileDWARFDwo> &SymbolFileDWARF::GetDwpSymbolFile() {
42994299
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
43004300
ModuleSpec module_spec;
43014301
module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec();
4302-
FileSpec dwp_filespec;
43034302
for (const auto &symfile : symfiles.files()) {
43044303
module_spec.GetSymbolFileSpec() =
43054304
FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle());
43064305
LLDB_LOG(log, "Searching for DWP using: \"{0}\"",
43074306
module_spec.GetSymbolFileSpec());
4308-
dwp_filespec =
4307+
FileSpec dwp_filespec =
43094308
PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
43104309
if (FileSystem::Instance().Exists(dwp_filespec)) {
4311-
break;
4312-
}
4313-
}
4314-
if (!FileSystem::Instance().Exists(dwp_filespec)) {
4315-
LLDB_LOG(log, "No DWP file found locally");
4316-
// Fill in the UUID for the module we're trying to match for, so we can
4317-
// find the correct DWP file, as the Debuginfod plugin uses *only* this
4318-
// data to correctly match the DWP file with the binary.
4319-
module_spec.GetUUID() = m_objfile_sp->GetUUID();
4320-
dwp_filespec =
4321-
PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
4322-
}
4323-
if (FileSystem::Instance().Exists(dwp_filespec)) {
4324-
LLDB_LOG(log, "Found DWP file: \"{0}\"", dwp_filespec);
4325-
DataBufferSP dwp_file_data_sp;
4326-
lldb::offset_t dwp_file_data_offset = 0;
4327-
ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
4328-
GetObjectFile()->GetModule(), &dwp_filespec, 0,
4329-
FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp,
4330-
dwp_file_data_offset);
4331-
if (dwp_obj_file) {
4332-
m_dwp_symfile = std::make_shared<SymbolFileDWARFDwo>(
4333-
*this, dwp_obj_file, DIERef::k_file_index_mask);
4310+
LLDB_LOG(log, "Found DWP file: \"{0}\"", dwp_filespec);
4311+
DataBufferSP dwp_file_data_sp;
4312+
lldb::offset_t dwp_file_data_offset = 0;
4313+
ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
4314+
GetObjectFile()->GetModule(), &dwp_filespec, 0,
4315+
FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp,
4316+
dwp_file_data_offset);
4317+
if (dwp_obj_file) {
4318+
m_dwp_symfile = std::make_shared<SymbolFileDWARFDwo>(
4319+
*this, dwp_obj_file, DIERef::k_file_index_mask);
4320+
break;
4321+
}
43344322
}
43354323
}
43364324
if (!m_dwp_symfile) {
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
# Order matters here: the first symbol locator prevents further searching.
2-
# For DWARF binaries that are both stripped and split, the Default plugin
3-
# will return the stripped binary when asked for the ObjectFile, which then
4-
# prevents an unstripped binary from being requested from the Debuginfod
5-
# provider.
6-
add_subdirectory(Debuginfod)
71
add_subdirectory(Default)
82
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
93
add_subdirectory(DebugSymbols)
104
endif()
5+
add_subdirectory(Debuginfod)

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

+2-27
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,6 @@ llvm::StringRef SymbolVendorELF::GetPluginDescriptionStatic() {
4444
"executables.";
4545
}
4646

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 ObjectFile from the file_spec.
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-
// The presence of a debug_cu_index section is the key identifying feature of
57-
// a DWP file. Make sure we don't fill in the section list on dwp_obj_file
58-
// (by calling GetSectionList(false)) as this function could be called before
59-
// we may have all the symbol files collected and available.
60-
return dwp_obj_file && ObjectFileELF::classof(dwp_obj_file.get()) &&
61-
dwp_obj_file->GetSectionList(false)->FindSectionByType(
62-
eSectionTypeDWARFDebugCuIndex, false);
63-
}
64-
6547
// CreateInstance
6648
//
6749
// Platforms can register a callback to use when creating symbol vendors to
@@ -105,15 +87,8 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
10587
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
10688
FileSpec dsym_fspec =
10789
PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
108-
if (!dsym_fspec || IsDwpSymbolFile(module_sp, dsym_fspec)) {
109-
// If we have a stripped binary or if we got a DWP file, we should prefer
110-
// symbols in the executable acquired through a plugin.
111-
ModuleSpec unstripped_spec =
112-
PluginManager::LocateExecutableObjectFile(module_spec);
113-
if (!unstripped_spec)
114-
return nullptr;
115-
dsym_fspec = unstripped_spec.GetFileSpec();
116-
}
90+
if (!dsym_fspec)
91+
return nullptr;
11792

11893
DataBufferSP dsym_file_data_sp;
11994
lldb::offset_t dsym_file_data_offset = 0;

lldb/test/API/debuginfod/Normal/Makefile

-19
This file was deleted.

0 commit comments

Comments
 (0)