aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/attach.exp
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2024-04-17 19:59:01 +0100
committerPedro Alves <pedro@palves.net>2024-04-26 21:22:48 +0100
commitc7a2ee649115c78a7722fddccb5e27dbd1478a5c (patch)
tree761ca5a7b8e052a824cedb9f5fb099c75f82c688 /gdb/testsuite/gdb.base/attach.exp
parentef27d39dd2c2e7b6af70884895e6d751872ae305 (diff)
downloadgdb-c7a2ee649115c78a7722fddccb5e27dbd1478a5c.zip
gdb-c7a2ee649115c78a7722fddccb5e27dbd1478a5c.tar.gz
gdb-c7a2ee649115c78a7722fddccb5e27dbd1478a5c.tar.bz2
gdb_is_target_native -> gdb_protocol_is_native
gdb_is_target_native uses "maint print target-stack", which is unnecessary when checking whether gdb_protocol is empty would do. Checking gdb_protocol is more efficient, and can be done before starting GDB and running to main, unlike gdb_is_target_native. This adds a new gdb_protocol_is_native procedure, and uses it in place of gdb_is_target_native. At first, I thought that we'd end up with a few testcases needing to use gdb_is_target_native still, especially multi-target tests that connect to targets different from the default board target, but no, actually all uses of gdb_is_target_native could be converted. gdb_is_target_native will be eliminated in a following patch. In some spots, we no longer need to defer the check until after starting GDB, so the patch adjusts accordingly. Change-Id: Ia706232dbffac70f9d9740bcb89c609dbee5cee3 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.base/attach.exp')
-rw-r--r--gdb/testsuite/gdb.base/attach.exp13
1 files changed, 3 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 84b2d27..637f287 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -470,16 +470,9 @@ proc_with_prefix test_command_line_attach_run {} {
global gdb_prompt
global binfile
- # The --pid option is used to attach to a process using the native target.
- # Start GDB and run to main just to see what the execution target is, skip
- # if it's not the native target.
- clean_restart $binfile
-
- if { ![runto_main] } {
- return
- }
-
- if { ![gdb_is_target_native] } {
+ # The --pid option is used to attach to a process using the native
+ # target.
+ if { ![gdb_protocol_is_native] } {
unsupported "commandline attach run test"
return
}