Skip to content

Commit 4ecae3c

Browse files
szedergitster
authored andcommitted
tests: create an interactive gdb session with the 'debug' helper
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 redirected from /dev/null (for a good reason, see 781f76b (test-lib: redirect stdin of tests, 2011-12-15)). Redirect gdb's standard file descriptors from/to the test environment's stdin, stdout and stderr in the 'debug' helper, thus creating an interactive gdb session (even in non-verbose mode), which is much, much more useful. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7c9c2f8 commit 4ecae3c

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

t/test-lib-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ test_pause () {
154154
#
155155
# Example: "debug git checkout master".
156156
debug () {
157-
GIT_TEST_GDB=1 "$@"
157+
GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
158158
}
159159

160160
# Call test_commit with the arguments

t/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ fi
342342

343343
exec 5>&1
344344
exec 6<&0
345+
exec 7>&2
345346
if test "$verbose_log" = "t"
346347
then
347348
exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3

0 commit comments

Comments
 (0)