if {[build_executable ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
set cmd "print i64_var"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
with_test_prefix "first first" {
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
untested "failed to compile"
- return -1
+ return
}
# Make some DWARF for the test.
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Note: This test may fail with certain clang + linker combinations
standard_testfile .cc
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
- return -1
+ return
}
set cmd "ptype main"
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "ptype f" "int \\(const _Atomic char \\\* volatile _Atomic\\)"
if {[build_executable "failed to build executable" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
set eol "\r\n"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "info addr foo1" \
}
if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "p var" " = <optimized out>"
set sources [list $srcfile $srcfile2]
if { [prepare_for_testing "failed to prepare" ${testfile} $sources] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
get_debug_format
if { [skip_inline_frame_tests] } {
- return -1
+ return
}
# Set a break-point in inline function bar, in a CU for which the partial
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
[list {additional_flags=-nostdlib}]]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "break *func" "Breakpoint 2.*" "set breakpoint for call-frame-cfa"
# First compile the .c file so we can ask GDB what is sizeof(int).
if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
untested "failed to compile"
- return -1
+ return
}
# Make some DWARF for the test.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "call foo ()" \
if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \
{nodebug nopie additional_flags=-nostdlib}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Initialize tests to be an empty array.
if {[prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
gdb_test "print 1" "= 1" "recover from corrupt DWARF"
if { [prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "ptype array" "type = char \\\[5\\\]"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_assert [runto_main] "run to main"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if { ![runto_main] } {
- return -1
+ return
}
gdb_continue_to_end
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
gdb_test "break *$main_start" ".*Breakpoint $decimal at $hex" \
# specifically for this testcase, might as well use that.
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
# Make some DWARF for the test.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if {[build_executable ${testfile}.exp $testfile "${asm_file} ${srcfile}" \
[list ldflags=-nostartfiles]] == -1} {
- return -1
+ return
}
clean_restart
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
[list ldflags=-nostartfiles]]} {
- return -1
+ return
}
# Check for warning.
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
[list ldflags=-nostartfiles]]} {
- return -1
+ return
}
# Verify that .debug_names section is not ignored.
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
[list ldflags=-nostartfiles]]} {
- return -1
+ return
}
# Verify that .debug_names section is not ignored.
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
[list ldflags=-nostartfiles]]} {
- return -1
+ return
}
# Verify that .debug_names section is not ignored.
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile {debug} main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
set test "info sources should contain only one reference to file1.txt"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Without the corresponding fix, we get an internal error:
set executable ${testfile}
if {[build_executable ${testfile}.exp ${executable} $sources $flags] == -1} {
- return -1
+ return
}
clean_restart $executable
set executable ${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $executable
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set lang c++"
if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
object {debug}] != "" } {
untested "failed to compile"
- return -1
+ return
}
clean_restart
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if { [prepare_for_testing "failed to prepare" $testfile \
[list $asm_file $srcfile ]] } {
- return -1
+ return
}
# Failed gdb_load would abort the testcase execution earlier.
if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
untested "failed to compile"
- return -1
+ return
}
set int_size [get_sizeof "int" 4]
if { [build_executable ${testfile}.exp ${testfile} \
[list $srcfile $srcfile2 $asm_file] {nodebug}] } {
- return -1
+ return
}
# Attempt to place a breakpoint on 'some_func', then check GDB is
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# A successful run will have two PASSes. A GDB that's lacking
# First try referencing DW_AT_frame_base which is not defined.
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $executable
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "ptype var" "type = bool"
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Make sure we can print both types correctly.
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
[list nodebug $additional_flags]]} {
- return -1
+ return
}
# The correct new[] and delete[] syntax is probably unsupported by GDB.
if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile \
{nodebug nopie f90}] } {
- return -1
+ return
}
if {![runto MAIN__]} {
standard_testfile .S
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
$additional_flags]} {
- return -1
+ return
}
# Here should be GDB-computed "Compilation directory is".
if {[prepare_for_testing "failed to prepare" $testfile \
"${srcfile}" {}]} {
- return -1
+ return
}
set float_size [get_sizeof float 0]
if {[prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
proc do_test { type {clang 0}} {
[list $testfile \
{debug additional_flags=-static additional_flags=-nostdlib} \
main.c -g0 $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_test "print twelve" "= 12"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile2 $srcfile] {}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# main is not provided by DWARF.
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_test "ptype noloc" "type = const int"
# $srcdir may be relative.
if {[file pathtype $srcabsdir] != "absolute"} {
untested "objdir pathtype is not absolute"
- return -1
+ return
}
set f [open $asmsrcfile "w"]
if { [gdb_compile "${asmsrcfile} ${srcdir}/${subdir}/$srcfile" "${binfile}" executable $opts] != "" } {
untested "failed to compile"
- return -1
+ return
}
set dirs {}
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "cd ${srcabsdir}/rdir" "Working directory [string_to_regexp ${srcabsdir}]/rdir\\." "cd .../rdir"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug} ] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Global lines array, maps lines numbers to the list of addresses
set executable ${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $executable
if { [gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
object {nodebug}] != "" } {
- return -1
+ return
}
clean_restart $testfile
set executable ${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $executable
standard_testfile .S
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie}] } {
- return -1
+ return
}
if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
- return -1
+ return
}
gdb_test "bt" \
if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
clean_restart
# can't be disabled.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list ${srcfile}] {debug nopie}] } {
- return -1
+ return
}
# Some addresses that we need when generating the DWARF.
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
object {nodebug}] != "" } {
- return -1
+ return
}
clean_restart $testfile
set executable ${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $executable
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list ${srcfile}] {debug nopie}]} {
- return -1
+ return
}
# Address for the middle of foo. This is used as our entry point when
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Try whether we can set and hit breakpoints at the entry_points.
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "*fooso"
if { [prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if { ![runto *main] } {
require dwarf2_support
if { [prepare_for_testing "failed to prepare" "dw2-entry-value" {dw2-entry-value-main.c dw2-entry-value.S} {nodebug}] } {
- return -1
+ return
}
if {![runto f]} {
- return -1
+ return
}
# FAIL was printing:
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Moving to the scope with a local variable.
# We can't use prepare_for_testing here because we need to check the
# 'file' command's output.
if {[build_executable $testfile.exp $testfile $srcfile {nodebug quiet}]} {
- return -1
+ return
}
clean_restart
set dwarf_srcfile "file1.txt"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {nodebug}] != "" } {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Do the testing in Ada mode, since this is the language for which
set asm_file [create_dwarf_assembly $srcfile2 false]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set debug symtab-create 1"
set asm_file [create_dwarf_assembly $srcfile3 true]
if {[prepare_for_testing "failed to prepare" ${testfile}-one-diridx \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "ptype bar" ".*" "do not crash with only one directory table entry"
if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}] } {
- return -1
+ return
}
# We are trying to verify that the partial symtab to symtab expansion
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto func]} {
- return -1
+ return
}
gdb_test "p/x param" " = 0xdeadf00d"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
object {nodebug}] != "" } {
- return -1
+ return
}
clean_restart $testfile
standard_testfile .S
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}] } {
- return -1
+ return
}
#
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] $build_options] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] $build_options] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# First we step through all of the functions until we get the 'kkk'.
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list $srcfile2 $srcfile] {nodebug nopie}] } {
- return -1
+ return
}
set break_at ""
gdb_load ${binfile_stripped}
if {![runto "*${break_at}"]} {
- return -1
+ return
}
set index [have_index $binfile_stripped]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug optimize=-O1}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
set patterns [list "main call foo" \
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
runto breakpoint_label
if {[build_executable "failed to prepare" $testfile \
[list $asm_file $srcfile] {nodebug}]} {
- return -1
+ return
}
clean_restart
if {[build_executable "failed to prepare" $testfile \
[list $asm_file $srcfile] {nodebug}]} {
- return -1
+ return
}
clean_restart
if {[prepare_for_testing "failed to prepare" $testfile \
[list $asm_file $srcfile] {nodebug}]} {
- return -1
+ return
}
# Regression test for PR32081.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto main]} {
- return -1
+ return
}
gdb_test "p var1" " = 1"
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
set remote_dwarf_srcfile [gdb_remote_download host \
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Check stepping through the out of order lines gives the experience
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# First, break by address at a location we know is marked as not a
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
runto_main
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "$srcfile:27"
gdb_test "n" "foo \\(4\\);" "bar2, 2nd next"
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "bar1_label_3"
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile c++ $testfile-main.cc {c++ nodebug} \
$srcfile {}]]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# main is not provided by DWARF.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
set breakpoint_at_missing_lineno_set [gdb_breakpoint "1" no-message]
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
${additional_flags}]} {
- return -1
+ return
}
# The "info func" code tries to expand the corresponding symtab when a
# file command (so we can check its output).
if {[build_executable "failed to build executable" $testfile \
[list $srcfile $asm_file] {nodebug quiet}]} {
- return -1
+ return
}
set host_binfile [gdb_remote_download host $binfile]
# First try referencing DW_AT_frame_base which is not defined.
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $testfile
if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" object \
$opts] != "" } {
- return -1
+ return
}
clean_restart $::testfile
if {[prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "ptype '(anonymous namespace)::v'" "type = myint"
standard_testfile .c main.c
if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"]} {
- return -1
+ return
}
set cmd "p var"
}
if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Symbols have the form: {file,main}_loc{addr,empty,no}_{,un}resolvable
file_symbols no-run
if {![runto_main]} {
- return -1
+ return
}
file_symbols in-main
object {}] != ""
|| [gdb_compile "${srcdir}/${subdir}/${srcfile_inner}" "${binfile_inner}" \
object {}] != "" } {
- return -1
+ return
}
clean_restart $executable_outer
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}] } {
- return -1
+ return
}
# Additional test to verify the referenced CU is not aged out.
# Location lists need PC.
if {![runto_main]} {
- return -1
+ return
}
gdb_test "p arraynoloc" " = <optimized out>"
gdb_test "p arraycallnoloc" {Asked for position 0 of stack, stack only has 0 elements on it\.}
require is_x86_64_m64_target
if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "breakpt"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
object {nodebug}] != "" } {
- return -1
+ return
}
clean_restart $testfile
}
if { [build_test_program] == -1 } {
- return -1
+ return
}
do_console_test
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
set test "END with address 1 eliminated"
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list $srcfile2 $srcfile] {nodebug}] } {
- return -1
+ return
}
if {![runto f]} {
- return -1
+ return
}
# FAIL was printing:
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Don't runto main here, otherwise the following doesn't
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
set prologue_end_line [gdb_get_line_number "main assign o"]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Make use of the line numbers we faked in the .debug_line table above.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto foo]} {
- return -1
+ return
}
gdb_test "show language" \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list ${srcfile} ${srcfile2}]] } {
- return -1
+ return
}
set asm_file [standard_output_file $srcfile3]
if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2 $asm_file] {nodebug}] } {
- return -1
+ return
}
clean_restart
gdb_load_no_complaints $binfile
if {![runto_main]} {
- return -1
+ return
}
# Generate backtrace from baz, that visits the hole in the addrmap. If
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list ${srcfile} ${srcfile2}]] } {
- return -1
+ return
}
set asm_file [standard_output_file $srcfile3]
if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2 $asm_file] {nodebug}] } {
- return -1
+ return
}
clean_restart
gdb_load_no_complaints $binfile
if {![runto_main]} {
- return -1
+ return
}
# "someothername" should be put into the partial symbol table, but
$srcfile [concat $flags {nodebug}] \
$srcfile2 {nodebug} \
$srcfile3 {debug}]] == -1 } {
- return -1
+ return
}
# First try referencing DW_AT_frame_base which is not defined.
standard_testfile .S
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie}] } {
- return -1
+ return
}
if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
- return -1
+ return
}
gdb_test "bt" "#0 (${::hex} in )?stop_frame \[^\r\n\]*\r\n#1 \[^\r\n\]*first_frame \[^\r\n\]*\r\n#2 \[^\r\n\]*main\[^\r\n\]*" \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
runto_main
if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile] \
$opts]} {
- return -1
+ return
}
if {![runto foo]} {
- return 0
+ return
}
gdb_test "continue" "$hex in foo \\(\\)"
gdb_test "where" "#0 +$hex in foo \\(\\)\r\n#1 +$hex in _start \\(\\)"
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
{nodebug nopie}]} {
- return -1
+ return
}
gdb_test "ptype f" "int \\(char \\\* restrict\\)"
standard_testfile .S
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart $testfile
set csrcfile ${testfile}.c
if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {nodebug nopie}] } {
- return -1
+ return
}
if {![runto_main]} {
"${testfile}.c ${testfile}.S" \
[list additional_flags=-DINLINED \
additional_flags=-DPTRBITS=$ptrbits]] == -1 } {
- return -1
+ return
}
# We need those symbols global to access them from the .S file.
clean_restart $executable
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "func"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if { ![runto_main] } {
- return -1
+ return
}
# Check the END markers using 'maint info line-table'.
standard_testfile .S
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
clean_restart
if {[prepare_for_testing "failed to prepare" "${::testfile}" \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint bar
if {[prepare_for_testing "failed to prepare" "${::testfile}" \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint bar
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Step into bar.
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_test "p a_string" " = \"hello world!\\\\n\""
if { [prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile}" {}] } {
- return -1
+ return
}
# Check that no symtabs are expanded.
if { [prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile}" {}] } {
- return -1
+ return
}
# Check that no symtabs are expanded.
set test "no symtabs expanded"
if { [readnow] } {
unsupported $test
- return -1
+ return
}
gdb_test_no_output "maint info symtabs" $test
[list $testfile $lopts \
$srcfile $opts \
$srcfile2 $opts2]] } {
- return -1
+ return
}
gdb_test_no_output \
require is_x86_64_m64_target
if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile {nodebug nopie}]} {
- return -1
+ return
}
if {![runto "stop_frame"]} {
- return -1
+ return
}
# If test is compiled with clang, GDB would display absolute path.
if { [prepare_for_testing "failed to prepare" "dw2-unresolved" \
{dw2-unresolved-main.c dw2-unresolved.S} \
[list nodebug $additional_flags]] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# This testcase tests LOC_UNRESOLVED works right.
if {[prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile} ${srcfile2}" {}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
foreach f {foo bar foo2} {
# would do, but since we already have one specifically for this
# testcase, might as well use that.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
set int_size [get_sizeof "int" -1]
standard_testfile .c -dw.S
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
set asm_file [standard_output_file $srcfile2]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Print the type of global_var. This type information is entirely
set status [lindex $result 0]
set output [lindex $result 1]
if { $status == 0 && ![string equal $output ""] } {
- return -1
+ return
}
# Now copy the executable, and remove the .debug_str section. This
set args "--remove-section .debug_str $host_binfile ${binfile_no_debug_str}"
if {[run_on_host "objcopy" [gdb_find_objcopy] "$args"]} {
perror "failed to run objcopy"
- return -1
+ return
}
# Restart GDB, but don't load an executable. When we do load the
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}]} {
- return -1
+ return
}
proc test { } {
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "$srcfile:27" message
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# At one point this would trigger a divide by zero inside GDB. Now we
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "func_demangled_test"
set executable ${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
- return -1
+ return
}
save_vars { GDBFLAGS } {
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list $srcfile $srcfile2] \
{debug c++ additional_flags=-gdwarf-4 additional_flags=-fdebug-types-section}] } {
- return -1
+ return
}
# Stress test gdb's handling of cached comp units, disable the cache.
gdb_test_no_output "maint set dwarf max-cache-age 0"
if {![runto_main]} {
- return -1
+ return
}
# Bring symtab for myset into gdb.
if { [prepare_for_testing "failed to prepare" "${testfile}" \
$srcfile {debug c++ additional_flags=-gdwarf-4 \
additional_flags=-fdebug-types-section}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "ptype X" "type = struct X {.*"
if { [prepare_for_testing "failed to prepare" "${testfile}" \
$srcfile {debug c++ dwarf5 additional_flags=-O0}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint [gdb_get_line_number "break-here"]
standard_testfile
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
- return -1
+ return
}
if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
- return 0
+ return
}
# Note: the procedure gdb_gnu_strip_debug will produce an executable called
if {[gdb_gnu_strip_debug $binfile$EXEEXT]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
- return -1
+ return
}
clean_restart "$testfile"
remote_file host delete [standard_output_file ${testfile}.dwp]
if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "dwp file cannot be deleted"
- return 0
+ return
}
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
- return -1
+ return
}
if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
- return 0
+ return
}
set thelink "${testfile}-thelink"
remote_exec host "ln -sf ${testfile} [standard_output_file $thelink]"
if {![remote_file host exists [standard_output_file $thelink]]} {
unsupported "host does not support symbolic links (binary symlink is missing)"
- return 0
+ return
}
if {[remote_file host exists [standard_output_file $thelink.dwp]]} {
unsupported "host does not support symbolic links (we tried to delete a file and it is still there)"
- return 0
+ return
}
clean_restart "$testfile"
remote_exec host "mv -f [standard_output_file ${testfile}.dwp] [standard_output_file ${thelink}.dwp]"
if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "host does not support symbolic links (binary symlink exists)"
- return 0
+ return
}
if {![remote_file host exists [standard_output_file ${thelink}.dwp]]} {
unsupported "host does not support symbolic links (dwp symlink is missing)"
- return 0
+ return
}
clean_restart "$testfile"
clean_restart "${dwp_symlink_dir}/${dwp_symlink_binary}"
if {![runto_main]} {
- return -1
+ return
}
gdb_test {print argv[0]} "/${dwp_symlink_binary}\"" \
$srcfile {nodebug} \
$asm_file {nodebug} \
$srcfile3 {debug}]]} {
- return -1
+ return
}
set linenr [gdb_get_line_number "return 0" $srcfile3]
if { [prepare_for_testing "failed to prepare" $testfile \
[list $asm_file $srcfile] {nodebug}] } {
- return -1
+ return
}
set cmd "p the_int"
}
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "p other_int" " = 99"
# 'file' command's output.
if {[build_executable $testfile.exp $testfile \
[list $srcfile $asm_file] {nodebug quiet}]} {
- return -1
+ return
}
clean_restart
lappend_include_file flags $srcdir/lib/attributes.h
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $flags] } {
- return -1
+ return
}
with_shared_gdb {
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list $srcfile $asm_file] $flags] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_breakpoint "marker_label"
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
gdb_test_no_output "set language ada"
# specifically for this testcase, might as well use that.
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
# Make some DWARF for the test.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set language ada"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Expand cu1. This will enqueue cu2.
if { [prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $srcfile2] {debug c++}] } {
- return -1
+ return
}
require {string equal [have_index $binfile] ""}
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "print sizeof(enum E)" " = 4"
if { [build_executable_and_dwo_files "${testfile}.exp" ${binfile} {nodebug} \
[list $asm_file {nodebug split-dwo} ${object_file}] \
[list $srcfile {nodebug}]] } {
- return -1
+ return
}
# Now we can start GDB.
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
# Print the type of global_var. This type information is entirely
[list $srcfile \
[list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
$obj]]} {
- return -1
+ return
}
clean_restart $::testfile
if {![runto_main]} {
- return -1
+ return
}
# Do a few basic things to verify we're finding the DWO debug info.
[list $srcfile \
[list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
$obj]]} {
- return -1
+ return
}
clean_restart $::testfile
if {![runto_main]} {
- return -1
+ return
}
# Verify gdb can find argc.
[list $srcfile \
[list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
$obj]]} {
- return -1
+ return
}
clean_restart $::testfile
if {![runto_main]} {
- return -1
+ return
}
# Verify gdb can find argc.
# Compile fission-mix.c without Fission and fission-mix-2.c with Fission.
if { [gdb_compile ${srcdir}/${subdir}/${srcfile} $objfile object {debug}] != "" } {
- return -1
+ return
}
if { [gdb_compile ${srcdir}/${subdir}/${srcfile2} $objfile2 object {debug additional_flags=-gsplit-dwarf}] != "" } {
- return -1
+ return
}
if {[gdb_compile "$objfile $objfile2" $binfile executable {debug}] != "" } {
- return -1
+ return
}
clean_restart $::testfile
[list $asm_file_1 [list nodebug split-dwo] $obj1] \
[list $asm_file_2 [list nodebug split-dwo] $obj2] \
[list $srcfile [list nodebug]]]} {
- return -1
+ return
}
clean_restart $::testfile
if {![runto_main]} {
- return -1
+ return
}
# Do a few basic things to verify we're finding the DWO debug info.
if { [build_executable_and_dwo_files "${testfile}.exp" ${testfile} {nodebug} \
[list $asm_file {nodebug split-dwo} ${object_file}] \
[list $srcfile {nodebug}]] } {
- return -1
+ return
}
# Now we can start GDB.
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
# Print the type of global_var. This type information is entirely
if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
[list $srcfile $dwo_options $obj]]} {
- return -1
+ return
}
# Load FILENAME, perform some basic tests to confirm that the debug
if { [build_executable_and_dwo_files "${testfile}.exp" ${binfile} {nodebug} \
[list $asm_file {nodebug split-dwo} ${object_file}] \
[list $srcfile {nodebug}]] } {
- return -1
+ return
}
proc run_test { testfile } {
# We need to know the endianess in order
# to write some of the debugging info we'd like to generate.
if {[prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}]} {
- return -1
+ return
}
set endianness [get_endianness]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "p/x xxx" " = 0x123456789abcdef00fedcba987654321"
# specifically for this testcase, might as well use that.
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
# Make some DWARF for the test.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set language fortran"
if {[build_executable "failed to build executable" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
set eol "\r\n"
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
require {string equal [have_index $binfile] ""}
# Regenerate exec without index.
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list ${srcfile}]] } {
- return -1
+ return
}
set symlink [file dirname $binfile]/symlink
if { [ensure_gdb_index $symlink] == -1 } {
fail "Unable to call gdb-add-index with a symlink to a symfile"
- return -1
+ return
}
# Ok, we have a copy of $binfile with an index.
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
}
# Ok, we have a copy of $binfile with an index.
if {[prepare_for_testing "failed to prepare" "${testfile}" \
[list ${srcfile}] $opts]} {
- return -1
+ return
}
# The bug was that gdb would crash when saving.
if {[prepare_for_testing "failed to prepare" "${testfile}" \
[list ${srcfile}] {nodebug}]} {
- return -1
+ return
}
set have_index [have_index $binfile]
# that's fine, but we can't test tilde expansion in this case.
if { [string compare -length [string length $home] $full_dir $home] != 0 } {
unsupported "test not run within home directory"
- return -1
+ return
}
# Convert the $HOME prefix in to ~.
# Build the test executable.
if { [prepare_for_testing "failed to prepare" "${testfile}" ${srcfile}] } {
- return -1
+ return
}
# Start GDB and load in the executable.
if { $has_index } {
unsupported "already have an index"
- return -1
+ return
}
if { !$can_dump_index } {
unsupported "lacks debug information needed to dump index"
- return -1
+ return
}
# Generate an index file.
if { [prepare_for_testing "failed to prepare" ${testfile} \
$srcfile $flags] } {
- return -1
+ return
}
if { [ensure_gdb_index $binfile] != 1 } {
untested "error adding gdb index"
- return -1
+ return
}
clean_restart ${::testfile}
if { [prepare_for_testing "failed to prepare" "${testfile}" \
[list ${srcfile}]] } {
- return -1
+ return
}
# Add a .gdb_index section to PROGRAM.
# First make sure enough time has passed, file mtime resolution is seconds.
gdb_test_no_output "shell sleep 1"
if {[run_on_host "touch binary" touch $host_binfile_with_index]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
}
if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
gdb_test "p p->f" " = <optimized out>"
}
if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
- return -1
+ return
}
# Additional test to verify the referenced CU is not aged out.
gdb_test_no_output "maintenance set dwarf max-cache-age 0"
if {![runto_main]} {
- return -1
+ return
}
# Test various pointer depths in bar.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "print *c" " = 114 'r'"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Determine byte order.
# Any program would do, but since we already have implref-array
# specifically for this testcase, might as well use that.
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
set array_length [get_valueof "/u" "sizeof(array) / sizeof(array\[0\])" -1]
}
if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
- return -1
+ return
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
# This matches e.g. '(int (&)[5])'
# Any program would do, but since we already have implref-const
# specifically for this testcase, might as well use that.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# Create the DWARF. We need a regular variable and a reference to it that'll
}
if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
- return -1
+ return
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
# Doing 'print ref' should show us e.g. '(int &) <synthetic pointer>: 42'.
# Any program would do, but since we already have implref-global
# specifically for this testcase, might as well use that.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# Create the DWARF. We need a regular variable and a reference to it that'll
}
if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
- return -1
+ return
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
# Address of the referenced value.
# Any program would do, but since we already have implref-struct
# specifically for this testcase, might as well use that.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
- return -1
+ return
}
# Create the DWARF. We need a regular variable for the struct and a reference
}
if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
- return -1
+ return
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
# Returns the struct members, e.g. '{a = 0, b = 1, c = 2}'.
# We need to know the size of integer type in order
# to write some of the debugging info we'd like to generate.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# Create the DWARF.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "p aaa" "= 1"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file $srcfile3] $build_options] } {
- return -1
+ return
}
gdb_reinitialize_dir /tmp
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
- return -1
+ return
}
# Create the DWARF.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# If Python testing is enabled then try printing the global and static
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "ptype inty" "type = int" "ptype in main"
# We need to know the size of integer types in order to write some of the
# debugging info we'd like to generate.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# Create the DWARF.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if { [ensure_gdb_index $binfile] == -1 } {
untested "error adding gdb index"
- return -1
+ return
}
clean_restart ${::testfile}
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
- return -1
+ return
}
# Create the DWARF.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language c++"
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
set lines [gdb_get_lines "info locals"]
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug nowarnings}]} {
- return -1
+ return
}
set cmd "ptype main"
if {[prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
# All we need to do is set a breakpoint, which causes the DWARF
set asm_file [standard_output_file ${srcfile2}]
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# Create the DWARF.
if {[prepare_for_testing "failed to prepare" ${executable} \
[list ${asm_file} ${srcfile}] {}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "print v_i16_m1" "= -1"
standard_testfile .f90
if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug f90}] } {
- return -1
+ return
}
# Regression test for PR32276.
set exec_options [list debug shlib=$lib_so]
if {[prepare_for_testing "failed to prepare" ${testfile} \
${::srcfile} $exec_options]} {
- return -1
+ return
}
### First GDB session.
if {[prepare_for_testing_full "failed to prepare" \
[list $testfile debug main.c debug $srcfile nodebug]]} {
- return -1
+ return
}
gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
set have_index [exec_has_index_section $binfile]
if {[gdb_start_cmd] < 0} {
fail "could not start ${testfile}"
- return -1
+ return
}
gdb_test_multiple "" "stopped at mymain" {
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "info line 1" \
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
# The largest known Fermat prime.
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} object {debug}] != "" } {
untested "failed to compile"
- return -1
+ return
}
clean_restart
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug c++}] } {
- return -1
+ return
}
gdb_test_no_output "set language c++"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# Place a breakpoint on FUNC. Check that the address at which the
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "ptype foo" "type = <unknown type .*>"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] $nodebug_flags] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "ptype var1" [multi_line \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Use 'ptype' on two variables that are using DW_TAG_base_type types
# Build the test executable.
if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
== -1} {
- return -1
+ return
}
# We force the DIEs above to be read in via "-readnow".
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
# The bug was a crash, so just do anything here to verify gdb is still
}
if { [build_executable $testfile.exp $testfile [list $srcfile $asm_file]] } {
- return -1
+ return
}
clean_restart
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Determine byte order.
if { [build_executable ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
save_vars { GDBFLAGS } {
lappend opts additional_flags=-std=c++11
if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
- return -1
+ return
}
set cmd "info types -q std::nullptr_t"
}
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "p variable_a" " = {xyz = 97 'a'}"
if {[build_executable ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto_main]} {
- return -1
+ return
}
set cmd "print i64_noptr"
lappend opts nopie
if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
- return -1
+ return
}
if {![runto foo]} {
- return -1
+ return
}
# Move back up to main.
set csrcfile ${testfile}.c
if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Function f1 tests a particular gdb bug involving DW_OP_piece.
standard_testfile
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return 0
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# This test also requires DWARF.
get_debug_format
if {![test_debug_format "DWARF \[0-9\]"]} {
- return -1
+ return
}
gdb_test "break force_unwind" "Breakpoint .*" "set breakpoint for pr10770"
if { [gdb_compile [file join $srcdir $subdir $srcfile] \
$binfile object [list additional_flags=-DPTRBITS=$ptrbits]] != "" } {
- return -1
+ return
}
clean_restart $testfile
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
${additional_flags}] == -1 } {
- return -1
+ return
}
gdb_test "break -q main" "Breakpoint.*at.*"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test_no_output "set language rust"
}
if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
- return -1
+ return
}
set index [have_index $binfile]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "p s1" " = {a = 1, b = 0}"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "print var" " = <optimized out>"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# gdb/18021: The test below would cause GDB to crash.
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
- return -1
+ return
}
gdb_breakpoint "the_type::method" message
# from modifying it. It also means we can set the build-id, rather than
# having to extract it.
if { [gdb_compile $asm_file $binfile.dwz object {nodebug}] != "" } {
- return -1
+ return
}
set host_dwz_file [gdb_remote_download host $binfile.dwz]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
set struct_s_i_re \
"}"]
if {![runto_main]} {
- return -1
+ return
}
gdb_test "ptype struct s" $struct_s_i_re \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
gdb_test "print rangeval" " = TWO"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug c++}] } {
- return -1
+ return
}
gdb_test_no_output "set language pascal"
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
# The variable's location expression requires a frame,
gdb_test "print/d a" "No frame selected." "variable a can't be printed"
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set var \$$regname = 2" "init reg to 2"
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test_no_output "set var \$$regname = 2" "init reg to 2"
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Just a sanity check to make sure GDB slurped the symbols correctly.
if {[prepare_for_testing "failed to prepare" "${testfile}" ${testfile}.S \
nodebug]} {
- return -1
+ return
}
gdb_test "trace ${testfile}.c:3" "Tracepoint $decimal .*" \
} elseif { [is_x86_64_m64_target] } {
set sfile ${test}-amd64.S
} else {
- return 0
+ return
}
set opts {}
lappend opts nopie
if { [prepare_for_testing "failed to prepare" "${test}" ${sfile} $opts] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Initialize tests to be an empty array.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "break func" "Breakpoint .*" \
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] debug]} {
- return -1
+ return
}
if {![runto main]} {
- return -1
+ return
}
gdb_test "set language rust" \
if {[prepare_for_testing "failed to prepare" $testfile \
[list $srcfile] [list {additional_flags=-nostdlib}]]} {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
gdb_test "break valop.c:19" "Breakpoint 2.*" "set breakpoint for valop"
if { [prepare_for_testing ${testfile}.exp ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Determine byte order.
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] debug] } {
- return -1
+ return
}
if {![runto func]} {
- return -1
+ return
}
# Get the values into history so we can use it from Rust.
# Any program would do, but since we already have varval
# specifically for this testcase, might as well use that.
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
set int_size [get_sizeof "int" -1]
# gdb always assumes references are implemented as pointers.
}
if { [setup_exec 0] == -1 } {
- return -1
+ return
}
with_test_prefix "pre-main" {
# DW_OP_GNU_variable_value implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
gdb_test "print varval" "= 8"
"Type of DW_OP_GNU_variable_value DIE must be an integer or pointer\\."
if { [setup_exec 1] == -1 } {
- return -1
+ return
}
# DW_OP_GNU_variable_value implementation requires a valid frame.
if {![runto_main]} {
- return -1
+ return
}
gdb_test "print badval" "value has been optimized out"
gdb_test "print bad_die_val1" \
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
- return -1
+ return
}
if {![runto_main]} {
- return -1
+ return
}
# Place a breakpoint in 'func' and continue to there.
if { [prepare_for_testing "failed to prepare" "${test}" \
{watch-notconst.c watch-notconst2.S} {nodebug}] } {
- return -1
+ return
}
if { ![runto f] } {