This is the mail archive of the gdb-cvs@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]

[binutils-gdb] testsuite: Restore gdb_is_target_remote_prompt


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3083294d65393a31522586e058500f6abda29b83

commit 3083294d65393a31522586e058500f6abda29b83
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Wed Feb 28 08:58:25 2018 -0500

    testsuite: Restore gdb_is_target_remote_prompt
    
    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:
    
      ERROR: (DejaGnu) proc "gdb_is_target_remote_prompt {[(]gdb[)]
      }" does not exist.
      The error code is TCL LOOKUP COMMAND gdb_is_target_remote_prompt
      The info on the error is:
      invalid command name "gdb_is_target_remote_prompt"
          while executing
      "::tcl_unknown gdb_is_target_remote_prompt {[(]gdb[)]
      }"
          ("uplevel" body line 1)
          invoked from within
      "uplevel 1 ::tcl_unknown $args"
    
    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.

Diff:
---
 gdb/testsuite/ChangeLog   |  9 +++++++++
 gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++--------
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4443557..59bbc6e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2018-02-28  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* 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.
+
 2018-02-26  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* gdb.base/load-command.c: New file.
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.


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