Re: [PATCH] test_interactive: interactive debugging in test scripts
- From
Jeff King <peff@peff.net>
- Date
- Jan 16, 2012, 20:19 UTC
- Message-ID
- <20120116201922.GB18699@sigill.intra.peff.net>
- In-Reply-To
- <20120116154953.GA21238@padd.com>
On Mon, Jan 16, 2012 at 10:49:53AM -0500, Pete Wyckoff wrote:
> And it is necessary to export any test variables you want to use > in the debug shell. I often cut-n-paste lines containing > TEST_DIRECTORY and TRASH_DIRECTORY; there could be others, > in test scripts and helper libraries too.
Yeah, exporting a few common ones would be helpful. I really wish there was a way to ask a shell to stop running the script and start doing interactive things in the current shell context, but no such thing exists AFAIK (you can hack it with a read-eval loop, but you are missing many of the useful input-handling bits like tab completion. Hmm, I wonder if bash's "read -e" would be enough, though).
I kind of wonder if that is over-engineering, though. I'd like a perfect debugging environment, but the fact of the matter is that writing, maintaining, and making it work in every case that comes up is probably a lot more work than just fiddling with the scripts now and then. This code isn't even meant to be run except in such fiddling circumstances.
Show 8 quoted lines
> While it would be nice to use: > > test_interactive gdb --args git ... > > the path is setup to invoke the script in bin-wrappers/git, > requiring either --with-dashes or something like > > test_interactive gdb --args "$GIT_EXEC_PATH"/git ...
Yeah. I have before patched the bin-wrappers script to accept a GIT_WRAPPER_PREFIX variable, so you can just set that and have it run gdb on your invocation. But even that's not enough for externals. I've been tempted to actually carry around a run-time option to exec externals via gdb, but I didn't want to pollute the regular code base (and you can usually get by with just running "gdb git-foo" directly).
-Peff