old-cross-binutils/gdb/testsuite/gdb.base/setvar.exp

391 lines
22 KiB
Text
Raw Normal View History

# Copyright (C) 1988, 1990, 1991, 1992, 1994, 1995
# Free Software Foundation, Inc.
1994-06-07 01:57:15 +00:00
# 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1994-06-07 01:57:15 +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 Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
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
set testfile "setvar"
set srcfile ${testfile}.c
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
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
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
perror "Couldn't compile ${srcfile}"
return -1
}
1994-06-07 01:57:15 +00:00
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
1994-06-07 01:57:15 +00:00
}
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 01:57:15 +00:00
#
# set it up at a breakpoint so we canplay with the variable values
#
send_gdb "set print sevenbit-strings\n" ; expect -re "$gdb_prompt $"
1994-06-07 01:57:15 +00:00
if ![runto_main] then {
1994-06-07 01:57:15 +00:00
perror "couldn't run to breakpoint"
continue
}
# Determine expected output for unsigned long variables,
# the output varies with sizeof (unsigned long).
set ulong_minus_1 4294967295
set ulong_minus_456 4294966840
send_gdb "print sizeof (unsigned long)\n"
1994-06-07 01:57:15 +00:00
expect {
-re ".\[0-9\]* = 4.*$gdb_prompt $" {}
-re ".\[0-9\]* = 8.*$gdb_prompt $" {
1994-06-07 01:57:15 +00:00
set ulong_minus_1 18446744073709551615
set ulong_minus_456 18446744073709551160
}
-re ".*$gdb_prompt $" {
1994-06-07 01:57:15 +00:00
fail "getting sizeof unsigned long"
}
default { fail "(timeout) getting sizeof unsigned long" }
}
proc test_set { args } {
global gdb_prompt
set length [expr [llength $args] - 3];
set print_cmd "[lindex $args $length]";
set print_result "[lindex $args [expr $length + 1]]";
set message "[lindex $args [expr $length + 2]]";
# Set up the variables.
for {set x 0;} {$x < $length} {incr x;} {
if { "[lindex $args $x]" != "" } {
verbose "doing [lindex $args $x]"
1997-02-21 00:22:50 +00:00
if [gdb_test "[lindex $args $x]" "" ""] {
fail "$message [lindex $args $x]";
return 1;
}
}
}
verbose "expecting $print_result from '$print_cmd'"
# Now run the test.
1997-02-21 00:22:50 +00:00
return [gdb_test "$print_cmd" "$print_result" "$message"];
}
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "char"
#
# Because bare char types can be either signed or unsigned, we just test the
# range of values that are common to both (0-127).
#
test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
test_set "set variable v_char=27" "print v_char" ".\[0-9\]* = 27 \'.e\'" "set variable char=27 (Esc)"
test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')"
test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')"
test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed char"
#
test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
test_set "set variable v_signed_char=27" "print v_signed_char" ".\[0-9\]* = 27 \'.e\'" "set variable signed char=27 (Esc)"
test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')"
test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')"
test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)"
gdb_test "set variable v_signed_char=-1" ""
* gdb.base/callfuncs.exp (do_function_calls): Add alpha-dec-osf2* clear_xfail for "p t_float_values2(3.14159,float_val2)" for gcc compiled test. * gdb.base/opaque.exp (setup_xfail_on_opaque_pointer): Add mips-sgi-irix5* xfail for not gcc compiled. * gdb.base/Makefile.in (nodebug.o): Also create nodebug.ci. * gdb.base/nodebug.exp: Add mips-sgi-irix5 xfail when not gcc compiled for "p top", "whatis top", "p middle", and "whatis middle". * gdb.base/whatis.exp: Add mips-sgi-irix* xfail for "whatis signed char" for not gcc compiled. * gdb.base/setvar.exp: Add mips-sgi-irix4* xfail (works on irix5) for "set variable signed char=-1 (-1)" and "set variable signed char=0xFF (0xFF)" for not gcc compiled. * gdb.base/funcargs.exp (float_and_integral_args): Add mips-sgi-irix5* xfail for "run to call2a" for not gcc compiled. Add mips-sgi-irix* xfail when not gcc compiled for "continue to call2b". Add mips-sgi-irix4* xfail (works with irix5) when gcc compiled for "continue to call2g". (discard_and_shuffle): Add mips-sgi-irix5* xfail whn not gcc compiled for "backtrace from call6a" (shuffle_round_robin): Add mips-sgi-irix* xfail when not gcc compiled for "backtrace from call7k". Add mips-sgi-irix5* xfail when not gcc compiled for "backtrace from call7a". (localvars_after_alloca): Fix gdb_test cmds for "print * after runto ...". Remove rs6000-*-* xfails for "print i after runto localvars_after_alloca" and "print l after runto localvars_after_alloca" for all compilers. * gdb.base/exprs.exp: Add mips-sgi-irix4* xfails (works with irix5), when not compiled with gcc, for: "print signed char == (minus)", "print signed char != (minus)", "print signed char < (minus)", "print signed char > (minus)". * gdb.base/callfuncs.exp (do_function_calls): Add mips-sgi-irix* xfail, when compiled with native compiler, for "call inferior func with struct - returns char *". * gdb.base/return.exp (return_tests): Change xfail for "correct value returned double test" to include Solaris 2.4. * gdb.base/funcargs.exp (float_and_integral_args): Add sparc-sun-solaris2* xfail for "print f1 after run to call2a".
1995-08-28 09:44:14 +00:00
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
"set variable signed char=-1 (-1)"
gdb_test "set variable v_signed_char=0xFF" ""
* gdb.base/callfuncs.exp (do_function_calls): Add alpha-dec-osf2* clear_xfail for "p t_float_values2(3.14159,float_val2)" for gcc compiled test. * gdb.base/opaque.exp (setup_xfail_on_opaque_pointer): Add mips-sgi-irix5* xfail for not gcc compiled. * gdb.base/Makefile.in (nodebug.o): Also create nodebug.ci. * gdb.base/nodebug.exp: Add mips-sgi-irix5 xfail when not gcc compiled for "p top", "whatis top", "p middle", and "whatis middle". * gdb.base/whatis.exp: Add mips-sgi-irix* xfail for "whatis signed char" for not gcc compiled. * gdb.base/setvar.exp: Add mips-sgi-irix4* xfail (works on irix5) for "set variable signed char=-1 (-1)" and "set variable signed char=0xFF (0xFF)" for not gcc compiled. * gdb.base/funcargs.exp (float_and_integral_args): Add mips-sgi-irix5* xfail for "run to call2a" for not gcc compiled. Add mips-sgi-irix* xfail when not gcc compiled for "continue to call2b". Add mips-sgi-irix4* xfail (works with irix5) when gcc compiled for "continue to call2g". (discard_and_shuffle): Add mips-sgi-irix5* xfail whn not gcc compiled for "backtrace from call6a" (shuffle_round_robin): Add mips-sgi-irix* xfail when not gcc compiled for "backtrace from call7k". Add mips-sgi-irix5* xfail when not gcc compiled for "backtrace from call7a". (localvars_after_alloca): Fix gdb_test cmds for "print * after runto ...". Remove rs6000-*-* xfails for "print i after runto localvars_after_alloca" and "print l after runto localvars_after_alloca" for all compilers. * gdb.base/exprs.exp: Add mips-sgi-irix4* xfails (works with irix5), when not compiled with gcc, for: "print signed char == (minus)", "print signed char != (minus)", "print signed char < (minus)", "print signed char > (minus)". * gdb.base/callfuncs.exp (do_function_calls): Add mips-sgi-irix* xfail, when compiled with native compiler, for "call inferior func with struct - returns char *". * gdb.base/return.exp (return_tests): Change xfail for "correct value returned double test" to include Solaris 2.4. * gdb.base/funcargs.exp (float_and_integral_args): Add sparc-sun-solaris2* xfail for "print f1 after run to call2a".
1995-08-28 09:44:14 +00:00
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
"set variable signed char=0xFF (0xFF)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned char"
#
test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
test_set "set variable v_unsigned_char=27" "print v_unsigned_char" ".\[0-9\]* = 27 \'.e\'" "set variable unsigned char=27 (Esc)"
test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')"
test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')"
test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "short"
#
test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0"
test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1"
test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed short"
#
test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0"
test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1"
test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned short"
#
test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0"
test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1"
test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "int"
#
test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0"
test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1"
test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed int"
#
test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0"
test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1"
test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned int"
#
test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0"
test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1"
test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)"
#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "long"
#
test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0"
test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1"
test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed long"
#
test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0"
test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1"
test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned long"
#
test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0"
test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1"
test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "float"
#
test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0"
test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1"
test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "double"
#
test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0"
test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1"
test_set "set variable v_double=-1.0" "print v_double" "print.*.\[0-9\]* = -1" "set variable double=-1 (minus)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "char array[2]"
#
test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" "print.*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "signed char array[2]"
#
test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" "print.*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "unsigned char array[2]"
#
test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" "print.*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "short array[2]"
#
test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable short array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "signed short array[2]"
#
test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable signed short array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "unsigned short array[2]"
#
test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" "print.*.\[0-9\]* =.*\{123,.*65080\}" "set variable unsigned short array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "int array[2]"
#
test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable int array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "signed int array[2]"
#
test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable signed int array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "unsigned int array[2]"
#
test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" "print.*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}" "set variable unsigned int array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "long array[2]"
#
test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable long array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "signed long array[2]"
#
test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable signed long array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "unsigned long array[2]"
#
test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}" "set variable unsigned long array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "float array[2]"
#
test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable float array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for "double array[2]"
#
test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "set variable double array"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "char *"
#
test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" "print.*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed char *"
#
test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" "print.*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned char *"
#
test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" "print.*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "short *"
#
test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_short_pointer+1)" "print.*.\[0-9\]* = -456" "set variable short pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed short *"
#
gdb_test "set v_signed_short_pointer=v_signed_short_array" ""
gdb_test "set variable *(v_signed_short_pointer)=123" ""
gdb_test "set variable *(v_signed_short_pointer+1)=-456" ""
gdb_test "print v_signed_short_array" ".\[0-9\]* =.*\{123,.*-456\}" \
"set variable signed short pointer"
gdb_test "print *(v_signed_short_pointer+1)" ".\[0-9\]*.*=.*-456"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned short *"
#
gdb_test "set v_unsigned_short_pointer=v_unsigned_short_array" ""
gdb_test "set variable *(v_unsigned_short_pointer)=123" ""
gdb_test "set variable *(v_unsigned_short_pointer+1)=-456" ""
gdb_test "print v_unsigned_short_array" ".\[0-9\]* =.*\{123,.*65080\}" \
"set variable unsigned short pointer"
gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "int *"
#
test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_int_pointer+1)" "print.*.\[0-9\]* = -456" "set variable int pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed int *"
#
test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_signed_int_pointer+1)" "print.*.\[0-9\]* = -456" "set variable signed int pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned int *"
#
test_set "set v_unsigned_int_pointer=v_unsigned_int_array" "set variable *(v_unsigned_int_pointer)=123" "set variable *(v_unsigned_int_pointer+1)=-456" "print v_unsigned_int_array" "print.*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}" "set variable unsigned int pointer"
test_set "" "print *(v_unsigned_int_pointer+1)" "print.*.\[0-9\]* = (4294966840|65080)" "print variable unsigned int pointer+1"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "long *"
#
test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_long_pointer+1)" "print.*.\[0-9\]* = -456" "set variable long pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "signed long *"
#
test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_signed_long_pointer+1)" "print.*.\[0-9\]* = -456" "set variable signed long pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "unsigned long *"
#
test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}" "print *(v_unsigned_long_pointer+1)" "print.*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "float *"
#
test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_float_pointer+1)" "print.*.\[0-9\]* = -456" "set variable float pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for type "double *"
#
test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" "print.*.\[0-9\]* =.*\{123,.*-456\}" "print *(v_double_pointer+1)" "print.*.\[0-9\]* = -456" "set variable double pointer"
1994-06-07 01:57:15 +00:00
#
# test "set variable" for struct members
#
test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" "print.*.\[0-9\]* = 104 \'h\'" "set variable structure char member"
test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" "print.*.\[0-9\]* = 1" "set variable structure short member"
test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" "print.*.\[0-9\]* = 2" "set variable structure int member"
test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" "print.*.\[0-9\]* = 3" "set variable structure long member"
test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" "print.*.\[0-9\]* = 4" "set variable structure float member"
test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" "print.*.\[0-9\]* = 5" "set variable structure double member"
1994-06-07 01:57:15 +00:00
gdb_test "print v_struct1" \
"print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
.*v_int_member = 2,.*\
v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \
"set print structure #1"
# This should be an error. GCC extensions for structure constants require
# the type of the structure to be specified, as in
# v_struct1 = (struct t_struct) {32, 33, 34, 35, 36, 37}
# GDB should do the same if it wants to provide this feature.
1997-02-21 00:22:50 +00:00
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "set variable v_struct1 = {32, 33, 34, 35, 36, 37}"
continue
}
gdb_test "set variable v_struct1 = {32, 33, 34, 35, 36, 37}" "Invalid.*"
# And after the error the structure should be unchanged.
gdb_test "print v_struct1" \
"print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
.*v_int_member = 2,.*\
v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \
"set print structure #2"
# Test printing of enumeration bitfields.
# GNU C supports them, some other compilers don't.
if {$gcc_compiled} then {
gdb_test "print sef.field=sm1" "print.*.\[0-9\]* = sm1"
gdb_test "print sef.field" "print.*.\[0-9\]* = sm1" "print sef.field (sm1)"
gdb_test "print sef.field=s1" "print.*.\[0-9\]* = s1"
gdb_test "print sef.field" "print.*.\[0-9\]* = s1" "print sef.field (s1)"
gdb_test "print uef.field=u2" "print.*.\[0-9\]* = u2"
gdb_test "print uef.field" "print.*.\[0-9\]* = u2" "print uef.field (u2)"
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_test "print uef.field=u1" "print.*.\[0-9\]* = u1"
gdb_test "print uef.field" "print.*.\[0-9\]* = u1" "print uef.field (u1)"
# Test for truncation when assigning invalid values to bitfields.
gdb_test "print sef.field=7" \
"print.*warning: Value does not fit in 2 bits.*\[0-9\]* = sm1"
gdb_test "print uef.field=6" \
"print.*warning: Value does not fit in 2 bits.*\[0-9\]* = u2"
1994-06-07 01:57:15 +00:00
}