From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 15 12:21:44 2022 Received: (at 54728) by debbugs.gnu.org; 15 Apr 2022 16:21:44 +0000 Received: from localhost ([127.0.0.1]:60172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfOhc-0002bl-HO for submit@debbugs.gnu.org; Fri, 15 Apr 2022 12:21:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfOhZ-0002bR-Kj for 54728@debbugs.gnu.org; Fri, 15 Apr 2022 12:21:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfOhT-0005hp-VC; Fri, 15 Apr 2022 12:21:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=jF2C2MoEd5W52aB9xLof0cALg4HWvRz3cgWHRJT+wqM=; b=oltnfzwhvwGv8kwexHi/ 2h+hc63A+aHKEsCYho1m9dEcIc4jlHHMlK59v5S8OD4YoT54chF9AiBME8BSahJYcfdrnqPbdoW2P GTmXl/DSGO4lTLHkBL9FeNay6mCmoO1Z2lIjUVuvPZms7qrzqJuqIDYonLR60kqfJg77ohWeD8GUD pIsOu99yTns0etTaLb9b0ZwkWEakQK8MUSKP1jEmgcog3njmWgUDfNaqeW26MQ63Jsur113kAuzZ3 Sv6EwZJmgN6mHRdurW/glpLvxQ3IQOCkwOqiaedsiFhWYvTjih0KCa+Gt1qflWX5tYRA0zWI/knxy dYSFIWTDJNBy4w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55935 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfOhT-0001Pz-IR; Fri, 15 Apr 2022 12:21:35 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Denis 'GNUtoo' Carikli Subject: Re: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found References: <20220415012611.6edbf92c@primarylaptop.localdomain> <20220414233012.13243-1-GNUtoo@cyberdimension.org> <20220414233012.13243-2-GNUtoo@cyberdimension.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Germinal an 230 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 15 Apr 2022 18:21:33 +0200 In-Reply-To: <20220414233012.13243-2-GNUtoo@cyberdimension.org> (Denis Carikli's message of "Fri, 15 Apr 2022 01:30:12 +0200") Message-ID: <87czhi48s2.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54728 Cc: 54728@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello! Denis 'GNUtoo' Carikli 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) "debu= g"))) 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=E2=80=99d have placeholders for the store file names, like @LIBC_DEBUG_DIRECTORY@; the phase would replace those placeholders with =E2=80=98substitute*=E2=80=99. How does that sound? Thanks, Ludo=E2=80=99.