[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found
From: |
Ludovic Courtès |
Subject: |
bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found |
Date: |
Fri, 15 Apr 2022 18:21:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hello!
Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> skribis:
> (define-public valgrind/interactive
> - (package/inherit
> - valgrind
> - (inputs
> - ;; GDB is needed to provide a sane default for `--db-command'.
> - `(("gdb" ,gdb)))
> - (properties '())))
> + (package/inherit valgrind
> + (inputs
> + ;; GDB is needed to provide a sane default for `--db-command'.
> + `(("gdb" ,gdb)
> + ("libc:debug" ,(@@ (gnu packages commencement) glibc-final) "debug")))
Rather: ("libc:debug" ,(canonical-package glibc) "debug").
> + (arguments
> + (substitute-keyword-arguments (package-arguments valgrind)
> + ((#:phases those-phases #~%standard-phases)
> + #~(let* ((those-phases #$those-phases)
> + (unpack (assoc-ref those-phases 'unpack)))
> + (modify-phases those-phases
> + (add-before 'build 'patch-default-debuginfo-path
> + (lambda _
> + ;; This helps Valgrind find the debug symbols of ld.so.
> + ;; Without it, Valgrind does not work in a Guix shell
> + ;; container and cannot be used as-is during packages tests
> + ;; phases
> + (substitute* '
> + ("coregrind/m_debuginfo/readelf.c"
> + "docs/xml/manual-core-adv.xml"
> + "docs/xml/manual-core.xml")
> + (("/usr/lib/debug")
> + (string-append
> + (assoc-ref %build-inputs "libc:debug")
> + "/lib/debug")))
> + ;; We also need to account for the bigger path in
> + ;; the malloc-ed variables
> + (substitute* '
> + ("coregrind/m_debuginfo/readelf.c")
> + (("VG_\\(strlen\\)\\(buildid\\) \\+ 33")
> + (string-append
> + "VG_(strlen)(buildid) + "
> + (number->string
> + (+ (string-length
> + (string-append
> + (assoc-ref %build-inputs "libc:debug")
> + "/lib/debug"))
> + (string-length "/.build-id//.debug")
> + 1)))))
> + (substitute* '
> + ("coregrind/m_debuginfo/readelf.c")
> + ((string-append
> + "VG_\\(strlen\\)\\(objdir\\) \\+ "
> + "VG_\\(strlen\\)\\(debugname\\) \\+ 64")
> + (string-append
> + "VG_(strlen)(objdir) + VG_(strlen)(debugname) + "
> + (number->string
> + (+ (string-length
> + (string-append
> + (assoc-ref
> + %build-inputs
> + "libc:debug")
> + "/lib/debug"))
> + (string-length
> + "/usr/lib/debug")
> + 1)))))
I find this patch-as-code snippet rather difficult to follow; it might
also break easily if minor things change in those C files.
How about making it an actual patch? In the patch, you’d have
placeholders for the store file names, like @LIBC_DEBUG_DIRECTORY@; the
phase would replace those placeholders with ‘substitute*’.
How does that sound?
Thanks,
Ludo’.
- bug#54728: Valgrind not working out of the box due to stripped ld.so, Denis 'GNUtoo' Carikli, 2022/04/05
- bug#54728: Valgrind not working out of the box due to stripped ld.so, Ludovic Courtès, 2022/04/07
- bug#54728: Valgrind not working out of the box due to stripped ld.so, Denis 'GNUtoo' Carikli, 2022/04/14
- bug#54728: [PATCH 1/2] gnu: valgrind: impots: sort imports alphabetically, Denis 'GNUtoo' Carikli, 2022/04/14
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/14
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found,
Ludovic Courtès <=
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Maxime Devos, 2022/04/25
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 1/2] gnu: valgrind: impots: sort imports alphabetically, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/26