URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.stabs/] [weird.exp] - Rev 840
Compare with Previous | Blame | View Log
# Copyright 1997, 1998, 1999, 2001, 2003, 2004, 2006, 2007, 2008# Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see <http://www.gnu.org/licenses/>.# Please email any bugs, comments, and/or additions to this file to:# bug-gdb@prep.ai.mit.edu# 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}# If the test directory was not created by configure then skip# this test.if ![file isdirectory ${objdir}/${subdir}] then {return 0}set prms_id 0set bug_id 0set testfile weirdset srcfile ${objdir}/${subdir}/weird.sset binfile ${objdir}/${subdir}/weirdx.oif { [ get_compiler_info "$binfile" ] } {return -1}if { $hp_cc_compiler || $hp_aCC_compiler } {# The native hp-ux assembler does not support stabs at all.# If the compiler is native hp-ux, of course the assembler is too.# But if someone builds gcc with the native assembler (not recommended)# rather than the gnu assembler, then this logic will not suppress it.# -- chastain 2004-01-07unsupported "stabs with hp-ux assembler"continue}proc do_tests {} {global binfileglobal gdb_prompt# 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_gdb "ptype inttype\n"gdb_expect {-re "^ptype inttype\r*\ntype = inttype.*$gdb_prompt $" {pass "stabs found"}-re ".*$gdb_prompt $" {setup_xfail "mips-*-*"setup_xfail "alpha-*-*"fail "stabs not found"return}default { fail "checking for stabs" }}print_weird_var var0print_weird_var var1print_weird_var var2print_weird_var var3print_weird_var attr32print_weird_var attr33print_weird_var attr35print_weird_var attr36print_weird_var attr37print_weird_var attr38print_weird_var attr39print_weird_var attr41print_weird_var attr42print_weird_var attr43print_weird_var attr44print_weird_var attr46print_weird_var attr47print_weird_var attr58print_weird_var attr59print_weird_var attr60print_weird_var attr61print_weird_var attr62print_weird_var attr63print_weird_var attr64print_weird_var attr65print_weird_var attr66print_weird_var attr67print_weird_var attr68print_weird_var attr69print_weird_var attr70print_weird_var attr71print_weird_var attr72print_weird_var attr73print_weird_var attr74print_weird_var attr75print_weird_var attr76print_weird_var attr77print_weird_var attr78print_weird_var attr79print_weird_var attr80print_weird_var attr81print_weird_var attr82print_weird_var attr83print_weird_var attr84print_weird_var attr85print_weird_var attr86print_weird_var attr87print_weird_var attr88print_weird_var attr89print_weird_var attr90print_weird_var attr91print_weird_var attr92print_weird_var attr93print_weird_var attr94print_weird_var attr95print_weird_var attr96print_weird_var attr97print_weird_var attr98print_weird_var attr99print_weird_var attr100print_weird_var attr101print_weird_var attr102print_weird_var attr103print_weird_var attr104print_weird_var attr105print_weird_var attr106print_weird_var attr107print_weird_var attr108print_weird_var attr109print_weird_var attr110print_weird_var attr111print_weird_var attr112print_weird_var attr113print_weird_var attr114print_weird_var attr115print_weird_var attr116print_weird_var attr117print_weird_var attr118print_weird_var attr119print_weird_var attr120print_weird_var attr121print_weird_var attr122print_weird_var attr123print_weird_var attr124print_weird_var attr125print_weird_var attr126gdb_test "p const69" " = 69" "'e' constant on non-enum type"gdb_test "whatis const69" "type = (unsigned int|inttype)" "whatis const69"gdb_test "p sizeof (const70)" " = 2" "'e' constant with embedded type"gdb_test "p bad_neg0" " = \{field0 = 42, field2 =.*field3 = 45\}" "p bad_neg0"gdb_test "ptype inttype" "type = (unsigned int|inttype)" "ptype on inttype"gdb_test "p sizeof (float72type)" " = 9" "unrecognized floating point type"# This big number needs to be kept as one piecegdb_test "p/x int256var" " = 0x0*2a0000002b0000002c0000002d0000002d0000002c0000002b0000002a" "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 constantssetup_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 unusualsetup_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 featuregdb_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 reasonablegdb_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 reasonablegdb_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"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"}proc print_weird_var { var } {global gdb_prompt# Make sure that the variable gets printed out correctly, without# any sort of warning message.gdb_test_multiple "print $var" "variable $var printed property" {-re "^print $var\r*\n.\[0-9\]* = 42.*$gdb_prompt $" {pass "variable $var printed properly"}-re ".*$gdb_prompt $" {fail "variable $var printed properly"}}# 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"}# Don't use gdb_load; it doesn't bitch if the loading produced some# error messages during symbol reading.global target_osset sedscript ${srcdir}/${subdir}/aout.sedswitch -glob ${target_triplet} {"hppa*-*-*" {set sedscript ${srcdir}/${subdir}/hppa.sed}"mips-*-ecoff" {set sedscript ${srcdir}/${subdir}/ecoff.sed}"powerpc-*-aix*" {set sedscript ${srcdir}/${subdir}/xcoff.sed}"rs6000-*-aix*" {set sedscript ${srcdir}/${subdir}/xcoff.sed}"*-*-aout" {set sedscript ${srcdir}/${subdir}/aout.sed}"*-*-xcoff" {set sedscript ${srcdir}/${subdir}/xcoff.sed}"alpha-*-*" {set sedscript ${srcdir}/${subdir}/ecoff.sed}}# Hope this is a Unix box.set exec_output [remote_exec build "sed" "-f ${sedscript}" "${srcdir}/${subdir}/weird.def" "${srcfile}"]if { [lindex $exec_output 0] != 0 } {perror "Couldn't make test case. $exec_output"return -1}if { [gdb_compile "${srcfile}" "${binfile}" object ""] != "" } {untested weird.expreturn -1}remote_file build delete ${srcfile}# Start with a fresh gdbgdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirset binfile [remote_download host ${binfile} object.o]send_gdb "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.# But spaces following by backspaces aren't really spaces.gdb_expect 60 {-re "^file (\[^ \]| +\008)*\r*\n" {exp_continue}-re "A program is being debugged already.\[\r\n\]+Are you sure you want to change the file\\? \\(y or n\\)" {send_gdb "y\n"exp_continue}-re "^Reading symbols from .*$binfile\\.\\.\\.done\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" {pass "weirdx.o read without error"}-re ".*$gdb_prompt $" {fail "Errors reading weirdx.o"}timeout {perror "couldn't load $binfile into $GDB (timed out)."return -1}eof { fail "(eof) cannot read weirdx.o" }}do_testsremote_file host delete ${binfile}return 0
