You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:40:45 UTC

[buildstream] 01/01: Don't strip pathname from debug symbol files

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/debug-symbols-location
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 1c2bc07facc5cac4bd7cb87a1579216bb79a7ae1
Author: Sam Thursfield <sa...@afuera.me.uk>
AuthorDate: Tue Jul 3 19:20:56 2018 +0200

    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 b4ad2dc..039bcca 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 ab8adf2..ce2fe5e 100644
--- a/tests/cachekey/project/elements/build1.expected
+++ b/tests/cachekey/project/elements/build1.expected
@@ -1 +1 @@
-93594f53df6c599598ea9c1d5101a8f7e57bbd82cac521494ce680e6f84de67d
\ No newline at end of file
+c9deaea0c4bdd9f92d525d69b7622999a8b24be0fc1448ae9d77aa746aa53007
\ No newline at end of file
diff --git a/tests/cachekey/project/elements/build2.expected b/tests/cachekey/project/elements/build2.expected
index 9499017..9563b45 100644
--- a/tests/cachekey/project/elements/build2.expected
+++ b/tests/cachekey/project/elements/build2.expected
@@ -1 +1 @@
-3ae596efed1126d440780ef33d2144a06cb7215a778c4f59b12a2f77fa0ee3b2
\ No newline at end of file
+221cf73040a06a7fe8fe645169ea6d15e46c7d8acf725606766f33e9bf19b917
\ No newline at end of file
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index dcb6a66..08dcbfe 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-0de68ec99d39b12857a5350ebfdc7f49fdde9a3457a31b2330896307fb503f7b
\ No newline at end of file
+e6f734165c7eb68079a7caa2953c534078c116d9c18a7422e672f978975e9651
\ No newline at end of file
diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py
index c774776..37f6ed0 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 3965725..2d02755 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 0c9ac6c..6ea2b66 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 8f017e7..3c16b29 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 00c80d5..d203181 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'])
 ])