Re: [PATCH 3/6] Facilitate debugging Git executables in tests with gdb
- From
Jeff King <peff@peff.net>
- Date
- Oct 30, 2015, 19:56 UTC
- Message-ID
- <20151030195611.GC5486@sigill.intra.peff.net>
- In-Reply-To
- <20151030190256.GI7881@google.com>
On Fri, Oct 30, 2015 at 12:02:56PM -0700, Jonathan Nieder wrote:
Show 13 quoted lines
> > I'd just be happy as long as the feature becomes available, and I'd > > leave the choice of consistent and convenient naming to others who > > have stronger opinions ;-) > > Here's a suggested patch. > > -- >8 -- > From: Johannes Schindelin <johannes.schindelin@gmx.de> > Subject: Facilitate debugging Git executables in tests with gdb > > When prefixing a Git call in the test suite with 'debug ', it will now > be run with GDB, allowing the developer to debug test failures more > conveniently.
At the risk of repeating what I just said elsewhere in the thread, I think this patch is the best of the proposed solutions.
Show 14 quoted lines
> --- a/wrap-for-bin.sh
> +++ b/wrap-for-bin.sh
> @@ -19,4 +19,10 @@ GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
> PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
> export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
>
> -exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> +if test -n "$GIT_TEST_GDB"
> +then
> + unset GIT_TEST_GDB
> + exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> +else
> + exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> +fiSomebody suggested elsewhere that the name "gdb" be configurable. We could stick that in the same variable, like:
test "$GIT_TEST_GDB" = 1 && GIT_TEST_GDB=gdb
exec ${GIT_TEST_GDB} --args ...but that does not play well with the "debug" function, which does not know which value to set it to. I guess we would need GIT_TEST_GDB_PATH or something.
I am happy to let that get added later by interested parties (I am happy with "gdb" myself). I just wanted to mention it to make sure we are not painting ourselves into any corners.
-Peff