git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] wrap-for-bin.sh: facilitate running Git executables under valgrind

From
Elijah Newren <newren@gmail.com>
Date
May 9, 2018, 15:25 UTC
Message-ID
<CABPp-BEvNOBkq0-v_Uq0CHkvRixCKmUhYPMeH-MHHZGb0x9NkA@mail.gmail.com>
In-Reply-To
<20180509132858.21936-1-ao2@ao2.it>
Hi Antonio,
On Wed, May 9, 2018 at 6:28 AM, Antonio Ospite <ao2@ao2.it> wrote:
Show 28 quoted lines
> Testing locally built git executables under valgrind is not immediate.
>
> Something like the following does not work:
>
>   $ valgrind ./bin-wrappers/git
>
> because the wrapper script forks and execs the command and valgrind does
> not track children processes by default.
>
> Something like the following may work:
>
>   $ valgrind --trace-children=yes ./bin-wrappers/git
>
> However it's counterintuitive and not ideal anyways because valgrind is
> supposed to be called on the actual executable, not on wrapper scripts.
>
> So, following the idea from commit 6a94088cc ("test: facilitate
> debugging Git executables in tests with gdb", 2015-10-30) provide
> a mechanism in the wrapper script to call valgrind directly on the
> actual executable.
>
> This mechanism could even be used by the test infrastructure in the
> future, but it is already useful by its own on the command line:
>
>   $ GIT_TEST_VALGRIND=1 \
>     GIT_VALGRIND_OPTIONS="--leak-check=full" \
>     ./bin-wrappers/git
>
Wow, timing; nice to see someone else finds this kind of thing useful.

I submitted something very similar recently; see commit 842436466aa5 ("Make running git under other debugger-like programs easy", 2018-04-24) from next, or the discussion at https://public-inbox.org/git/20180424234645.8735-1-newren@gmail.com/. That other patch has the advantage of enabling the user to run git under other debugger-like programs besides just gdb and valgrind.

Hope that helps, Elijah

Previous: Jeff KingNext: Antonio Ospite
Message 3 of 4 in “wrap-for-bin.sh: facilitate running Git executables under valgrind”
  1. wrap-for-bin.sh: facilitate running Git executables under valgrindAntonio Ospite, May 9, 2018
  2. Jeff KingMay 9, 2018
  3. Elijah NewrenMay 9, 2018
  4. Antonio OspiteMay 9, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.