"ln -sf ${testfile} [standard_output_file $filelink]"]
if {[lindex $status 0] != 0} {
unsupported "$test (host does not support symbolic links)"
- return 0
+ return
}
clean_restart "$filelink"
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set print repeats 10000"
set status [remote_exec host "ln -sf . [standard_output_file $dirlink]"]
if {[lindex $status 0] != 0} {
unsupported "$test (host does not support symbolic links)"
- return 0
+ return
}
clean_restart "$dirlink/$filelink"
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set print repeats 10000"
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
- return -1
+ return
}
}
set prelink_args [build_executable_own_libs ${testfile}.exp $executable $srcfile \
[list pie "additional_flags=-DGEN=\"$genfile\""]]
if {$prelink_args == ""} {
- return -1
+ return
}
}
set corefile [standard_output_file ${binfile}.corefile]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
# Traverse part of bigcore's linked list of memory chunks (forward or
clean_restart $testfile
if {![runto_main]} {
- return -1
+ return
}
do_test
gdb_exit
if {[gdb_spawn] != 0} {
fail "spawn gdb"
- return -1
+ return
}
}
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
set test "set breakpoint condition-evaluation $side"
# Some targets do not allow manually writing a breakpoint to a
# certain memory address, like QEMU. In that case, just bail out.
unsupported "cannot write to address $bp_address"
- return -1
+ return
}
-re " = .*$gdb_prompt $" {
pass $write_test
"check backtrace is supported" {
-re "support for this feature is not compiled into GDB" {
untested "feature not supported"
- return -1
+ return
}
-re "$gdb_prompt $" {
pass $gdb_test_name
gdb_test_multiple "maint set backtrace-on-fatal-signal on" "" {
-re "support for this feature is not compiled into GDB" {
untested $testfile
- return -1
+ return
}
-re "$gdb_prompt $" {
pass $gdb_test_name
if {[build_executable $testfile.exp $testfile ${srcfile} \
${compile_options}] == -1} {
untested "failed to compile"
- return -1
+ return
}
}
standard_testfile
if { [prepare_for_testing "failed to prepare" $testfile ${testfile}.c] } {
- return -1
+ return
}
if {![runto_main]} {
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
[list debug "additional_flags=-DPI_TXT=\"$pi_txt\" -DCOPY1_TXT=\"$copy1_txt\""]]} {
- return -1
+ return
}
global gdb_prompt
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable $opts] != "" } {
untested "failed to compile"
- return -1
+ return
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $opts] != "" } {
untested "failed to compile"
- return -1
+ return
}
proc not_null_var_address { var } {
if {!$has_ro_sections} {
unsupported "no read-only sections"
- return -1;
+ return
}
set orig -1
if {$orig == -1} {
untested "couldn't read address of read-only section"
- return -1
+ return
}
# Come up with different value.
if { $written != $patch } {
unsupported "can't patch read-only section"
- return -1
+ return
}
gdb_test "compare-sections -r" \
gdb_test_multiple $test_target $test_target {
-re "$warning\r\n$gdb_prompt $" {
unsupported $test_target
- return -1
+ return
}
-re "^$test_target\r\n$gdb_prompt $" {
# deletes the breakpoints.
with_test_prefix "with continue 1" {
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "$bp_location"
# Repeat with a condition that evaluates to false.
with_test_prefix "with continue 2" {
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "$bp_location"
# Repeat with a condition that contains junk at the end.
with_test_prefix "with junk" {
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "$bp_location"
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
- return -1
+ return
}
}
# If the target does not provide PID information (like usermode QEMU),
# just bail out as the rest of the test may rely on it, giving spurious
# failures.
- return -1
+ return
}
}
set corefile [core_find $binfile {} $args]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
}
set corefile_3 "$binfile.2.core"
set corefile [core_find $binfile]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_1 "$binfile.1.core"
remote_exec build "mv $corefile $corefile_1"
set corefile [core_find $symlink]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_2 "$binfile.2.core"
remote_exec build "mv $corefile $corefile_2"
set corefile [core_find $symlink]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_3 "$binfile.3.core"
remote_exec build "mv $corefile $corefile_3"
set corefile [core_find $binfile_2]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_4 "$binfile.4.core"
remote_exec build "mv $corefile $corefile_4"
set corefile [core_find $rel_path_to_file]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_5 "${work_dir}/${testfile}.5.core"
remote_exec build "mv $corefile $corefile_5"
set corefile [core_find $rel_path_to_symlink_2]
if {$corefile == ""} {
untested "unable to create corefile"
- return 0
+ return
}
set corefile_6 "${work_dir}/${testfile}.6.core"
remote_exec build "mv $corefile $corefile_6"
# These tests don't rely on the debug format.
with_test_prefix nodebug {
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}] } {
- return 0
+ return
}
gdb_test "ptype _Atomic int" "type = _Atomic int"
# Only GNU/Linux is known to support this.
if { ! [istarget "*-*-linux*"] } {
- return 0
+ return
}
standard_testfile attach.c
}
if {![runto_main]} {
- return 0
+ return
}
gdb_test "break function" \
if {[gdb_compile "${srcdir}/${subdir}/dmsym.c" \
$dmsym_o \
object {}] != ""} {
- untested "failed to compile object file"
- return -1
+ untested "failed to compile object file"
+ return
}
if {[gdb_compile \
if { [prepare_for_testing "prepare" $testfile $srcfile \
[list debug shlib=$binfile_libdso2 shlib=$binfile_libdso1]] != 0 } {
- return
+ return
}
gdb_load_shlib $binfile_libdso2
gdb_load_shlib $binfile_libdso1
if { ![runto_main] } {
- return -1
+ return
}
set bp_location [gdb_get_line_number "STOP HERE" [file tail $srcfile_libdso1]]
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=-DTEST_SSO=$test_sso]] } {
- return -1
+ return
}
set bp_location [gdb_get_line_number "START"]
if {![runto "endianity.c:$bp_location"]} {
- return -1
+ return
}
gdb_test "print o" "= {v = 3, w = 2, x = 7, f = 23.5, cplx = 1.25 \\+ 7.25i, d = 75}" \
# build the first test case
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $compile_options] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
# Test exec catchpoints to ensure exec events are supported.
with_cwd [standard_output_file {}] {
if { [gdb_compile [standard_output_file tmp-${srcfile}] "${testfile}" \
executable {debug}] != "" } {
- return -1
+ return
}
}
if { $err != "" } {
untested "${srcfile} or ${srcfile2} compilation failed"
- return -1
+ return
}
}
if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != ""
|| [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
set opts [list debug shlib=${binfile_lib} ldflags=-Wl,-z,relro]
if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
- unsupported "-Wl,-z,relro compilation failed"
- return -1
+ unsupported "-Wl,-z,relro compilation failed"
+ return
}
with_test_prefix "first session" {
gdb_load_shlib ${binfile_lib}
if {![runto lib]} {
- return -1
+ return
}
if {![gdb_gcore_cmd $gcorefile "save a corefile"]} {
- return -1
+ return
}
}
set corefile [standard_output_file gcore.test]
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
if {!$core_supported} {
- return -1
+ return
}
# Now restart gdb and load the corefile.
set corefile [standard_output_file ${testfile}.core]
if {[build_executable "failed to build" $testfile ${srcfile}] == -1 } {
- return -1
+ return
}
# Cleanup.
gdb_load_shlib $binfile_lib2
if { ![runto_main] } {
- return -1
+ return
}
gdb_test "next" "$decimal.*b_main \\(\\);" "step over c_main"
|| [gdb_compile "${srcdir}/${subdir}/$srcfile $lib_o $final_o" \
$staticbinfile executable {debug}] != "" } {
untested "failed to compile second testcase"
- return -1
+ return
}
clean_restart $staticexecutable
&& [do_compile {-mcpu=native -Wno-psabi}] != ""
&& [do_compile {-march=native}] != ""
&& [do_compile] != ""} {
- untested "compiler can't handle vector_size attribute?"
- return -1
+ untested "compiler can't handle vector_size attribute?"
+ return
}
clean_restart $testfile
with_timeout_factor 3 {
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set max-value-size unlimited"
|| [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \
executable $bin_flags] != "" } {
untested "failed to compile"
- return -1
+ return
}
if {$libsepdebug == "SEP"} {
clean_restart $executable
if {![runto_main]} {
- return 0
+ return
}
set match_str {All functions matching regular expression "foo":[\r\n]*}
if {[prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $srcfile2] {debug nowarnings}]} {
- return -1
+ return
}
}
-re "Not supported on this target.*$gdb_prompt $" {
# info proc command not supported -- nothing to test here.
unsupported "gdb does not support info proc on this target"
- return -1
+ return
}
}
gdb_test_no_output "set style enabled off"
if {![runto_main]} {
- return 0
+ return
}
gdb_breakpoint "stop"
gdb_continue_to_breakpoint "library load #1" "\\.?stop .*"
gdb_test "hello" [string_to_regexp "^done,value=\"23\""]
if {![runto_main]} {
- return -1
+ return
}
gdb_test "list" ".*\[0-9\].*main \\(int argc.*" "can list sources"
gdb_load $binfile_dl2
if {![runto_main]} {
- return -1
+ return
}
set num_bps 0
"Switching to inferior ${inf} .*" \
"switch to inferior ${inf}"
if {![runto_main]} {
- return -1
+ return
}
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "break -q here" \
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
proc do_test { with_probes } {
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
- return -1
+ return
}
}
}
if {$err != ""} {
untested "failed to compile"
- return -1
+ return
}
clean_restart $filename
if {[build_executable $testfile.exp $testfile \
[list $srcfile $srcfile2 $srcfile3 $srcfile4 $srcfile5 $srcfile6] \
"debug ldscript=-Wl,-T$linker_script"] == -1} {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
remote_exec build "mv ${testfile}.o foo.o bar.o baz.o grbx.o ovlymgr.o ${objdir}/${subdir}"
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
proc test_integer_literals_accepted {} {
clean_restart $testfile
if {![runto_main]} {
- return -1
+ return
}
do_test
gdb_test_multiple "${test}" "${test}" {
-re "Disabling randomization .* unsupported .*$gdb_prompt $" {
untested "disabling randomization is not supported on this Linux GDB"
- return -1
+ return
}
-re "No symbol .* in current context.*$gdb_prompt $" {
untested "disabling randomization is not supported on this GDB platform"
- return -1
+ return
}
-re "$gdb_prompt $" {
pass $test
}
-re "$gdb_prompt " {
fail $test
- return 0
+ return
}
}
if { ![readline_is_used] } {
unsupported "readline isn't used."
- return -1
+ return
}
save_vars { timeout env(GDBHISTSIZE) env(GDBHISTFILE) } {
save_vars { GDBFLAGS } {
append GDBFLAGS " --readnever"
if { [clean_restart $testfile] == -1 } {
- return -1
+ return
}
}
remote_exec build "rm -f ${binfile}"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
clean_restart
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" \
executable ${testfile1_opt}] != "" } {
untested "failed to compile first testcase"
- return -1
+ return
}
# build the second test case
&& [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \
executable ${testfile2_opt2}] != ""} {
untested "failed to compile second testcase"
- return -1
+ return
}
# Start with a fresh gdb.
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
set allow_float_test [allow_float_test]
standard_testfile .c
if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
proc_with_prefix test_setshow_annotate {} {
}
if {![runto_main]} {
- return 0
+ return
}
# Run until the program dies.
clean_restart $testfile
if {![runto_main message]} {
- return 0
+ return
}
if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $sep_lib_flags] != ""
|| [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
untested "failed to compile"
- return -1
+ return
}
if {$libsepdebug == "SEP"} {
clean_restart $executable
if {![runto_main]} {
- return 0
+ return
}
gdb_test "display (int) a_global" "1: \\(int\\) a_global = 41"
|| [gdb_compile_shlib ${srcfile_lib} ${binfile_lib2} $lib_flags] != ""
|| [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
untested "failed to compile"
- return -1
+ return
}
if {[catch {exec prelink -N -r ${prelink_lib1} ${binfile_lib1}} output] != 0
# Maybe we don't have prelink.
verbose -log "prelink failed: $output"
untested "could not prelink ${binfile_lib1_test_msg} or ${binfile_lib2_test_msg}."
- return -1
+ return
}
set test_spawn_id [spawn_wait_for_attach $binfile]
|| [gdb_compile_shlib ${srcfile_lib} ${binfile_lib2} $lib_flags] != ""} {
untested "failed to compile shared library"
kill_wait_spawned_process $test_spawn_id
- return -1
+ return
}
clean_restart ${binfile_base}
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
if {!$core_supported} {
- return -1
+ return
}
# Before we restart gdb, replace the libs with the "wrong" ones.
delete_breakpoints
if {![runto_main]} {
- return 0
+ return
}
# Break in the library.
-re "( test-fail .*|\r\nCannot insert breakpoint 0\\.\r\n.*)\r\n$gdb_prompt $" {
xfail $test
untested "system lacks support for tracking longjmps"
- return -1
+ return
}
}
gdb_test_no_output {delete $test_fail_bpnum}
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
- return -1
+ return
}
if {![runto_main]} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "set breakpoint here"]
}
if {![runto_main]} {
- return 0
+ return
}
set remote_linefile [gdb_remote_download host ${srcdir}/${subdir}/${linefile}]
}
if {![runto_main]} {
- return 0
+ return
}
# Set a breakpoint at line 45, if stepi then finish fails, we would
-re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" {
# Oops... We ran to the end of the program... Better reset
if {![runto_main]} {
- return 0
+ return
}
if {![runto step-test.c:45]} {
- return 0
+ return
}
fail "$test"
}
with_ansi_styling_terminal {
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
- return -1
+ return
}
if {![runto_main]} {
# and start with a fresh gdb
if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
- return -1
+ return
}
# Test that the inferior sees EXPECTED env vars starting with
}
if {![runto "parent_stop"]} {
- return -1
+ return
}
# We don't want to be bothered.
fail "$test (remote connection closed)"
# Only if valgrind got stuck.
kill_wait_spawned_process $valgrind_spawn_id
- return -1
+ return
}
-re "The program is not being run\\.\r\n$gdb_prompt $" {
fail "$test (valgrind vgdb has terminated)"
# Only if valgrind got stuck.
kill_wait_spawned_process $valgrind_spawn_id
- return -1
+ return
}
-re "\r\n$gdb_prompt $" {
pass "$test (false warning)"
fail "$test (remote connection closed)"
# Only if valgrind got stuck.
kill_wait_spawned_process $valgrind_spawn_id
- return -1
+ return
}
-re "The program is not being run\\.\r\n$gdb_prompt $" {
fail "$test (valgrind vgdb has terminated)"
# Only if valgrind got stuck.
kill_wait_spawned_process $valgrind_spawn_id
- return -1
+ return
}
-re "\r\n$gdb_prompt $" {
pass "$test (false warning)"
set corefile [standard_output_file $testfile.core]
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
if {!$core_supported} {
- return -1
+ return
}
clean_restart ${testfile}
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
# True if we're forcing no hardware watchpoints.
set bp_location [gdb_get_line_number "START"]
if {![runto "wchar.c:$bp_location"]} {
- return -1
+ return
}
gdb_test "print narrow" "= 97 L'a'"
if {[gdb_compile "${srcdir}/${subdir}/$opaque_testfile.c" \
$opaque_objfile \
object {}] != ""} {
- untested "failed to compile"
- return -1
+ untested "failed to compile"
+ return
}
if {[gdb_compile \