mailing list mirror (one of many)
 help / Atom feed
From: SZEDER Gábor <>
To: Jeff King <>
Cc: Junio C Hamano <>,
	Johannes Schindelin <>,
	Git mailing list <>
Subject: Re: [PATCH] tests: create an interactive gdb session with the 'debug' helper
Date: Sat, 18 Mar 2017 17:10:18 +0100
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Mar 17, 2017 at 3:55 PM, Jeff King <> wrote:
> On Fri, Mar 17, 2017 at 03:46:46PM +0100, SZEDER Gábor wrote:
>> The 'debug' test helper is supposed to facilitate debugging by running
>> a command of the test suite under gdb.  Unfortunately, its usefulness
>> is severely limited, because that gdb session is not interactive,
>> since the test's, and thus gdb's standard input is attached to
>> /dev/null (for a good reason, see 781f76b15 (test-lib: redirect stdin
>> of tests, 2011-12-15)).
>> Re-attach the original standard input in the debug helper, thus
>> creating an interactive gdb session, which is much much more useful.
> Yeah, I think I've had to do a similar hack manually. This is an obvious
> improvement. Though...
>> diff --git a/t/ b/t/
>> index bd357704c..9567dc986 100644
>> --- a/t/
>> +++ b/t/
>> @@ -154,7 +154,7 @@ test_pause () {
>>  #
>>  # Example: "debug git checkout master".
>>  debug () {
>> -      GIT_TEST_GDB=1 "$@"
>> +      GIT_TEST_GDB=1 "$@" <&6
>>  }
> Your stderr and stdout may be redirected, too. That's usually not a big
> problem because you'll be using "-v",

Yeah, I didn't consider using this helper in non-verbose mode at all,
and the resulting behaviour is not quite pleasant, indeed: gdb starts
in interactive mode, but as its stdout goes straight to /dev/null the
user has no idea, and gdb does not quit on Ctrl-C.  A possible
solution would be to forbid using the 'debug' helper without '-v',
like in the 'test_pause' helper just above.


> but perhaps this should add:
>   >&3 2>&4
> to be on the safe side. That covers running without "-v", as well as
> cases where the test script is redirecting output

That wouldn't buy us much.  First, file descriptors 3 and 4 are the
test's stdout and stderr, i.e. any process started within the test
would be connected to those fds anyway without those explicit
redirections.  Second, fds 3 and 4 are redirected to /dev/null in
non-verbose mode, so it would still not work without '-v'.

Perhaps you meant '>&5 2>&7' here (and in the bash example in the
commit message of 781f76b15 (test-lib: redirect stdin of tests,
2011-12-15), for that matter)?  Those redirections do in fact make
'debug' work even without '-v'.  Furthermore, those redirections do
make 'test_pause' work without '-v', too.

So this is what v2 will do, then.


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 14:46 SZEDER Gábor
2017-03-17 14:55 ` Jeff King
2017-03-18 16:10   ` SZEDER Gábor [this message]
2017-03-18 16:13     ` [PATCHv2 1/2] " SZEDER Gábor
2017-03-18 16:14       ` [PATCHv2 2/2] tests: make the 'test_pause' helper work in non-verbose mode SZEDER Gábor
2017-03-20  4:32         ` Jeff King
2017-03-20  4:31       ` [PATCHv2 1/2] tests: create an interactive gdb session with the 'debug' helper Jeff King
2017-03-21 11:07       ` Johannes Schindelin
2017-03-20  4:29     ` [PATCH] " Jeff King

Reply instructions:

You may reply publically 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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:
       or Tor2web:

AGPL code for this site: git clone public-inbox