This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA v3 07/13] Throw a "quit" on a KeyboardException in py-framefilter.c


On 03/25/2018 05:37 PM, Tom Tromey wrote:

> Pedro> Or, are we leaving a gdb prompt in the expect buffer unprocessed?
> 
> I don't think so but I guess I am not really sure.

We are then, since there's a prompt after the Quit that your
gdb_test_multiple is not consuming.  That is a recipe for making the
following gdb_test/gdb_test_multiple confused and hit the internal default
prompt/FAIL match in gdb_test_multiple:

...
	-re "\r\n$gdb_prompt $" {
	    if ![string match "" $message] then {
		fail "$message"
	    }
	    set result 1
	}
...

Given the "$", it's going to be racy, though make check-read1
is more likely to catch it.

Sounds like that doesn't happen currently because your test is
the last one before restarting gdb.  So if you add more tests after
yours, it's likely you'll see a problem.  Or even without more tests,
it can still happen with board files that issue gdb commands when
tearing down the connection or gdb.

So you need to consume the prompt, like:

 gdb_test_multiple "bt 1" $test {
-     -re "Quit" {
+     -re "Quit\r\n$gdb_prompt $" {
 	pass $test
     }
 }

Or simply instead:

 gdb_test "bt 1" "Quit" "bt 1 with KeyboardInterrupt"

since gdb_test adds the prompt to the expected string for you.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]