public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Restore gdb_is_target_remote_prompt
@ 2018-02-28  3:29 Simon Marchi
  2018-02-28  9:52 ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2018-02-28  3:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

In patch

  Add test for load command
  3275ef477498e0500d7ea440f1bc51787acf4610

I removed gdb_is_target_remote_prompt, but did not realize it was used
in mi_is_target_remote.  This makes the gdb.mi/mi-nonstop.exp crash, for
example.  This patch restores it.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_is_target_1): Add prompt_regexp parameter and
	use it.
	(gdb_is_target_remote_prompt): New proc.
	(gdb_is_target_remote): Use gdb_is_target_remote_prompt.
	(gdb_is_target_native): Pass prompt parameter to
	gdb_is_target_1.
---
 gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3cd10dc..9102e54 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3157,13 +3157,10 @@ proc skip_compile_feature_tests {} {
 # Helper for gdb_is_target_* procs.  TARGET_NAME is the name of the target
 # we're looking for (used to build the test name).  TARGET_STACK_REGEXP
 # is a regexp that will match the output of "maint print target-stack" if
-# the target in question is currently pushed.
-
-proc gdb_is_target_1 { target_name target_stack_regexp } {
-    global gdb_prompt
-
-    set prompt_regexp "$gdb_prompt $"
+# the target in question is currently pushed.  PROMPT_REGEXP is a regexp
+# matching the expected prompt after the command output.
 
+proc gdb_is_target_1 { target_name target_stack_regexp prompt_regexp } {
     set test "probe for target ${target_name}"
     gdb_test_multiple "maint print target-stack" $test {
 	-re "${target_stack_regexp}${prompt_regexp}" {
@@ -3177,17 +3174,27 @@ proc gdb_is_target_1 { target_name target_stack_regexp } {
     return 0
 }
 
+# Helper for gdb_is_target_remote where the expected prompt is variable.
+
+proc gdb_is_target_remote_prompt { prompt_regexp } {
+    return [gdb_is_target_1 "remote" ".*emote serial target in gdb-specific protocol.*" $prompt_regexp]
+}
+
 # Check whether we're testing with the remote or extended-remote
 # targets.
 
 proc gdb_is_target_remote { } {
-    return [gdb_is_target_1 "remote" ".*emote serial target in gdb-specific protocol.*"]
+    global gdb_prompt
+
+    return [gdb_is_target_remote_prompt "$gdb_prompt $"]
 }
 
 # Check whether we're testing with the native target.
 
 proc gdb_is_target_native { } {
-    return [gdb_is_target_1 "native" ".*native \\(Native process\\).*"]
+    global gdb_prompt
+
+    return [gdb_is_target_1 "native" ".*native \\(Native process\\).*" "$gdb_prompt $"]
 }
 
 # Return the effective value of use_gdb_stub.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Restore gdb_is_target_remote_prompt
  2018-02-28  3:29 [PATCH] testsuite: Restore gdb_is_target_remote_prompt Simon Marchi
@ 2018-02-28  9:52 ` Yao Qi
  2018-02-28 14:01   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2018-02-28  9:52 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

Simon Marchi <simon.marchi@ericsson.com> writes:

> gdb/testsuite/ChangeLog:
>
> 	* lib/gdb.exp (gdb_is_target_1): Add prompt_regexp parameter and
> 	use it.
> 	(gdb_is_target_remote_prompt): New proc.
> 	(gdb_is_target_remote): Use gdb_is_target_remote_prompt.
> 	(gdb_is_target_native): Pass prompt parameter to
> 	gdb_is_target_1.

Patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Restore gdb_is_target_remote_prompt
  2018-02-28  9:52 ` Yao Qi
@ 2018-02-28 14:01   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2018-02-28 14:01 UTC (permalink / raw)
  To: Yao Qi; +Cc: Simon Marchi, gdb-patches

On 2018-02-28 04:52, Yao Qi wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
> 
>> gdb/testsuite/ChangeLog:
>> 
>> 	* lib/gdb.exp (gdb_is_target_1): Add prompt_regexp parameter and
>> 	use it.
>> 	(gdb_is_target_remote_prompt): New proc.
>> 	(gdb_is_target_remote): Use gdb_is_target_remote_prompt.
>> 	(gdb_is_target_native): Pass prompt parameter to
>> 	gdb_is_target_1.
> 
> Patch is good to me.

Thanks, I pushed it.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-28 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28  3:29 [PATCH] testsuite: Restore gdb_is_target_remote_prompt Simon Marchi
2018-02-28  9:52 ` Yao Qi
2018-02-28 14:01   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).