From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
Stefan Beller <sbeller@google.com>,
Michael Haggerty <mhagger@alum.mit.edu>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCHv3] refs.c: enable large transactions
Date: Sat, 25 Apr 2015 01:24:27 -0400 [thread overview]
Message-ID: <20150425052427.GA20653@peff.net> (raw)
In-Reply-To: <20150425050058.GA20256@peff.net>
On Sat, Apr 25, 2015 at 01:00:58AM -0400, Jeff King wrote:
> A better solution to what I proposed earlier is perhaps:
>
> git config alias.debug '!gdb --quiet \
> -ex "break exit" \
> -ex "run" \
> -ex "bt full" \
> -ex "continue" \
> -ex "quit" \
> --args git \
> '
> git debug rev-parse foobar
>
> It has the minor irritation that gdb will control the process stdio
> (slurping from stdin and polluting stdout, whereas we would prefer no
> input and output to stderr). There might be a way to convince gdb to do
> otherwise, or you could probably go pretty far with some shell fd
> redirects and using "set args" inside gdb. Or maybe something with
> gdbserver.
Just to extend the thought exercise, here is something marginally less
horrible. Save as "git-debug" in your PATH and chmod +x.
-- >8 --
#!/bin/sh
if ! type gdb >/dev/null 2>&1; then
echo >&2 "Sorry, you don't seem to have gdb installed."
exit 1
fi
args=
for i in "$@"; do
args="$args '$(printf '%s' "$i" | sed "s/'/'\\\\''/")'"
done
gdb --quiet \
-ex "set args $args <&7 >&8 2>&9" 7<&0 8>&1 9>&2 </dev/null >&2 \
-ex 'break exit' \
-ex 'run' \
-ex 'bt full' \
-ex 'continue' \
-ex 'quit' \
git
-- 8< --
It's still rather hard to use with sub-programs started by git (e.g.,
the upload-pack spawned by a fetch), but I think it would work for many
simple cases. I'm not sure if I would use it myself. As somebody
confident in using gdb, my next step after seeing the backtrace would be
to start poking around interactively. Besides the stdio magic, this is
not really buying me much beyond running gdb myself.
-Peff
prev parent reply other threads:[~2015-04-25 5:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 21:30 [PATCHv3] refs.c: enable large transactions Stefan Beller
2015-04-23 17:56 ` Junio C Hamano
2015-04-24 0:21 ` Stefan Beller
2015-04-24 1:37 ` Junio C Hamano
2015-04-24 16:16 ` Stefan Beller
2015-04-24 17:19 ` Jeff King
2015-04-24 18:12 ` Jonathan Nieder
2015-04-24 18:31 ` Stefan Beller
2015-04-24 20:17 ` Jeff King
2015-04-25 4:23 ` Junio C Hamano
2015-04-25 5:00 ` Jeff King
2015-04-25 5:24 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150425052427.GA20653@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=mhagger@alum.mit.edu \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).