This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] PR gdb/20604 - fix "quit" when an invalid expression is used
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Thu, 15 Sep 2016 16:06:25 +0100
- Subject: Re: [RFA 1/2] PR gdb/20604 - fix "quit" when an invalid expression is used
- Authentication-results: sourceware.org; auth=none
- References: <1473893962-12420-1-git-send-email-tom@tromey.com>
Hi Tom, the gdb code looks fine. Some comments on the test.
On 09/14/2016 11:59 PM, Tom Tromey wrote:
> +# Check the "quit" command.
> +
> +clean_restart
> +
> +# Test that a syntax error causes quit to abort.
> +# Regression test for PR gdb/20604.
> +gdb_test "quit()" "A syntax error in expression, near .*" \
> + "quit with syntax error"
> +
> +# Test that an expression can be used to set the error code.
> +send_gdb "quit 22+1\n"
> +set result [wait -i $gdb_spawn_id]
> +verbose $result
> +if {[lindex $result 2] == 0 && [lindex $result 3] == 23} {
Not sure getting back the exit status works universally with
remote-host testing. ISTR we're not guaranteed to get back an
exit status on all connection types (may get back an ssh/rsh status
instead). Also, the board may need to tear down more
than just gdb.
Could you try the new test with --host_board=local-remote-host.exp?
That should cover at least remote ssh testing, which is what
most people use nowadays, anyway. I'd be happy with that.
> + pass "quit with expression"
> +} else {
> + fail "quit with expression"
> +}
> +close $gdb_spawn_id
I suspect that this may be breaking non-parallel-mode testing
(e.g., runtest directly instead of make check), since it leaves
$gdb_spawn_id set.
Maybe just calling clear_gdb_spawn_id at the end is all that's
necessary?
(I mildly wonder whether making this a gdb.gdb self test would be a good
idea. I.e., the inferior gdb's exit would be caught by the
superior gdb as a normal exit. OTOH, that'd make the test
heavier.)
Thanks,
Pedro Alves