Clean up "return -1" in gdb.rust

This changes gdb.rust tests to use plain "return" rather than
"return -1".  In these spots, the "-1" has no meaning.

Approved-by: Kevin Buettner <kevinb@redhat.com>
This commit is contained in:
Tom Tromey
2025-10-30 09:20:25 -06:00
parent 12ef7d5b7b
commit 5b7bb3412e
20 changed files with 41 additions and 41 deletions

View File

@@ -22,13 +22,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
with_timeout_factor 2 {

View File

@@ -22,12 +22,12 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
if {[ensure_gdb_index $binfile -dwarf-5] == -1} {
untested "error adding gdb index"
return -1
return
}
gdb_exit

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "BREAK"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
# This 'finish' used to crash. See PR rust/30090. Also, this does

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print foo.f()" " = 6" "call impl function"

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print identity::<u32>(23u32)" " = 23"

View File

@@ -22,14 +22,14 @@ require {can_compile rust}
standard_testfile main.rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "BREAK"]
# The bug was that this would crash.
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
# Test that gdb is alive.

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint 1 here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print x" " = methods::HasMethods \\{value: 0\\}"

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
# Currently a closure type is not described by rustc.

View File

@@ -22,18 +22,18 @@ require {can_compile rust}
set v [split [rust_compiler_version] .]
if {[lindex $v 0] == 1 && [lindex $v 1] < 43} {
untested "128-bit ints require rust 1.43 or greater"
return -1
return
}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "BREAK"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print x" " = 340282366920938463463374607431768211455"

View File

@@ -22,7 +22,7 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set remote_python_file [gdb_remote_download host \
@@ -32,7 +32,7 @@ gdb_test_no_output "source ${remote_python_file}" "load python file"
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print outer" " = pp::Outer \\(x\\(5\\)\\)"

View File

@@ -22,13 +22,13 @@ require {rust_at_least 1.30}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print r#if" " = 23"

View File

@@ -25,13 +25,13 @@ require !use_gdb_stub
standard_testfile simple.rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
# Verify that "start" lands inside the right procedure.
if {[gdb_start_cmd] < 0} {
unsupported "start failed"
return -1
return
}
gdb_test "" \

View File

@@ -23,13 +23,13 @@ with_ansi_styling_terminal {
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "breakpoint"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
set vfield [style value variable]

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print a" " = \\(\\)"

View File

@@ -21,7 +21,7 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set readelf_program [gdb_find_readelf]
@@ -39,7 +39,7 @@ if {![regexp DW_AT_containing_type $output]} {
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print *td" " = 23.5"

View File

@@ -28,13 +28,13 @@ setenv LC_ALL C.UTF-8
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print 𝕯" " = 98" "print D"

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "print u" " = union::Union {f1: -1, f2: 255}"

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
gdb_test "ptype us" " = .*V<\\\[u8\\\]>.*"

View File

@@ -22,13 +22,13 @@ require {rust_at_least 1.61}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
set base_value \

View File

@@ -21,13 +21,13 @@ require {can_compile rust}
standard_testfile .rs
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
return -1
return
}
set line [gdb_get_line_number "set breakpoint here"]
if {![runto ${srcfile}:$line]} {
untested "could not run to breakpoint"
return -1
return
}
# Just setting a watchpoint was enough to trigger the bug.