[v2,19/37] GDB: testsuite: DWARF: Don't return -1 from top-level (manual)

Message ID 20260429230432.60487-20-thiago.bauermann@linaro.org
State New
Headers
Series GDB: testsuite: Fix top-level returns |

Commit Message

Thiago Jung Bauermann April 29, 2026, 11:04 p.m. UTC
  This patch manually changes "return -1" statements that weren't caught
by the sed command.

These return statements fall into one of these criteria:

- misaligned line, which is then fixed by this patch;
- return at top level but inside block such as save_vars,
  with_test_prefix, foreach, gdb_test_multiple.

Some weren't changed because they didn't meet the criteria above, or
weren't trivial to check.
---
 .../gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp     | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp            | 4 ++--
 gdb/testsuite/gdb.dwarf2/gdb-index.exp                        | 2 +-
 gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp                   | 2 +-
 gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp            | 2 +-
 gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp              | 2 +-
 gdb/testsuite/gdb.dwarf2/loclists-start-end.exp               | 2 +-
 gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp            | 2 +-
 gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp              | 2 +-
 gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp                | 2 +-
 13 files changed, 14 insertions(+), 14 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
index 250f479e0274..9432415fdd0d 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
@@ -59,11 +59,11 @@  Dwarf::assemble $asm_file {
 
 save_vars { GDBFLAGS } {
     append GDBFLAGS " -iex \"maint set dwarf synchronous on\""
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 }
 
 set readnow_p [readnow]
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
index fa3bf5f4b3e0..1be466f513c7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
@@ -23,11 +23,11 @@  load_lib dwarf.exp
 require dwarf2_support
 
 standard_testfile .c -dw.S
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
-	return -1
+    return
 }
 
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
index 7f9f9464aaf5..e6859159c291 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
@@ -44,11 +44,11 @@  set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile}
 verbose -log "Executing: $command"
 set result [catch {exec {*}$command} output]
 verbose "result is $result"
 verbose "output is $output"
 if {$result != 0} {
-  return -1
+    return
 }
 
 gdb_load ${binfile_stripped}
 
 if {![runto "*${break_at}"]} {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
index 294e7c8bf45f..8032f71c7d9c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
@@ -93,11 +93,11 @@  gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
 with_test_prefix "ignore-prologue-end" {
     clean_restart $::testfile
     gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
 
     if {![runto_main]} {
-	return -1
+	return
     }
 
     # If we ignore the prologue-end flag, we should stop at the first statement
     # of main which assigns m.
     set prologue_end_line [gdb_get_line_number "main assign m"]
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
index 6d3bf29c1b10..94afa35f5588 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
@@ -25,16 +25,16 @@  standard_testfile main.c
 
 # First check whether we can actually handle the non-symlink case.
 with_test_prefix non-symlink {
     if { [prepare_for_testing "failed to prepare" "${testfile}" \
 	      [list ${srcfile}]] } {
-	return -1
+	return
     }
 
     if { [ensure_gdb_index $binfile] == -1 } {
 	untested "error adding gdb index"
-	return -1
+	return
     }
 }
 
 # Regenerate exec without index.
 if { [prepare_for_testing "failed to prepare" "${testfile}" \
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 456d7266c599..6ff1209ad1b6 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -115,11 +115,11 @@  gdb_test_multiple $cmd $test {
     }
     -re "(Psymtabs|Cooked).*${gdb_prompt} $" {
 	lassign [local_add_gdb_index $binfile] binfile_with_index host_binfile_with_index
 	set testfile_with_index [file tail $binfile_with_index]
 	if { ${binfile_with_index} == "" } {
-	    return -1
+	    return
 	}
     }
     -re ".*${gdb_prompt} $" {
 	fail "unrecognized symbol reader"
     }
diff --git a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
index f2a244791d16..edfcb8842d10 100644
--- a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
@@ -95,11 +95,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     if { ![runto_main] } {
 	return
     }
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
index a822f0c2f2e9..e2bacbcb8dc0 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
@@ -122,11 +122,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     if { ![runto_main] } {
 	return
     }
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
index b80639b32ddd..bc64b7adabd4 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
@@ -210,11 +210,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     if { ![runto_main] } {
 	return
     }
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
index f40d6fd8ec5c..c8d9f123625f 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
@@ -113,11 +113,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     if { ![runto_main] } {
 	return
     }
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
index d005c8b907cc..e48eb39f3a59 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
@@ -90,11 +90,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     # Sanity checks to make sure GDB slurped the symbols correctly.
     gdb_test "p/x &foo" " = 0x3000"
 }
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
index bbfc9e35c646..6207e31b9d0f 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
@@ -129,11 +129,11 @@  foreach_with_prefix is_64 {false true} {
 	}
     }
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 
     # Sanity checks to make sure GDB slurped the symbols correctly.
     gdb_test "p/x &foo" " = 0x4000"
     gdb_test "p/x &bar" " = 0x5000"
diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
index 4218dd119470..28a2fd7ad58c 100644
--- a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
@@ -122,11 +122,11 @@  Dwarf::assemble $asm_file {
 save_vars { GDBFLAGS } {
     append GDBFLAGS " -iex \"maint set dwarf synchronous on\""
 
     if { [prepare_for_testing "failed to prepare" ${testfile} \
 	      [list $srcfile $asm_file] {nodebug}] } {
-	return -1
+	return
     }
 }
 
 set re "DWARF Error: .debug_types section not supported in dwz file"
 gdb_assert { [regexp $re $gdb_file_cmd_msg] } "Dwarf Error message"