diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-02-18 20:52:40 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-02-28 10:56:28 +0000 |
commit | 47171eeb9468fd38e3785b0181d63a2abea3bf29 (patch) | |
tree | 2b93b46f275ffcdecd531909e34c5a4e4b7e9208 /gdb/testsuite/lib | |
parent | 292deeba7d6e0f1df99fff8c18000a1a3c481f3a (diff) | |
download | gdb-47171eeb9468fd38e3785b0181d63a2abea3bf29.zip gdb-47171eeb9468fd38e3785b0181d63a2abea3bf29.tar.gz gdb-47171eeb9468fd38e3785b0181d63a2abea3bf29.tar.bz2 |
gdb/testsuite: introduce is_target_non_stop helper proc
I noticed that several tests included copy & pasted code to run the
'maint show target-non-stop' command, and then switch based on the
result.
In this commit I factor this code out into a helper proc in
lib/gdb.exp, and update all the places I could find that used this
pattern to make use of the helper proc.
There should be no change in what is tested after this commit.
Reviewed-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 669a5f6..19c782b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9298,6 +9298,28 @@ proc gdb_step_until { regexp {test_name ""} {max_steps 10} } { } } +# Return false if the current target is not operating in non-stop +# mode, otherwise, return true. +# +# The inferior will need to have started running in order to get the +# correct result. + +proc is_target_non_stop { {testname ""} } { + # For historical reasons we assume non-stop mode is on. If the + # maintenance command fails for any reason then we're going to + # return true. + set is_non_stop true + gdb_test_multiple "maint show target-non-stop" $testname { + -wrap -re "(is|currently) on.*" { + set is_non_stop true + } + -wrap -re "(is|currently) off.*" { + set is_non_stop false + } + } + return $is_non_stop +} + # Check if the compiler emits epilogue information associated # with the closing brace or with the last statement line. # |