old-cross-binutils/gdb/testsuite/gdb.chill/chillvars.exp

317 lines
11 KiB
Text
Raw Normal View History

1994-06-07 02:01:27 +00:00
# Copyright (C) 1992 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 2 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, write to the Free Software
1995-08-02 03:41:12 +00:00
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1994-06-07 02:01:27 +00:00
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# This file was written by Fred Fish. (fnf@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
From Rob Savoye (rob@poseidon.cygnus.com) * Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in}, gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in}, gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in}, gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig. * aclocal.m4, configure, gdb.base/configure, gdb.c++/configure, gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files. * config/unix-gdb.exp: Make GDB global. * gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp, commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp, langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp, ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp, signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp}, gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp, virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp, pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp, pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp}, gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues to returns as necessary, arrange for test to compile own testcase executable. * lib/gdb.exp: Changes for testsuite to compile own test cases. From Fred Fish (fnf@cygnus.com) * gdb.c++/classes.exp (test_pointers_to_class_members): Add clear_xfail at end of test which might not call either pass or fail. * gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for "backtrace through signal handler".
1995-11-25 19:55:29 +00:00
if [skip_chill_tests] then { continue }
set testfile "chillvars"
set srcfile ${srcdir}/$subdir/${testfile}.ch
set binfile ${objdir}/${subdir}/${testfile}.exe
if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
1994-06-07 02:01:27 +00:00
proc do_tests {} {
global prms_id bug_id subdir objdir srcdir binfile prompt
set prms_id 0
set bug_id 0
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
From Rob Savoye (rob@poseidon.cygnus.com) * Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in}, gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in}, gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in}, gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig. * aclocal.m4, configure, gdb.base/configure, gdb.c++/configure, gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files. * config/unix-gdb.exp: Make GDB global. * gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp, commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp, langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp, ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp, signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp}, gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp, virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp, pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp, pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp}, gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues to returns as necessary, arrange for test to compile own testcase executable. * lib/gdb.exp: Changes for testsuite to compile own test cases. From Fred Fish (fnf@cygnus.com) * gdb.c++/classes.exp (test_pointers_to_class_members): Add clear_xfail at end of test which might not call either pass or fail. * gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for "backtrace through signal handler".
1995-11-25 19:55:29 +00:00
gdb_load $binfile
1994-06-07 02:01:27 +00:00
send "set language chill\n" ; expect -re "$prompt $"
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.
send "break chillvars.ch:3\n" ; expect -re "$prompt $"
send "delete 1\n" ; expect -re "$prompt $"
send "set width 0\n" ; expect -re "$prompt $"
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
test_BOOL
test_CHAR
test_BYTE
test_UBYTE
test_INT
test_UINT
test_LONG
test_ULONG
test_REAL
test_LONG_REAL
test_POWERSET
test_arrays
test_strings
test_structs
test_ptr
1994-06-07 02:01:27 +00:00
}
proc test_BOOL {} {
gdb_test "ptype bool_true" "type = (BOOL|bool)"
gdb_test "ptype bool_false" "type = (BOOL|bool)"
gdb_test "whatis bool_true" "type = (BOOL|bool)"
gdb_test "whatis bool_false" "type = (BOOL|bool)"
1994-06-07 02:01:27 +00:00
gdb_test "print bool_false" " = FALSE"
gdb_test "print bool_true" " = TRUE"
}
proc test_CHAR {} {
gdb_test "ptype control_char" "type = (CHAR|char)"
gdb_test "whatis control_char" "type = (CHAR|char)"
gdb_test "print control_char" { = '\^[(]7[)]'}
gdb_test "ptype printable_char" "type = (CHAR|char)"
gdb_test "whatis printable_char" "type = (CHAR|char)"
1994-06-07 02:01:27 +00:00
gdb_test "print printable_char" " = 'a'"
gdb_test "print lower(char)" { = '\^[(]0[)]'}
gdb_test "print upper(char)" { = '\^[(]255[)]'}
1994-06-07 02:01:27 +00:00
}
proc test_BYTE {} {
gdb_test "ptype byte_low" "type = (BYTE|byte)"
gdb_test "whatis byte_low" "type = (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test "print byte_low" " = -128"
gdb_test "ptype byte_high" "type = (BYTE|byte)"
gdb_test "whatis byte_high" "type = (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test "print byte_high" " = 127"
gdb_test "print lower(byte)" " = -128"
gdb_test "print upper(byte)" " = 127"
gdb_test "print lower(byte_high)" " = -128"
gdb_test "print upper(byte_high)" " = 127"
1994-06-07 02:01:27 +00:00
}
proc test_UBYTE {} {
gdb_test "ptype ubyte_low" "type = (UBYTE|ubyte)"
gdb_test "whatis ubyte_low" "type = (UBYTE|ubyte)"
1994-06-07 02:01:27 +00:00
gdb_test "print ubyte_low" " = 0"
gdb_test "ptype ubyte_high" "type = (UBYTE|ubyte)"
gdb_test "whatis ubyte_high" "type = (UBYTE|ubyte)"
1994-06-07 02:01:27 +00:00
gdb_test "print ubyte_high" " = 255"
}
proc test_INT {} {
gdb_test "ptype int_low" "type = (INT|int)"
gdb_test "whatis int_low" "type = (INT|int)"
1994-06-07 02:01:27 +00:00
gdb_test "print int_low" " = -32768"
gdb_test "ptype int_high" "type = (INT|int)"
gdb_test "whatis int_high" "type = (INT|int)"
1994-06-07 02:01:27 +00:00
gdb_test "print int_high" " = 32767"
}
proc test_UINT {} {
gdb_test "ptype uint_low" "type = (UINT|uint)"
gdb_test "whatis uint_low" "type = (UINT|uint)"
1994-06-07 02:01:27 +00:00
gdb_test "print uint_low" " = 0"
gdb_test "ptype uint_high" "type = (UINT|uint)"
gdb_test "whatis uint_high" "type = (UINT|uint)"
1994-06-07 02:01:27 +00:00
gdb_test "print uint_high" " = 65535"
}
proc test_LONG {} {
gdb_test "ptype long_low" "type = (LONG|long)"
gdb_test "whatis long_low" "type = (LONG|long)"
1994-06-07 02:01:27 +00:00
gdb_test "print long_low" " = -2147483648"
gdb_test "ptype long_high" "type = (LONG|long)"
gdb_test "whatis long_high" "type = (LONG|long)"
1994-06-07 02:01:27 +00:00
gdb_test "print long_high" " = 2147483647"
}
proc test_ULONG {} {
gdb_test "ptype ulong_low" "type = (ULONG|ulong)"
gdb_test "whatis ulong_low" "type = (ULONG|ulong)"
1994-06-07 02:01:27 +00:00
gdb_test "print ulong_low" " = 0"
gdb_test "ptype ulong_high" "type = (ULONG|ulong)"
gdb_test "whatis ulong_high" "type = (ULONG|ulong)"
1994-06-07 02:01:27 +00:00
gdb_test "print ulong_high" " = 4294967295"
}
proc test_REAL {} {
gdb_test "ptype real1" "type = (FLOAT|float)"
gdb_test "whatis real1" "type = (FLOAT|float)"
1994-06-07 02:01:27 +00:00
gdb_test "print real1" " = 3.14159274"
}
proc test_LONG_REAL {} {
gdb_test "ptype long_real1" "type = (DOUBLE|double)"
gdb_test "whatis long_real1" "type = (DOUBLE|double)"
1994-06-07 02:01:27 +00:00
gdb_test "print long_real1" " = 3\\.1400000000000001e\\+300"
}
proc test_POWERSET {} {
}
proc test_arrays {} {
gdb_test "ptype booltable1" "type = ARRAY \\(+0:3\\)+ (BOOL|bool)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print booltable1" \
{ = [(0): TRUE, (1:2): FALSE, (3): TRUE]}
gdb_test "ptype booltable2" "type = ARRAY \\(+4:7\\)+ (BOOL|bool)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print booltable2" { = [(4): TRUE, (5:6): FALSE, (7): TRUE]}
gdb_test "ptype chartable1" "type = ARRAY \\(+0:2\\)+ (CHAR|char)"
gdb_test_exact "print chartable1" {= [(0): '^(0)', (1): '^(1)', (2): '^(2)']}
1994-06-07 02:01:27 +00:00
gdb_test "ptype chartable2" "type = ARRAY \\(+3:5\\)+ (CHAR|char)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print chartable2" \
{= [(3): '^(0)', (4): '^(1)', (5): '^(2)']}
1994-06-07 02:01:27 +00:00
gdb_test "ptype bytetable1" "type = ARRAY \\(+0:4\\)+ (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print bytetable1" \
{= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]}
gdb_test "ptype bytetable2" "type = ARRAY \\(+5:9\\)+ (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print bytetable2" \
{= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]}
gdb_test "ptype bytetable3" \
"type = ARRAY \\(1:2\\) ARRAY \\('c':'d'\\) ARRAY \\(FALSE:TRUE\\) (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print bytetable3" \
{= [(1): [('c'): [(FALSE): 0, (TRUE): 1], ('d'): [(FALSE): 2, (TRUE): 3]], (2): [('c'): [(FALSE): 4, (TRUE): 5], ('d'): [(FALSE): 6, (TRUE): 7]]]}
gdb_test "ptype bytetable4" \
"type = ARRAY \\(1:2\\) ARRAY \\('c':'d'\\) ARRAY \\(FALSE:TRUE\\) (BYTE|byte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print bytetable4" \
{= [(1): [('c'): [(FALSE): 0, (TRUE): 1], ('d'): [(FALSE): 2, (TRUE): 3]], (2): [('c'): [(FALSE): 4, (TRUE): 5], ('d'): [(FALSE): 6, (TRUE): 7]]]}
1994-06-07 02:01:27 +00:00
gdb_test "ptype ubytetable1" "type = ARRAY \\(+0:4\\)+ (UBYTE|ubyte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print ubytetable1" \
{= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]}
gdb_test "ptype ubytetable2" "type = ARRAY \\(+5:9\\)+ (UBYTE|ubyte)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print ubytetable2" \
{= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]}
gdb_test "ptype inttable1" "type = ARRAY \\(+0:4\\)+ (INT|int)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print inttable1" \
{= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]}
gdb_test "ptype inttable2" "type = ARRAY \\(+5:9\\)+ (INT|int)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print inttable2" \
{= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]}
gdb_test "ptype uinttable1" "type = ARRAY \\(+0:4\\)+ (UINT|uint)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print uinttable1" \
{= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]}
gdb_test "ptype uinttable2" "type = ARRAY \\(+5:9\\)+ (UINT|uint)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print uinttable2" \
{= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]}
gdb_test "ptype longtable1" "type = ARRAY \\(+0:4\\)+ (LONG|long)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print longtable1" \
{= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]}
gdb_test "ptype longtable2" "type = ARRAY \\(+5:9\\)+ (LONG|long)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print longtable2" \
{= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]}
gdb_test "ptype ulongtable1" "type = ARRAY \\(+0:4\\)+ (ULONG|ulong)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print ulongtable1" \
{= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]}
gdb_test "ptype ulongtable2" "type = ARRAY \\(+5:9\\)+ (ULONG|ulong)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print ulongtable2" \
{= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]}
gdb_test "ptype realtable1" "type = ARRAY \\(+0:4\\)+ (FLOAT|float)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print realtable1" \
{= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]}
gdb_test "ptype realtable2" "type = ARRAY \\(+5:9\\)+ (FLOAT|float)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print realtable2" \
{= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]}
gdb_test "ptype longrealtable1" "type = ARRAY \\(+0:4\\)+ (DOUBLE|double)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print longrealtable1" \
{= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]}
gdb_test "ptype longrealtable2" "type = ARRAY \\(+5:9\\)+ (DOUBLE|double)"
1994-06-07 02:01:27 +00:00
gdb_test_exact "print longrealtable2" \
{= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]}
gdb_test "print length(longrealtable2)" {= 5}
gdb_test "print lower(longrealtable2)" {= 5}
gdb_test "print upper(longrealtable2)" {= 9}
1994-06-07 02:01:27 +00:00
}
proc test_strings {} {
gdb_test "ptype string1" "type = CHARS \[(\]4\[)\]+"
gdb_test "print string1" " = \"abcd\""
gdb_test "ptype string2" "type = CHARS \[(\]+5\[)\]+"
gdb_test "print string2" { = \"ef\^\(0\)gh\"}
1994-06-07 02:01:27 +00:00
gdb_test "ptype string3" "type = CHARS \[(\]+6\[)\]+"
gdb_test "print string3" " = \"efghij\""
gdb_test "ptype string4" "type = CHARS \[(\]+7\[)\]+"
gdb_test "print string4" { = \"zzzzzz\^\(0\)\"}
1994-06-07 02:01:27 +00:00
# These tests require a running process, so run to one of the procs
# and then do the tests.
if [runto scalar_arithmetic] then {
gdb_test "ptype string1//string2" "type = CHARS \\(9\\)"
gdb_test "print string1//string2" { = \"abcdef\^\(0\)gh\"}
1994-06-07 02:01:27 +00:00
gdb_test_exact {ptype "a chill string"} {type = CHARS (14)}
gdb_test "print 'a chill string'" " = \"a chill string\""
gdb_test "print \"ef\"//c'00'//\"gh\"" { = \"ef\^\(0\)gh\"}
1994-06-07 02:01:27 +00:00
gdb_test "print string1 // \"efgh\"" " = \"abcdefgh\""
gdb_test "print (6) 'z'" " = \"zzzzzz\""
gdb_test "ptype (6) 'z'" "type = CHARS \[(\]+6\[)\]+"
gdb_test "print (1+2*3) 'x'" " = \"xxxxxxx\""
gdb_test "ptype (1+2*3) 'x'" "type = CHARS \[(\]+7\[)\]+"
}
}
proc test_structs {} {
gdb_test "ptype struct1" \
"type = STRUCT \\(+.*abool (BOOL|bool),.*aint (INT|int),.*astring CHARS \\(+8\\)+.*\\)+"
1994-06-07 02:01:27 +00:00
gdb_test "print struct1" \
".* = \\\[\.abool: TRUE, \.aint: 123, \.astring: \"a string\"\\\]"
gdb_test "ptype struct2" \
"type = STRUCT \\(+.*abool (BOOL|bool),.*nstruct simple_struct,.*aint (INT|int).*\\)+"
1994-06-07 02:01:27 +00:00
gdb_test "print struct2" \
".* = \\\[.abool: TRUE, \.nstruct: \\\[\.abool: FALSE, \.aint: 456, \.astring: \"deadbeef\"\\\], \.aint: 789\\\]"
}
proc test_ptr {} {
# This is to test Cygnus PR 6932
gdb_test "print xptr->int" ".* = 32767"
}
From Rob Savoye (rob@poseidon.cygnus.com) * Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in}, gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in}, gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in}, gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig. * aclocal.m4, configure, gdb.base/configure, gdb.c++/configure, gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files. * config/unix-gdb.exp: Make GDB global. * gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp, commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp, langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp, ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp, signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp}, gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp, virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp, pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp, pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp}, gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues to returns as necessary, arrange for test to compile own testcase executable. * lib/gdb.exp: Changes for testsuite to compile own test cases. From Fred Fish (fnf@cygnus.com) * gdb.c++/classes.exp (test_pointers_to_class_members): Add clear_xfail at end of test which might not call either pass or fail. * gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for "backtrace through signal handler".
1995-11-25 19:55:29 +00:00
do_tests