aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorKevin Frei <freik@meta.com>2024-08-06 11:06:04 -0700
committerGitHub <noreply@github.com>2024-08-06 11:06:04 -0700
commite77ac42bccb8c26bbf4b74d8e92eb09e7fa1b218 (patch)
tree5272d7e9656e8d84523176804f2f14a7cc59fe55 /lldb/packages/Python/lldbsuite
parent3983bf6040d4a9f477290b1f43fdd1938a4261fe (diff)
downloadllvm-e77ac42bccb8c26bbf4b74d8e92eb09e7fa1b218.zip
llvm-e77ac42bccb8c26bbf4b74d8e92eb09e7fa1b218.tar.gz
llvm-e77ac42bccb8c26bbf4b74d8e92eb09e7fa1b218.tar.bz2
[lldb][debuginfod] Fix the DebugInfoD PR that caused issues when working with stripped binaries (#99362)
@walter-erquinigo found the the [PR with testing and a fix for DebugInfoD](https://github.com/llvm/llvm-project/pull/98344) caused an issue when working with stripped binaries. The issue is that when you're working with split-dwarf, there are *3* possible files: The stripped binary the user is debugging, the "only-keep-debug" *or* unstripped binary, plus the `.dwp` file. The debuginfod plugin should provide the unstripped/OKD binary. However, if the debuginfod plugin fails, the default symbol locator plugin will just return the stripped binary, which doesn't help. So, to address that, the SymbolVendorELF code checks to see if the SymbolLocator's ExecutableObjectFile request returned the same file, and bails if that's the case. You can see the specific diff as the second commit in the PR. I'm investigating adding a test: I can't quite get a simple repro, and I'm unwilling to make any additional changes to Makefile.rules to this diff, for Pavlovian reasons.
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/decorators.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/make/Makefile.rules34
2 files changed, 38 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index ecc7b81..0e8ca15 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -1053,6 +1053,10 @@ def _get_bool_config_skip_if_decorator(key):
return unittest.skipIf(not have, "requires " + key)
+def skipIfCurlSupportMissing(func):
+ return _get_bool_config_skip_if_decorator("curl")(func)
+
+
def skipIfCursesSupportMissing(func):
return _get_bool_config_skip_if_decorator("curses")(func)
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 629ccee..1ba3f84 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -202,6 +202,12 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
+
+ ifeq "$(MAKE_DWP)" "YES"
+ MAKE_DWO := YES
+ DWP_NAME = $(EXE).dwp
+ DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
+ endif
endif
LIMIT_DEBUG_INFO_FLAGS =
@@ -347,6 +353,17 @@ ifneq "$(OS)" "Darwin"
OBJCOPY ?= $(call replace_cc_with,objcopy)
ARCHIVER ?= $(call replace_cc_with,ar)
+ # Look for llvm-dwp or gnu dwp
+ DWP ?= $(call replace_cc_with,llvm-dwp)
+ ifeq ($(wildcard $(DWP)),)
+ DWP = $(call replace_cc_with,dwp)
+ ifeq ($(wildcard $(DWP)),)
+ DWP = $(shell command -v llvm-dwp 2> /dev/null)
+ ifeq ($(wildcard $(DWP)),)
+ DWP = $(shell command -v dwp 2> /dev/null)
+ endif
+ endif
+ endif
override AR = $(ARCHIVER)
endif
@@ -526,6 +543,10 @@ ifneq "$(CXX)" ""
endif
endif
+ifeq "$(GEN_GNU_BUILD_ID)" "YES"
+ LDFLAGS += -Wl,--build-id
+endif
+
#----------------------------------------------------------------------
# DYLIB_ONLY variable can be used to skip the building of a.out.
# See the sections below regarding dSYM file as well as the building of
@@ -564,11 +585,18 @@ else
endif
else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+ cp "$(EXE)" "$(EXE).unstripped"
+endif
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
endif
+ifeq "$(MAKE_DWP)" "YES"
+ $(DWP) -o "$(DWP_NAME)" $(DWOS)
+endif
endif
+
#----------------------------------------------------------------------
# Make the dylib
#----------------------------------------------------------------------
@@ -609,9 +637,15 @@ endif
else
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+ cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
+endif
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
endif
+ifeq "$(MAKE_DWP)" "YES"
+ $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
+endif
endif
#----------------------------------------------------------------------