From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Use early-out style in gdb.base/break-probes.exp
Date: Thu, 23 Sep 2021 22:42:44 +0200 [thread overview]
Message-ID: <20210923204242.GA31859@delia> (raw)
Hi,
Reduce indentation and improve readability in test-case
gdb.base/break-probes.exp by replacing:
...
if { <cond> } {
<lots-of-code>
}
...
with:
...
if { ! <cond> } {
return -1
}
<lots-of-code>
...
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Use early-out style in gdb.base/break-probes.exp
---
gdb/testsuite/gdb.base/break-probes.exp | 52 +++++++++++++++++----------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
index 2a590de8139..e11591798df 100644
--- a/gdb/testsuite/gdb.base/break-probes.exp
+++ b/gdb/testsuite/gdb.base/break-probes.exp
@@ -60,34 +60,36 @@ gdb_test_multiple "bt" $test {
}
}
-if { $using_probes } {
- set sysroot ""
- set test "show sysroot"
- gdb_test_multiple $test $test {
- -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" {
- set sysroot $expect_out(1,string)
- }
+if { ! $using_probes } {
+ return -1
+}
+
+set sysroot ""
+set test "show sysroot"
+gdb_test_multiple $test $test {
+ -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" {
+ set sysroot $expect_out(1,string)
}
+}
- # GDB strips "target:" from the start of filenames
- # when operating on the local filesystem
- regsub "^target:" "$sysroot" "(target:)?" sysroot
+# GDB strips "target:" from the start of filenames
+# when operating on the local filesystem
+regsub "^target:" "$sysroot" "(target:)?" sysroot
- # Run til it loads our library
- set test "run til our library loads"
- set not_loaded_library 1
- while { $not_loaded_library } {
- set not_loaded_library 0
- gdb_test_multiple "c" $test {
- -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" {
- pass $test
- }
- -re "Stopped due to shared library event\\M.*$gdb_prompt $" {
- set not_loaded_library 1
- }
+# Run til it loads our library
+set test "run til our library loads"
+set not_loaded_library 1
+while { $not_loaded_library } {
+ set not_loaded_library 0
+ gdb_test_multiple "c" $test {
+ -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Stopped due to shared library event\\M.*$gdb_prompt $" {
+ set not_loaded_library 1
}
}
-
- # Call something to ensure that relocation occurred
- gdb_test "call (int) foo(23)" "\\\$.* = 31.*\\\M.*"
}
+
+# Call something to ensure that relocation occurred
+gdb_test "call (int) foo(23)" "\\\$.* = 31.*\\\M.*"
reply other threads:[~2021-09-23 20:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210923204242.GA31859@delia \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox