diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-23 22:42:10 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-23 22:42:10 +0200 |
commit | 04739cc7ce5a5c67d8d841541a4aaef706c53a79 (patch) | |
tree | 55a4585962a9c25d4d9048ab0d698377471bccd7 /gdb/testsuite | |
parent | 9b8efa2cd14410cb23d8873fd8f0665155569523 (diff) | |
download | gdb-04739cc7ce5a5c67d8d841541a4aaef706c53a79.zip gdb-04739cc7ce5a5c67d8d841541a4aaef706c53a79.tar.gz gdb-04739cc7ce5a5c67d8d841541a4aaef706c53a79.tar.bz2 |
[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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.base/break-probes.exp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp index 2a590de..e115917 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.*" |