[binutils-gdb] GDB: testsuite: Don't return value from top-level in tests of various arches

Thiago Bauermann bauermann@sourceware.org
Fri May 8 22:00:37 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7da5bc0327efeec136937cde60a9a67517f1fcee

commit 7da5bc0327efeec136937cde60a9a67517f1fcee
Author: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Date:   Wed Apr 29 20:04:02 2026 -0300

    GDB: testsuite: Don't return value from top-level in tests of various arches
    
    This patch contains fixes for alpha, arc, avr, hppa and sh architectures.
    
    Some changes are the result of running:
    
    $ sed -i 's/^    return -1/    return/' *.exp
    
    and
    
    $ sed -i 's/^    return 0/    return/' *.exp
    
    inside gdb/testsuite/gdb.arch and some are manual changes.
    
    I didn't include changes made to return statements inside procedures.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/testsuite/gdb.arch/alpha-step.exp           |  2 +-
 gdb/testsuite/gdb.arch/arc-analyze-prologue.exp |  4 ++--
 gdb/testsuite/gdb.arch/arc-dbnz.exp             |  4 ++--
 gdb/testsuite/gdb.arch/arc-decode-insn.exp      |  4 ++--
 gdb/testsuite/gdb.arch/avr-flash-qualifier.exp  | 10 +++++-----
 gdb/testsuite/gdb.arch/gdb1291.exp              |  4 ++--
 gdb/testsuite/gdb.arch/gdb1431.exp              |  4 ++--
 gdb/testsuite/gdb.arch/gdb1558.exp              |  2 +-
 gdb/testsuite/gdb.arch/pa-nullify.exp           |  8 ++++----
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp
index a15f86ea656..d47b359c08d 100644
--- a/gdb/testsuite/gdb.arch/alpha-step.exp
+++ b/gdb/testsuite/gdb.arch/alpha-step.exp
@@ -22,7 +22,7 @@ set binfile ${objdir}/${subdir}/${testfile}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
     unsupported "failed to compile"
-    return -1
+    return
 }
 
 clean_restart
diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
index 01699016dd6..693e5efe226 100644
--- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
+++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
@@ -26,11 +26,11 @@ standard_testfile .S
 set options {}
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } {
-    return -1
+    return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Convert list of saved registers and their offsets to a GDB string.
diff --git a/gdb/testsuite/gdb.arch/arc-dbnz.exp b/gdb/testsuite/gdb.arch/arc-dbnz.exp
index ce93a620293..2c091e45ecf 100644
--- a/gdb/testsuite/gdb.arch/arc-dbnz.exp
+++ b/gdb/testsuite/gdb.arch/arc-dbnz.exp
@@ -34,11 +34,11 @@ require {istarget "arc*-*-*"}
 standard_testfile .S
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
-    return -1
+    return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "break dbnz1" \
diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.exp b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
index 0a7582d03a2..4247c0215b8 100644
--- a/gdb/testsuite/gdb.arch/arc-decode-insn.exp
+++ b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
@@ -36,11 +36,11 @@ require {istarget "arc*-*-*"}
 standard_testfile .S
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
-    return -1
+    return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Helper function that reads properties of instruction from the ELF file via
diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
index a62e629f920..e9a523a5d05 100644
--- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
+++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
@@ -22,18 +22,18 @@ require {istarget "avr*"}
 
 # The __flash qualifier was added in GCC 4.7.
 if {[test_compiler_info {gcc-[0-4]-[0-6]}]} {
-  verbose "Skipping ${gdb_test_file_name}."
-  return
+    verbose "Skipping ${gdb_test_file_name}."
+    return
 }
 
 standard_testfile
 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
-  return -1
+    return
 }
 
 if {![runto [gdb_get_line_number "break here."]]} {
-  untested "could not run to \"break here.\""
-  return -1
+    untested "could not run to \"break here.\""
+    return
 }
 
 gdb_test "print pointer_to_flash" \
diff --git a/gdb/testsuite/gdb.arch/gdb1291.exp b/gdb/testsuite/gdb.arch/gdb1291.exp
index 82f9d52e08b..ba4b88d7511 100644
--- a/gdb/testsuite/gdb.arch/gdb1291.exp
+++ b/gdb/testsuite/gdb.arch/gdb1291.exp
@@ -30,7 +30,7 @@ set srcfile ${testfile}.s
 set binfile ${objdir}/${subdir}/${testfile}
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
     untested "failed to compile"
-    return -1
+    return
 }
 
 clean_restart
@@ -41,7 +41,7 @@ gdb_load $binfile
 #
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "b sub1" "Breakpoint 2.*" "set breakpoint"
diff --git a/gdb/testsuite/gdb.arch/gdb1431.exp b/gdb/testsuite/gdb.arch/gdb1431.exp
index 89952275d19..aedf6618318 100644
--- a/gdb/testsuite/gdb.arch/gdb1431.exp
+++ b/gdb/testsuite/gdb.arch/gdb1431.exp
@@ -32,7 +32,7 @@ set srcfile ${testfile}.s
 set binfile ${objdir}/${subdir}/${testfile}
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
     untested "failed to compile"
-    return -1
+    return
 }
 
 clean_restart
@@ -43,7 +43,7 @@ gdb_load $binfile
 #
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "advance sub1" "hello world\r\n$hex in sub1 \\(\\)" "get to sub1"
diff --git a/gdb/testsuite/gdb.arch/gdb1558.exp b/gdb/testsuite/gdb.arch/gdb1558.exp
index 5fbf86f5889..7a3f4475645 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.exp
+++ b/gdb/testsuite/gdb.arch/gdb1558.exp
@@ -29,7 +29,7 @@ set binfile ${objdir}/${subdir}/${testfile}
 # Note we have to compile WITH optimization and WITHOUT debugging information to expose the bug.
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-O2"}] != "" } {
     untested "failed to compile"
-    return -1
+    return
 }
 
 clean_restart
diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp
index 1606d44afbf..e527fe0955d 100644
--- a/gdb/testsuite/gdb.arch/pa-nullify.exp
+++ b/gdb/testsuite/gdb.arch/pa-nullify.exp
@@ -37,7 +37,7 @@ set gcorefile ${objdir}/${subdir}/${testfile}.gcore
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
     unsupported "failed to compile"
-    return -1
+    return
 }
 
 clean_restart
@@ -87,7 +87,7 @@ proc get_addr_of_sym { sym } {
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set foo [get_addr_of_sym "foo"]
@@ -123,7 +123,7 @@ proc test_core_bt { test } {
 
 set test "core at last insn in foo"
 if {![runto_main]} {
-    return 0
+    return
 }
 gdb_breakpoint "*$foo_last"
 gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"
@@ -133,7 +133,7 @@ if {[gen_core $test]} {
 
 set test "core at nullified insn"
 if {![runto_main]} {
-    return 0
+    return
 }
 gdb_breakpoint "*$foo_last"
 gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"


More information about the Gdb-cvs mailing list