85174909de
* gdb.t*/*.exp: Change error to perror so it works with DejaGnu 1.1's new error handling system.
274 lines
8 KiB
Text
274 lines
8 KiB
Text
# Test that GDB properly ignores invalid stabs.
|
|
# Also test that GDB can debug a .o file, and that it doesn't mind
|
|
# a file that's more minimal than what a compiler normally puts out.
|
|
if $tracelevel then {
|
|
strace $tracelevel
|
|
}
|
|
|
|
set prms_id 0
|
|
set bug_id 0
|
|
|
|
proc do_tests {} {
|
|
global binfile
|
|
global prompt
|
|
|
|
# Do this first because the bug only exhibits itself before partial
|
|
# symbols have been expanded.
|
|
setup_xfail "*-*-*"
|
|
# xcoffread.c doesn't (yet) use partial symbol tables.
|
|
clear_xfail "rs*-*-aix*"
|
|
gdb_test "ptype red" "type = enum \{red, green, blue\}" "ptype unnamed enum"
|
|
|
|
# Mips/alpha targets that use gcc with mips-tfile put out the stabs
|
|
# assembler directives embedded in comments. If the assembler
|
|
# file is then processed with native cc, all stabs directives
|
|
# will be lost.
|
|
# Skip the rest of the stabs tests for this case.
|
|
send "ptype inttype\n"
|
|
expect {
|
|
-re "^ptype inttype\r*\ntype = inttype.*$prompt $" {
|
|
pass "stabs found"
|
|
}
|
|
-re ".*$prompt $" {
|
|
setup_xfail "mips-*-*"
|
|
setup_xfail "alpha-*-*"
|
|
fail "stabs not found"
|
|
return
|
|
}
|
|
default { fail "checking for stabs" }
|
|
}
|
|
|
|
print_weird_var var0
|
|
print_weird_var var1
|
|
print_weird_var var2
|
|
print_weird_var var3
|
|
|
|
print_weird_var attr32
|
|
print_weird_var attr33
|
|
print_weird_var attr35
|
|
print_weird_var attr36
|
|
print_weird_var attr37
|
|
print_weird_var attr38
|
|
print_weird_var attr39
|
|
print_weird_var attr41
|
|
print_weird_var attr42
|
|
print_weird_var attr43
|
|
print_weird_var attr44
|
|
print_weird_var attr46
|
|
print_weird_var attr47
|
|
print_weird_var attr58
|
|
print_weird_var attr59
|
|
print_weird_var attr60
|
|
print_weird_var attr61
|
|
print_weird_var attr62
|
|
print_weird_var attr63
|
|
print_weird_var attr64
|
|
print_weird_var attr65
|
|
print_weird_var attr66
|
|
print_weird_var attr67
|
|
print_weird_var attr68
|
|
print_weird_var attr69
|
|
print_weird_var attr70
|
|
print_weird_var attr71
|
|
print_weird_var attr72
|
|
print_weird_var attr73
|
|
print_weird_var attr74
|
|
print_weird_var attr75
|
|
print_weird_var attr76
|
|
print_weird_var attr77
|
|
print_weird_var attr78
|
|
print_weird_var attr79
|
|
print_weird_var attr80
|
|
print_weird_var attr81
|
|
print_weird_var attr82
|
|
print_weird_var attr83
|
|
print_weird_var attr84
|
|
print_weird_var attr85
|
|
print_weird_var attr86
|
|
print_weird_var attr87
|
|
print_weird_var attr88
|
|
print_weird_var attr89
|
|
print_weird_var attr90
|
|
print_weird_var attr91
|
|
print_weird_var attr92
|
|
print_weird_var attr93
|
|
print_weird_var attr94
|
|
print_weird_var attr95
|
|
print_weird_var attr96
|
|
print_weird_var attr97
|
|
print_weird_var attr98
|
|
print_weird_var attr99
|
|
print_weird_var attr100
|
|
print_weird_var attr101
|
|
print_weird_var attr102
|
|
print_weird_var attr103
|
|
print_weird_var attr104
|
|
print_weird_var attr105
|
|
print_weird_var attr106
|
|
print_weird_var attr107
|
|
print_weird_var attr108
|
|
print_weird_var attr109
|
|
print_weird_var attr110
|
|
print_weird_var attr111
|
|
print_weird_var attr112
|
|
print_weird_var attr113
|
|
print_weird_var attr114
|
|
print_weird_var attr115
|
|
print_weird_var attr116
|
|
print_weird_var attr117
|
|
print_weird_var attr118
|
|
print_weird_var attr119
|
|
print_weird_var attr120
|
|
print_weird_var attr121
|
|
print_weird_var attr122
|
|
print_weird_var attr123
|
|
print_weird_var attr124
|
|
print_weird_var attr125
|
|
print_weird_var attr126
|
|
|
|
gdb_test "p const69" " = 69" "'e' constant on non-enum type"
|
|
gdb_test "whatis const69" "type = (unsigned int|inttype)" "whatis const69"
|
|
|
|
# Haven't investigated
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p sizeof (const70)" " = 2" "'e' constant with embedded type"
|
|
|
|
# field3 is printing out a bogus value; haven't investigated
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p bad_neg0" " = \{field0 = 42, field2 =.*field3 = 45\}" "p bad_neg0"
|
|
# test that it at least gets field0 right
|
|
gdb_test "p bad_neg0" " = \{field0 = 42, field2 =" "p bad_neg0, test 2"
|
|
|
|
gdb_test "ptype inttype" "type = (unsigned int|inttype)" "ptype on inttype"
|
|
gdb_test "p sizeof (float72type)" " = 9" "unrecognized floating point type"
|
|
|
|
gdb_test "p/x int256var" " = 0x0*2a0000002b0000002c0000002d\
|
|
0000002d0000002c0000002b0000002a" "print very big integer"
|
|
|
|
gdb_test "whatis consth" "type = inttype" "whatis consth"
|
|
gdb_test "whatis consth2" "type = inttype" "whatis consth2"
|
|
|
|
# GDB does not yet understand S constants
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p/x bad_neg0const" " = \{field0 = 0x11222211, field2 =.*\
|
|
field3 = 0x77888877\}" "print struct constant"
|
|
|
|
gdb_test "ptype bad_type0" "type = " "print bad_type0"
|
|
gdb_test "ptype bad_type1" "type = " "print bad_type1"
|
|
|
|
# GDB does not yet support arrays indexed by anything at all unusual
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p array0" " = \{42, 43, 44, 45, 46, 47\}" "array0 with strange index"
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p array1" " = \{42, 43, 44\}" "array1 with strange index"
|
|
|
|
# GDB does not yet support this feature
|
|
gdb_test "whatis one_var" "type = inttype_one" \
|
|
"whatis one_var (known failure in gdb 4.10)"
|
|
# But do make sure that it prints as something reasonable
|
|
gdb_test "whatis one_var" "type = inttype(|_one)" \
|
|
"whatis one_var test 2"
|
|
|
|
gdb_test "whatis two_var" "type = inttype_two" \
|
|
"whatis two_var (known failure in gdb 4.10)"
|
|
# But do make sure that it prints as something reasonable
|
|
gdb_test "whatis two_var" "type = inttype(|_two)" \
|
|
"whatis two_var test 2"
|
|
|
|
setup_xfail "*-*-*"
|
|
gdb_test "whatis pointer_to_int_var" "type = int \*"
|
|
setup_xfail "*-*-*"
|
|
gdb_test "whatis intp_var" "type = intp"
|
|
|
|
# xcoffread.c doesn't understand common blocks at all
|
|
setup_xfail "rs6*-*-aix*"
|
|
gdb_test "p common0var0" "= 42"
|
|
# GDB seems to only understand common blocks local to a function.
|
|
# These variables never get relocated to be relative to the common
|
|
# block.
|
|
# I'm not sure whether it is valid to have a common block which
|
|
# is not local to a function.
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p common0var1" "= 24"
|
|
setup_xfail "*-*-*"
|
|
gdb_test "p common0var2" "= 22"
|
|
|
|
gdb_test "p v_comb" "{<> = \
|
|
{<> = {x = 42}, \[_a-zA-Z$\]* = \[0-9xa-fA-F\]*, a = 43}, \
|
|
<> = {\[_a-zA-Z$\]* = \[0-9xa-fA-F\]*, b = 44}, comb = 45}"
|
|
}
|
|
|
|
proc print_weird_var { var } {
|
|
global prompt
|
|
|
|
# Make sure that the variable gets printed out correctly, without
|
|
# any sort of warning message.
|
|
send "print $var\n"
|
|
expect {
|
|
-re "^print $var\r*\n.\[0-9\]* = 42.*$prompt $" {
|
|
pass "variable $var printed properly"
|
|
}
|
|
-re ".*$prompt $" {
|
|
fail "variable $var not printed properly"
|
|
}
|
|
timeout { fail "variable $var not printed (timeout)" }
|
|
eof { fail "(eof) variable $var not printed" }
|
|
}
|
|
|
|
# Make sure that the stabs did get loaded in a sensible way.
|
|
# If somehow the stabs got skipped, then the above test can
|
|
# pass because GDB assumes int for variables without a stab.
|
|
|
|
# This doesn't work because 32=45 doesn't preserve the name in
|
|
# gdb (as of 14 Sep 93 anyway).
|
|
#gdb_test "whatis $var" "type = (unsigned int|inttype)"
|
|
|
|
# But the size should be right.
|
|
gdb_test "print sizeof ($var)" "= 4"
|
|
}
|
|
|
|
# Start with a fresh gdb
|
|
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
# Don't use gdb_load; it doesn't bitch if the loading produced some
|
|
# error messages during symbol reading.
|
|
set binfile $objdir/$subdir/weird.o
|
|
|
|
if ![file exists $binfile] then {
|
|
if $all_flag then {
|
|
warning "$binfile does not exist; tests suppressed"
|
|
}
|
|
} else {
|
|
# xcoffread.c wrongly bitches about the lack of a text section.
|
|
setup_xfail "rs*-*-aix*"
|
|
send "file $binfile\n"
|
|
# If $binfile is very long, a \r (but not a \n) will echo in the
|
|
# middle of the echo of the command. So to match the echo, we
|
|
# would like to match anything not containing \n
|
|
# (we would prefer to be sure not to match any warning message).
|
|
# But \[^\n\]* doesn't seem to work, so instead use the heuristic
|
|
# that a filename won't contain a space and a warning message will.
|
|
expect {
|
|
-re "^file \[^ \]*\r*\nReading symbols from $binfile\.\.\.done\.\r*\n$prompt $" {
|
|
pass "weird.o read without error"
|
|
}
|
|
-re "A program is being debugged already. Kill it\? \(y or n\)" {
|
|
send "y\n"
|
|
continue -expect
|
|
}
|
|
-re ".*$prompt $" {
|
|
fail "Errors reading weird.o"
|
|
}
|
|
timeout {
|
|
perror "couldn't load $binfile into $GDB (timed out)."
|
|
return -1
|
|
}
|
|
eof { fail "(eof) cannot read weird.o" }
|
|
}
|
|
do_tests
|
|
}
|
|
|
|
return 0
|