diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:15 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:15 +0900 |
| commit | 89753dc2b72d838c0bae22ef708201b6473a1244 (patch) | |
| tree | e7a4daa36fd4a5616f602c9ac7b5878b87b7ef0f | |
| parent | Merge branch 'bw/server-options' (diff) | |
| parent | Make running git under other debugger-like programs easy (diff) | |
| download | git-89753dc2b72d838c0bae22ef708201b6473a1244.tar.gz git-89753dc2b72d838c0bae22ef708201b6473a1244.zip | |
Merge branch 'en/git-debugger'
Dev support.
* en/git-debugger:
Make running git under other debugger-like programs easy
| -rw-r--r-- | t/test-lib-functions.sh | 24 | ||||
| -rw-r--r-- | wrap-for-bin.sh | 19 |
2 files changed, 33 insertions, 10 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 7d620bf2a9..c55ef099c3 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -145,12 +145,28 @@ test_pause () { "$SHELL_PATH" <&6 >&5 2>&7 } -# Wrap git in gdb. Adding this to a command can make it easier to -# understand what is going on in a failing test. +# Wrap git with a debugger. Adding this to a command can make it easier +# to understand what is going on in a failing test. # -# Example: "debug git checkout master". +# Examples: +# debug git checkout master +# debug --debugger=nemiver git $ARGS +# debug -d "valgrind --tool=memcheck --track-origins=yes" git $ARGS debug () { - GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7 + case "$1" in + -d) + GIT_DEBUGGER="$2" && + shift 2 + ;; + --debugger=*) + GIT_DEBUGGER="${1#*=}" && + shift 1 + ;; + *) + GIT_DEBUGGER=1 + ;; + esac && + GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7 } # Call test_commit with the arguments diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh index 5842408817..95851b85b6 100644 --- a/wrap-for-bin.sh +++ b/wrap-for-bin.sh @@ -20,10 +20,17 @@ PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR -if test -n "$GIT_TEST_GDB" -then - unset GIT_TEST_GDB - exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@" -else +case "$GIT_DEBUGGER" in +'') exec "${GIT_EXEC_PATH}/@@PROG@@" "$@" -fi + ;; +1) + unset GIT_DEBUGGER + exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@" + ;; +*) + GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" + unset GIT_DEBUGGER + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@" + ;; +esac |
