[11/12] Eliminate gdb_is_target_remote / gdb_is_target_native & friends

Message ID 20240419151342.1592474-12-pedro@palves.net
State New
Headers
Series Fix attach/run failure handling - gdbserver & Windows, document "E.MESSAGE" RSP errors, more |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Pedro Alves April 19, 2024, 3:13 p.m. UTC
  After the previous patches, gdb_is_target_remote,
gdb_is_target_native, and mi_is_target_remote aren't used anywhere.
This commit eliminates them, along with now unnecessary helpers.

Change-Id: I54f9ae1f5aed3f640e5758731cf4954e6dbb1bee
---
 gdb/testsuite/lib/gdb.exp        | 68 --------------------------------
 gdb/testsuite/lib/mi-support.exp |  9 -----
 2 files changed, 77 deletions(-)
  

Comments

Tom Tromey April 19, 2024, 6:57 p.m. UTC | #1
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> After the previous patches, gdb_is_target_remote,
Pedro> gdb_is_target_native, and mi_is_target_remote aren't used anywhere.
Pedro> This commit eliminates them, along with now unnecessary helpers.

Thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f37d54b16be..03ca8f9a63a 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4657,74 +4657,6 @@  proc have_longjmp_probe {} {
     return $have_probe
 }
 
-# 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.  PROMPT_REGEXP is a regexp
-# matching the expected prompt after the command output.
-#
-# NOTE: GDB must be running BEFORE this procedure is called!
-
-proc gdb_is_target_1 { target_name target_stack_regexp prompt_regexp } {
-    global gdb_spawn_id
-
-    # Throw a Tcl error if gdb isn't already started.
-    if {![info exists gdb_spawn_id]} {
-	error "gdb_is_target_1 called with no running gdb instance"
-    }
-
-    set test "probe for target ${target_name}"
-    gdb_test_multiple "maint print target-stack" $test \
-	-prompt "$prompt_regexp" {
-	    -re "${target_stack_regexp}${prompt_regexp}" {
-		pass $test
-		return 1
-	    }
-	    -re "$prompt_regexp" {
-		pass $test
-	    }
-	}
-    return 0
-}
-
-# Helper for gdb_is_target_remote where the expected prompt is variable.
-#
-# NOTE: GDB must be running BEFORE this procedure is called!
-
-proc gdb_is_target_remote_prompt { prompt_regexp } {
-    return [gdb_is_target_1 "remote" ".*emote target using gdb-specific protocol.*" $prompt_regexp]
-}
-
-# Check whether we're testing with the remote or extended-remote
-# targets.
-#
-# This is meant to be used on testcases that connect to targets
-# different from the default board protocol.  For most tests, you can
-# check whether gdb_protocol is "remote" or "extended-remote" instead
-# (or call gdb_protocol_is_remote for either).
-#
-# NOTE: GDB must be running BEFORE this procedure is called!
-
-proc gdb_is_target_remote { } {
-    global gdb_prompt
-
-    return [gdb_is_target_remote_prompt "$gdb_prompt $"]
-}
-
-# Check whether we're testing with the native target.
-#
-# This is meant to be used on testcases that connect to targets
-# different from the default board protocol.  For most tests, you can
-# check whether gdb_protocol is the empty string instead.
-#
-# NOTE: GDB must be running BEFORE this procedure is called!
-
-proc gdb_is_target_native { } {
-    global gdb_prompt
-
-    return [gdb_is_target_1 "native" ".*native \\(Native process\\).*" "$gdb_prompt $"]
-}
-
 # Returns true if gdb_protocol is empty, indicating use of the native
 # target.
 
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index b3a27efb155..aa0f9df6c3a 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2863,15 +2863,6 @@  proc mi_skip_libstdcxx_probe_tests {} {
     return [skip_libstdcxx_probe_tests_prompt "$mi_gdb_prompt$"]
 }
 
-# Check whether we're testing with the remote or extended-remote
-# targets.
-
-proc mi_is_target_remote {} {
-    global mi_gdb_prompt
-
-    return [gdb_is_target_remote_prompt "$mi_gdb_prompt"]
-}
-
 # Retrieve the value of EXP in the inferior, represented in format
 # specified in FMT (using "printFMT").  DEFAULT is used as fallback if
 # print fails.  TEST is the test message to use.  It can be omitted,