Move logic from auto-connect-native-target.exp into this helper.
return -1
}
-# Whether this GDB is configured with a "native" target.
-set have_native 0
-
-set test "help target native"
-gdb_test_multiple $test $test {
- -re "Undefined target command.*$gdb_prompt $" {
- set have_native 0
- }
- -re "Native process.*$gdb_prompt $" {
- set have_native 1
- }
-}
-
-if { !$have_native } {
- unsupported "no \"target native\" support."
- return
-}
+require have_native_target
# Returns the topmost target pushed on the target stack. TEST is used
# as test message.
additional_flags=$flag]
}
+# Return 1 if this GDB is configured with a "native" target.
+
+gdb_caching_proc have_native_target {} {
+ gdb_test_multiple "help target native" "" {
+ -re -wrap "Undefined target command.*" {
+ return 0
+ }
+ -re -wrap "Native process.*" {
+ return 1
+ }
+ }
+ return 0
+}
+
# Handle include file $srcdir/$subdir/FILE.
proc include_file { file } {