* [PATCH] Restore original GDB prompt in define.exp
@ 2019-07-03 13:35 Richard Bunt
[not found] ` <87lfxfjiz6.fsf@tromey.com>
0 siblings, 1 reply; 3+ messages in thread
From: Richard Bunt @ 2019-07-03 13:35 UTC (permalink / raw)
To: gdb-patches; +Cc: nd
define.exp will fail on a GDB which has set a custom prompt to identify
itself. This is because the test resets the prompt to a hard coded
"(gdb)" but then verifies the success of this against the value in
$gdb_prompt, which is set to the custom prompt.
define.exp has been modified to reset the prompt to $gdb_prompt rather
than a hard coded "(gdb)".
Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64.
gdb/testsuite/ChangeLog:
2019-06-08 Richard Bunt <richard.bunt@arm.com>
Stephen Roberts <stephen.roberts@arm.com>
* gdb.base/define.exp: Restore original prompt.
Change-Id: Ie1b883be7cd77f2208ef9db6eadde1fd0d6a4e53
---
gdb/testsuite/gdb.base/define.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
index 0590da9..7bd4b7e 100644
--- a/gdb/testsuite/gdb.base/define.exp
+++ b/gdb/testsuite/gdb.base/define.exp
@@ -292,7 +292,7 @@ gdb_test_multiple "set prompt \\(blah\\) " "set gdb_prompt" {
}
}
-gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
+gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" {
-re "$gdb_prompt $" {
pass "reset gdb_prompt"
}
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Restore original GDB prompt in define.exp
[not found] ` <87lfxfjiz6.fsf@tromey.com>
@ 2019-07-03 14:49 ` Andreas Schwab
2019-07-04 14:22 ` Richard Bunt
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2019-07-03 14:49 UTC (permalink / raw)
To: Tom Tromey; +Cc: Richard Bunt, gdb-patches, nd
On Jul 03 2019, Tom Tromey <tom@tromey.com> wrote:
>>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes:
>
> Richard> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
> Richard> +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" {
>
> This is peculiar because both the original code and the new code have
> backslashes in the "set" command -- gdb_prompt is actually a regexp, not
> just a plain string. But, it works anyhow, I guess something along the
> way is ignoring the "\".
That's because it's a var_string, not a var_string_noescape.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Restore original GDB prompt in define.exp
2019-07-03 14:49 ` Andreas Schwab
@ 2019-07-04 14:22 ` Richard Bunt
0 siblings, 0 replies; 3+ messages in thread
From: Richard Bunt @ 2019-07-04 14:22 UTC (permalink / raw)
To: Andreas Schwab, Tom Tromey; +Cc: gdb-patches, nd
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1275 bytes --]
On 7/3/19 3:48 PM, Andreas Schwab wrote:
> On Jul 03 2019, Tom Tromey <tom@tromey.com> wrote:
>
>>>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes:
>>
>> Richard> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
>> Richard> +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" {
>>
>> This is peculiar because both the original code and the new code have
>> backslashes in the "set" command -- gdb_prompt is actually a regexp, not
>> just a plain string. But, it works anyhow, I guess something along the
>> way is ignoring the "\".
>
> That's because it's a var_string, not a var_string_noescape.
>
> Andreas.
>
Thanks for the comments.
Based on these I would like to submit a v2 (when it's ready) which saves
the literal prompt from "show prompt" and restores from this.
I think this is a more robust solution as it will not break if someone is
indeed using $gdb_prompt with a more complex regular expression and
doesn't unnecessarily rely on the escape behavior of the GDB prompt.
Note: The test case which sets the prompt to \\(blah\\) still covers this
escaping behavior, but I see no need for the prompt restore test to rely
on it.
Many thanks,
Rich
\x16º&Öéj×!zÊÞ¶êç×öëÉb²Ö«r\x18\x1dnr\x17¬
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-04 14:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 13:35 [PATCH] Restore original GDB prompt in define.exp Richard Bunt
[not found] ` <87lfxfjiz6.fsf@tromey.com>
2019-07-03 14:49 ` Andreas Schwab
2019-07-04 14:22 ` Richard Bunt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox