# OBSOLETE # Copyright 1992, 1995, 1996, 1997, 1999 Free Software Foundation, Inc. # OBSOLETE # OBSOLETE # This program is free software; you can redistribute it and/or modify # OBSOLETE # it under the terms of the GNU General Public License as published by # OBSOLETE # the Free Software Foundation; either version 2 of the License, or # OBSOLETE # (at your option) any later version. # OBSOLETE # # OBSOLETE # This program is distributed in the hope that it will be useful, # OBSOLETE # but WITHOUT ANY WARRANTY; without even the implied warranty of # OBSOLETE # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # OBSOLETE # GNU General Public License for more details. # OBSOLETE # # OBSOLETE # You should have received a copy of the GNU General Public License # OBSOLETE # along with this program; if not, write to the Free Software # OBSOLETE # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # OBSOLETE # OBSOLETE # Please email any bugs, comments, and/or additions to this file to: # OBSOLETE # bug-gdb@prep.ai.mit.edu # OBSOLETE # OBSOLETE if $tracelevel then { # OBSOLETE strace $tracelevel # OBSOLETE } # OBSOLETE # OBSOLETE if [skip_chill_tests] then { continue } # OBSOLETE # OBSOLETE set prms_id 0 # OBSOLETE set bug_id 0 # OBSOLETE # OBSOLETE # Set the current language to chill. This counts as a test. If it # OBSOLETE # fails, then we skip the other tests. # OBSOLETE # OBSOLETE set testfile "tests2" # OBSOLETE set srcfile ${srcdir}/$subdir/${testfile}.ch # OBSOLETE set binfile ${objdir}/${subdir}/${testfile}.exe # OBSOLETE if { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { # OBSOLETE perror "Couldn't compile ${srcfile}" # OBSOLETE return -1 # OBSOLETE } # OBSOLETE # OBSOLETE global infinity # OBSOLETE if [istarget "i*86-*-sysv4*"] then { # OBSOLETE set infinity "inf" # OBSOLETE } else { # OBSOLETE set infinity "Infinity" # OBSOLETE } # OBSOLETE # OBSOLETE proc set_lang_chill {} { # OBSOLETE global gdb_prompt # OBSOLETE global binfile objdir subdir # OBSOLETE # OBSOLETE if ![file exists $objdir/$subdir/$binfile] then { # OBSOLETE return 0 # OBSOLETE } # OBSOLETE verbose "loading file '$objdir/$subdir/$binfile'" # OBSOLETE gdb_load $objdir/$subdir/$binfile # OBSOLETE # OBSOLETE send_gdb "set language chill\n" # OBSOLETE gdb_expect { # OBSOLETE -re ".*$gdb_prompt $" {} # OBSOLETE timeout { fail "set language chill (timeout)" ; return 0 } # OBSOLETE } # OBSOLETE # OBSOLETE send_gdb "show language\n" # OBSOLETE gdb_expect { # OBSOLETE -re ".* source language is \"chill\".*$gdb_prompt $" { # OBSOLETE pass "set language to \"chill\"" # OBSOLETE send_gdb "break dummyfunc\n" # OBSOLETE gdb_expect { # OBSOLETE -re ".*$gdb_prompt $" { # OBSOLETE send_gdb "run\n" # OBSOLETE gdb_expect -re ".*$gdb_prompt $" {} # OBSOLETE return 1 # OBSOLETE } # OBSOLETE timeout { # OBSOLETE fail "can't set breakpoint (timeout)" # OBSOLETE return 0 # OBSOLETE } # OBSOLETE } # OBSOLETE } # OBSOLETE -re ".*$gdb_prompt $" { # OBSOLETE fail "setting language to \"chill\"" # OBSOLETE return 0 # OBSOLETE } # OBSOLETE timeout { # OBSOLETE fail "can't show language (timeout)" # OBSOLETE return 0 # OBSOLETE } # OBSOLETE } # OBSOLETE } # OBSOLETE # OBSOLETE # checks if structure was accessed correctly # OBSOLETE proc test_write { args } { # OBSOLETE global gdb_prompt # OBSOLETE # OBSOLETE if [llength $args]==5 then { # OBSOLETE set message [lindex $args 4] # OBSOLETE set extended [lindex $args 3] # OBSOLETE set matchval [lindex $args 2] # OBSOLETE } elseif [llength $args]==4 then { # OBSOLETE set message [lindex $args 3] # OBSOLETE set matchval [lindex $args 2] # OBSOLETE set extended "" # OBSOLETE } elseif [llength $args]==3 then { # OBSOLETE set message [lindex $args 2] # OBSOLETE set extended "" # OBSOLETE } else { # OBSOLETE warning "test ($args) write called with wrong number of arguments" # OBSOLETE return # OBSOLETE } # OBSOLETE # OBSOLETE set location [lindex $args 0] # OBSOLETE set value [lindex $args 1] # OBSOLETE if ![info exists matchval] then { # OBSOLETE set matchval $value # OBSOLETE } # OBSOLETE verbose "loc: $location, val: $value, msg: $message, ext: $extended, match: $matchval" # OBSOLETE # OBSOLETE verbose "setting var $value..." # OBSOLETE send_gdb "set var $location.m$extended := $value\n" # OBSOLETE gdb_expect -re ".*$gdb_prompt $" {} # OBSOLETE gdb_test "print $location" \ # OBSOLETE ".*= \[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]"\ # OBSOLETE "$message" # OBSOLETE } # OBSOLETE # OBSOLETE # test write access from gdb (setvar x:=y) from gdb # OBSOLETE proc write_access { } { # OBSOLETE global infinity # OBSOLETE # OBSOLETE verbose "testing write access to locations" # OBSOLETE # OBSOLETE # discrete modes # OBSOLETE test_write b1 127 "byte write 1" # OBSOLETE test_write b1 -128 "byte write 2" # OBSOLETE test_write b1 0 "byte write 3" # OBSOLETE test_write ub1 255 "ubyte write 1" # OBSOLETE test_write ub1 0 "ubyte write 2" # OBSOLETE test_write ub1 42 "ubyte write 3" # OBSOLETE test_write i1 32767 "int write 1" # OBSOLETE test_write i1 -32768 "int write 2" # OBSOLETE test_write i1 0 "int write 3" # OBSOLETE test_write ui1 65535 "uint write 1" # OBSOLETE test_write ui1 0 "uint write 2" # OBSOLETE test_write ui1 123 "uint write 3" # OBSOLETE test_write l1 2147483647 "long write 1" # OBSOLETE test_write l1 -2147483648 "long write 2" # OBSOLETE test_write l1 0 "long write 3" # OBSOLETE test_write ul1 4294967295 "ulong write 1" # OBSOLETE test_write ul1 0 "ulong write 2" # OBSOLETE test_write ul1 1000000 "ulong write 3" # OBSOLETE test_write bo1 FALSE "bool write 1" # OBSOLETE test_write bo1 TRUE "bool write 2" # OBSOLETE test_write c1 \"1234\" "char write 1" # OBSOLETE test_write c2 \"1234567\" "char write 2" # OBSOLETE test_write c3 \"654321\" "char write 3" # OBSOLETE test_write c4 C'65' 'e' "char write 4" # OBSOLETE test_write bi1 B'10100101' "bitstring write 1" # OBSOLETE test_write bi2 B'0101001010' "bitstring write 2" # OBSOLETE test_write se1 a "set write 1" # OBSOLETE test_write se1 h "set write 2" # OBSOLETE # The following two use numbered sets with too-large values. # OBSOLETE setup_xfail "*-*-*" # OBSOLETE test_write nse1 nb "numbered set write 1" # OBSOLETE setup_xfail "*-*-*" # OBSOLETE test_write nse1 nc "numbered set write 2" # OBSOLETE test_write r1 127 "range write 1" # OBSOLETE test_write r2 32767 "range write 2" # OBSOLETE test_write r3 2147483647 "range write 3" # OBSOLETE # OBSOLETE # powerset modes # OBSOLETE test_write p1 {[pa:ph]} {\[pa:ph\]} "powerset write 1" # OBSOLETE test_write p1 {[pa, pc:pf, ph]} {\[pa, pc:pf, ph\]} "powerset write 2" # OBSOLETE test_write p1 {[pa, pc, pe, pg]} {\[pa, pc, pe, pg\]} "powerset write 3" # OBSOLETE test_write p1 {[]} {\[\]} "powerset write 4" # OBSOLETE test_write p2 {[1:32]} {\[1:32\]} "powerset write 5" # OBSOLETE test_write p2 {[1, 3:30, 32]} {\[1, 3:30, 32\]} "powerset write 6" # OBSOLETE test_write p2 {[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]} {\[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31\]} \ # OBSOLETE "powerset write 7" # OBSOLETE test_write p2 {[]} {\[\]} "powerset write 8" # OBSOLETE # OBSOLETE # Fixme: this should be rejected by gnuchill # OBSOLETE # test_write p3 {[-2147483648:2147483647]} {\[-2147483648:2147483647\]} \ # OBSOLETE # "powerset write 9" # OBSOLETE # test_write p3 {[-2147483648, -1000000:1000000, 2147483647]} \ # OBSOLETE # {\[-2147483648, -1000000:1000000, 2147483647\]} \ # OBSOLETE # "powerset write 10" # OBSOLETE # test_write p3 {[-99, -97, -95, 1001, 1003, 1005]} \ # OBSOLETE # {\[-99, -97, -95, 1001, 1003, 1005\]} "powerset write 11" # OBSOLETE # test_write p3 {[]} {\[\]} "powerset write 12" # OBSOLETE # OBSOLETE # reference modes # OBSOLETE test_write ref1 ->ref1 {H'[0-9a-fA-F]+} "reference write 1" # OBSOLETE test_write ref2 ->b1 {H'[0-9a-fA-F]+} "reference write 2" # OBSOLETE test_write ref1 NULL "reference write 3" # OBSOLETE test_write ref2 NULL "reference write 4" # OBSOLETE # OBSOLETE # procedure modes # OBSOLETE test_write pr1 NULL "procefure write 1" # OBSOLETE # FIXME: remove when NULL is understood # OBSOLETE test_write pr1 0 NULL "procefure write 2" # OBSOLETE test_write pr1 dummyfunc {H'[0-9a-fA-F]+ } "procedure write 3" # OBSOLETE # OBSOLETE # timing modes, FIXME when callbacks to timefunctions are implemented # OBSOLETE #test_write ti1 abstime(1970, 3, 12, 10, 43, 0) {} "time write 1" # OBSOLETE #test_write ti2 # OBSOLETE xfail "timing modes not implemented yet" # OBSOLETE # OBSOLETE # real modes # OBSOLETE # This ones # OBSOLETE test_write re1 42.03 {42.0[0-9]*} "real write 1" # OBSOLETE test_write re1 0 "real write 2" # OBSOLETE test_write re1 "1e+38" {1e\+38|1\.0[0-9]*e\+38|9\.9[0-9]*e\+37} \ # OBSOLETE "real write 3" # OBSOLETE setup_xfail "i*86-pc-linux-gnu" "m68*-*-hpux*" # OBSOLETE test_write re1 "1e+39" $infinity "real write 4" # OBSOLETE test_write re2 42.03 {42.0[0-9]*} "real write 5" # OBSOLETE test_write re2 0 "real write 6" # OBSOLETE test_write re2 "1e+308" {1e\+308} "real write 7" # OBSOLETE setup_xfail "i*86-pc-linux-gnu" "m68*-*-hpux*" # OBSOLETE test_write re2 "1e+309" $infinity "real write 8" # OBSOLETE # array modes # OBSOLETE test_write arrl1 {[(1:3): [(1:2): -128]]} {\[\(1:3\): \[\(1:2\): -128\]\]}\ # OBSOLETE "array write 1" # OBSOLETE test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\ # OBSOLETE "array write 2" # OBSOLETE test_write arrl1 {[(1): [(1:2): 127], (2): [(1:2): -128], (3): [(1:2): 127]]} {\[\(1\): \[\(1:2\): 127\], \(2\): \[\(1:2\): -128\], \(3\): \[\(1:2\): 127\]\]}\ # OBSOLETE "array write 3" # OBSOLETE test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\ # OBSOLETE "array write 4" # OBSOLETE setup_xfail "*-*-*" # OBSOLETE # Bogus test case - type mismatch? # OBSOLETE test_write arrl1 {[(1): 127, (2): -128]} "array write 5" # OBSOLETE test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\ # OBSOLETE "array write 6" # OBSOLETE # OBSOLETE # structure modes # OBSOLETE test_write strul1 {[.a: -32768, .b: 32767, .ch: "ZZZZ"]} \ # OBSOLETE {\[\.a: -32768, \.b: 32767, \.ch: \"ZZZZ\"\]} \ # OBSOLETE "structure write 1" # OBSOLETE test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \ # OBSOLETE {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \ # OBSOLETE "structure write 2" # OBSOLETE test_write strul1 -32768 {\[\.a: -32768, \.b: 0, \.ch: \"0000\"\]} \ # OBSOLETE {.a} "structure write 3" # OBSOLETE test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \ # OBSOLETE {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \ # OBSOLETE "structure write 4" # OBSOLETE test_write strul1 -32768 {\[\.a: 0, \.b: -32768, \.ch: \"0000\"\]} \ # OBSOLETE {.b} "structure write 5" # OBSOLETE test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \ # OBSOLETE {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \ # OBSOLETE "structure write 6" # OBSOLETE test_write strul1 \"HUGO\" {\[\.a: 0, \.b: 0, \.ch: \"HUGO\"\]} \ # OBSOLETE {.ch} "structure write 7" # OBSOLETE } # OBSOLETE # OBSOLETE # Start with a fresh gdb. # OBSOLETE # OBSOLETE set binfile "tests2.exe" # OBSOLETE # OBSOLETE gdb_exit # OBSOLETE gdb_start # OBSOLETE gdb_reinitialize_dir $srcdir/$subdir # OBSOLETE # OBSOLETE gdb_test "set print sevenbit-strings" ".*" # OBSOLETE # OBSOLETE if [set_lang_chill] then { # OBSOLETE write_access # OBSOLETE } else { # OBSOLETE warning "$test_name tests suppressed." # OBSOLETE }