[gdb/testsuite] Use early-out style in gdb.base/break-probes.exp

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.
This commit is contained in:
Tom de Vries
2021-09-23 22:42:10 +02:00
parent 9b8efa2cd1
commit 04739cc7ce

View File

@ -60,23 +60,26 @@ gdb_test_multiple "bt" $test {
} }
} }
if { $using_probes } { if { ! $using_probes } {
set sysroot "" return -1
set test "show sysroot" }
gdb_test_multiple $test $test {
set sysroot ""
set test "show sysroot"
gdb_test_multiple $test $test {
-re "The current system root is \"(.*)\"\..*${gdb_prompt} $" { -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" {
set sysroot $expect_out(1,string) set sysroot $expect_out(1,string)
} }
} }
# GDB strips "target:" from the start of filenames # GDB strips "target:" from the start of filenames
# when operating on the local filesystem # when operating on the local filesystem
regsub "^target:" "$sysroot" "(target:)?" sysroot regsub "^target:" "$sysroot" "(target:)?" sysroot
# Run til it loads our library # Run til it loads our library
set test "run til our library loads" set test "run til our library loads"
set not_loaded_library 1 set not_loaded_library 1
while { $not_loaded_library } { while { $not_loaded_library } {
set not_loaded_library 0 set not_loaded_library 0
gdb_test_multiple "c" $test { gdb_test_multiple "c" $test {
-re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" { -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" {
@ -86,8 +89,7 @@ if { $using_probes } {
set not_loaded_library 1 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.*"