jankratochvil updated this revision to Diff 137622. https://reviews.llvm.org/D43512
Files: packages/Python/lldbsuite/test/decorators.py packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile packages/Python/lldbsuite/test/linux/buildidsymlink/TestTargetSymbolsBuildidSymlink.py packages/Python/lldbsuite/test/linux/buildidsymlink/main.c source/Host/common/Symbols.cpp
Index: source/Host/common/Symbols.cpp =================================================================== --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -283,6 +283,8 @@ if (llvm::sys::fs::equivalent(file_spec.GetPath(), module_file_spec.GetPath())) continue; + if (FileSystem::ResolveSymbolicLink(file_spec, file_spec).Fail()) + continue; if (file_spec.Exists()) { lldb_private::ModuleSpecList specs; Index: packages/Python/lldbsuite/test/linux/buildidsymlink/main.c =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/linux/buildidsymlink/main.c @@ -0,0 +1,6 @@ +struct s { + int i1, i2, i3, i4, i5, i6, i7, i8, i9; +} v; +int main() { + return 0; +} Index: packages/Python/lldbsuite/test/linux/buildidsymlink/TestTargetSymbolsBuildidSymlink.py =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/linux/buildidsymlink/TestTargetSymbolsBuildidSymlink.py @@ -0,0 +1,24 @@ +""" Testing separate debug info loading for base binary with a symlink. """ +import os +import time +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestTargetSymbolsBuildidSymlink(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @no_debug_info_test # Prevent the genaration of the dwarf version of this test + @skipUnlessPlatform(['linux']) + @skipIf(hostoslist=["windows"]) + @skipIfRemote # llvm.org/pr36237 + @skipUnlessDWZInstalled + def test_target_symbols_buildid_symlink(self): + self.build(clean=True) + exe = self.getBuildArtifact("stripped.out") + + lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe) Index: packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile @@ -0,0 +1,24 @@ +LEVEL = ../../make +C_SOURCES := main.c +LD_EXTRAS += -Wl,--build-id=sha1 + +all: .build-id + +.PHONY: .build-id +stripped.out stripped.debug stripped.debug.dwz: a.out + eu-strip --remove-comment -f stripped.debug -F stripped.debugx -o stripped.out $< + cp -p stripped.debug stripped.debug.dup + dwz -m stripped.debug.dwz stripped.debug stripped.debug.dup + +.build-id: stripped.debug + $(OBJCOPY) -j .note.gnu.build-id -O binary $< tmp + rm -rf .build-id + fn=`od -An -tx1 <tmp|tr -d ' \n'|sed -e 's/^.\{32\}//' -e 's#^..#.build-id/&/#' -e 's#$$#.debug#'` && \ + mkdir -p `dirname $$fn` && \ + ln -s ../../$< $$fn + $(RM) tmp + +clean:: + $(RM) -r stripped.out .build-id stripped.debug stripped.debug.dup stripped.debug.dwz + +include $(LEVEL)/Makefile.rules Index: packages/Python/lldbsuite/test/decorators.py =================================================================== --- packages/Python/lldbsuite/test/decorators.py +++ packages/Python/lldbsuite/test/decorators.py @@ -11,6 +11,7 @@ import sys import tempfile import subprocess +import distutils.spawn # Third-party modules import six @@ -759,3 +760,18 @@ except subprocess.CalledProcessError: return "%s is not supported on this system." % feature return skipTestIfFn(is_feature_enabled) + +def skipUnlessDWZInstalled(func): + """Decorate the item to skip tests when no DWZ optimization tool is available. + /usr/lib/rpm/sepdebugcrcfix is not tested here but it may be needed + when build-ids cannot be used.""" + + def is_dwz_missing(self): + if distutils.spawn.find_executable("dwz") is None: + return "skipping because dwz is not found" + # dwz has a bug it can process only separate debug info files. + # Moreover dwz is compatible only with debug infos created by eu-strip. + if distutils.spawn.find_executable("eu-strip") is None: + return "skipping because eu-strip is not found" + return None + return skipTestIfFn(is_dwz_missing)(func)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits