From 0bcfdfb9b52ef18ffc5b6982f8dce46d46159c62 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 3 Jul 2018 19:20:56 +0200 Subject: Don't strip pathname from debug symbol files When GDB looks for debug symbols it looks for the full path of the file inside the configured debug-file-directory. For example, if the debug-file-directory is set to a default of /usr/lib/debug, and you are debugging /usr/bin/python3, GDB will look for its debug symbols at this location: /usr/lib/debug/usr/bin/python3. BuildStream has been putting all debug files inside /usr/lib/debug under their $(basename), so in the above example GDB would fail to find any debug symbols for /usr/bin/python3 because they would be in the incorrect locatoin of /usr/lib/debug/python3. --- buildstream/data/projectconfig.yaml | 4 ++-- tests/cachekey/project/elements/build1.expected | 2 +- tests/cachekey/project/elements/build2.expected | 2 +- tests/cachekey/project/target.expected | 2 +- tests/examples/autotools.py | 4 +++- tests/examples/flatpak-autotools.py | 6 ++++-- tests/integration/autotools.py | 6 ++++-- tests/integration/cmake.py | 4 +++- tests/integration/compose.py | 14 ++++++++++---- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/buildstream/data/projectconfig.yaml b/buildstream/data/projectconfig.yaml index b4ad2dcb9..039bcca2d 100644 --- a/buildstream/data/projectconfig.yaml +++ b/buildstream/data/projectconfig.yaml @@ -72,7 +72,7 @@ variables: # Generic implementation for stripping debugging symbols strip-binaries: | - find "%{install-root}" -type f \ + cd "%{install-root}" && find -type f \ '(' -perm -111 -o -name '*.so*' \ -o -name '*.cmxs' -o -name '*.node' ')' \ -exec sh -ec \ @@ -80,7 +80,7 @@ variables: if [ "$hdr" != "$(printf \\x7fELF)" ]; then exit 0 fi - debugfile="%{install-root}%{debugdir}/$(basename "$1")" + debugfile="%{install-root}%{debugdir}/$1" mkdir -p "$(dirname "$debugfile")" objcopy %{objcopy-extract-args} "$1" "$debugfile" chmod 644 "$debugfile" diff --git a/tests/cachekey/project/elements/build1.expected b/tests/cachekey/project/elements/build1.expected index cc4bf4229..750d06234 100644 --- a/tests/cachekey/project/elements/build1.expected +++ b/tests/cachekey/project/elements/build1.expected @@ -1 +1 @@ -e7de3dd12a1e5307e07859ddf2192443a0ccb1ff48e0adcc6c18f9edc2bd0d7d \ No newline at end of file +afab4c1a67d1e06489083fa1559bda0b2c8df9b7bc239820ed7cdab30c988a4e \ No newline at end of file diff --git a/tests/cachekey/project/elements/build2.expected b/tests/cachekey/project/elements/build2.expected index 3cb726dde..3b40d2ddf 100644 --- a/tests/cachekey/project/elements/build2.expected +++ b/tests/cachekey/project/elements/build2.expected @@ -1 +1 @@ -d74957e0f20a7664e9ceed6cc2ba6c140bd8d8d0712d02066feb442638e8e6ed \ No newline at end of file +47395a4e6c86372b181ad1fd6443e11b1ab54c480b7be5e5fe816d84eec3b369 \ No newline at end of file diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected index e2e2e665a..5fcd89438 100644 --- a/tests/cachekey/project/target.expected +++ b/tests/cachekey/project/target.expected @@ -1 +1 @@ -01f611e61e948f32035b659d33cdae662d863c99051d0e6746f9c5626138655f \ No newline at end of file +46f48e5c0ff52370ff0cf2bb23bd2c79da23141e6c17b9aa720f7d97b7194340 \ No newline at end of file diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py index c774776fb..37f6ed0e3 100644 --- a/tests/examples/autotools.py +++ b/tests/examples/autotools.py @@ -28,7 +28,9 @@ def test_autotools_build(cli, tmpdir, datafiles): assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', '/usr/share', '/usr/lib/debug', - '/usr/lib/debug/hello', '/usr/bin/hello', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', + '/usr/bin/hello', '/usr/share/doc', '/usr/share/doc/amhello', '/usr/share/doc/amhello/README']) diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py index 3965725c7..2d02755fc 100644 --- a/tests/examples/flatpak-autotools.py +++ b/tests/examples/flatpak-autotools.py @@ -47,8 +47,10 @@ def test_autotools_build(cli, tmpdir, datafiles): assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', '/usr/share', '/usr/lib/debug', - '/usr/lib/debug/hello', '/usr/bin/hello', - '/usr/share/doc', '/usr/share/doc/amhello', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', + '/usr/bin/hello', '/usr/share/doc', + '/usr/share/doc/amhello', '/usr/share/doc/amhello/README']) diff --git a/tests/integration/autotools.py b/tests/integration/autotools.py index 0c9ac6cd8..6ea2b667c 100644 --- a/tests/integration/autotools.py +++ b/tests/integration/autotools.py @@ -31,8 +31,10 @@ def test_autotools_build(cli, tmpdir, datafiles): assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', '/usr/share', '/usr/lib/debug', - '/usr/lib/debug/hello', '/usr/bin/hello', - '/usr/share/doc', '/usr/share/doc/amhello', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', + '/usr/bin/hello', '/usr/share/doc', + '/usr/share/doc/amhello', '/usr/share/doc/amhello/README']) diff --git a/tests/integration/cmake.py b/tests/integration/cmake.py index 8f017e707..3c16b29b9 100644 --- a/tests/integration/cmake.py +++ b/tests/integration/cmake.py @@ -27,7 +27,9 @@ def test_cmake_build(cli, tmpdir, datafiles): assert result.exit_code == 0 assert_contains(checkout, ['/usr', '/usr/bin', '/usr/bin/hello', - '/usr/lib/debug', '/usr/lib/debug/hello']) + '/usr/lib/debug', '/usr/lib/debug/usr', + '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello']) @pytest.mark.datafiles(DATA_DIR) diff --git a/tests/integration/compose.py b/tests/integration/compose.py index 00c80d58b..d203181bd 100644 --- a/tests/integration/compose.py +++ b/tests/integration/compose.py @@ -39,7 +39,8 @@ def create_compose_element(name, path, config={}): # Test flat inclusion ([], [], ['/usr', '/usr/lib', '/usr/bin', '/usr/share', '/usr/lib/debug', - '/usr/lib/debug/hello', '/usr/bin/hello', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', '/usr/bin/hello', '/usr/share/doc', '/usr/share/doc/amhello', '/usr/share/doc/amhello/README', '/tests', '/tests/test']), @@ -53,13 +54,17 @@ def create_compose_element(name, path, config={}): '/usr/share/doc/amhello/README']), # Test with only runtime excluded ([], ['runtime'], ['/usr', '/usr/lib', '/usr/share', - '/usr/lib/debug', '/usr/lib/debug/hello', + '/usr/lib/debug', '/usr/lib/debug/usr', + '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', '/usr/share/doc', '/usr/share/doc/amhello', '/usr/share/doc/amhello/README', '/tests', '/tests/test']), # Test with runtime and doc excluded ([], ['runtime', 'doc'], ['/usr', '/usr/lib', '/usr/share', - '/usr/lib/debug', '/usr/lib/debug/hello', + '/usr/lib/debug', '/usr/lib/debug/usr', + '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', '/tests', '/tests/test']), # Test with runtime simultaneously in- and excluded (['runtime'], ['runtime'], ['/usr', '/usr/lib', '/usr/share']), @@ -72,7 +77,8 @@ def create_compose_element(name, path, config={}): # Test excluding a custom 'test' domain ([], ['test'], ['/usr', '/usr/lib', '/usr/bin', '/usr/share', '/usr/lib/debug', - '/usr/lib/debug/hello', '/usr/bin/hello', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', '/usr/bin/hello', '/usr/share/doc', '/usr/share/doc/amhello', '/usr/share/doc/amhello/README']) ]) -- cgit v1.2.1