new files -- part of HP merge.

This commit is contained in:
David Taylor 1999-01-04 21:35:27 +00:00
parent ee7ae7ae52
commit 53c8a4de28
5 changed files with 799 additions and 0 deletions

View File

@ -27,7 +27,10 @@ Makefile.in
README README
a1-selftest.exp a1-selftest.exp
a2-run.exp a2-run.exp
all-bin.exp
all-types.c all-types.c
arithmet.exp
assign.exp
bar.c bar.c
baz.c baz.c
bitfields.c bitfields.c
@ -43,7 +46,10 @@ call-return-struct.c
call-strings.c call-strings.c
commands.exp commands.exp
compiler.c compiler.c
completion.exp
cond-expr.exp
condbreak.c condbreak.c
condbreak.exp
configure configure
configure.in configure.in
constvars.c constvars.c
@ -53,8 +59,12 @@ crossload.exp
d10v.ld d10v.ld
d10vovly.c d10vovly.c
default.exp default.exp
define.exp
display.c display.c
dollar.exp
echo.exp echo.exp
environment.exp
eval-skip.exp
exprs.c exprs.c
exprs.exp exprs.exp
foo.c foo.c
@ -69,6 +79,7 @@ interrupt.c
interrupt.exp interrupt.exp
int-type.c int-type.c
jump.c jump.c
jump.exp
langs.exp langs.exp
langs0.c langs0.c
langs1.c langs1.c
@ -79,6 +90,7 @@ list.exp
list0.c list0.c
list0.h list0.h
list1.c list1.c
logical.exp
m32r.ld m32r.ld
m32rovly.c m32rovly.c
m68k-aout.u m68k-aout.u
@ -98,6 +110,7 @@ overlays.exp
ovlymgr.c ovlymgr.c
ovlymgr.h ovlymgr.h
pointers.c pointers.c
pointers.exp
pointers2.c pointers2.c
printcmds.c printcmds.c
printcmds.exp printcmds.exp
@ -107,6 +120,7 @@ radix.exp
recurse.c recurse.c
recurse.exp recurse.exp
regs.exp regs.exp
relational.exp
reread.exp reread.exp
reread1.c reread1.c
reread2.c reread2.c
@ -118,6 +132,7 @@ run.c
scope.exp scope.exp
scope0.c scope0.c
scope1.c scope1.c
section_command.exp
setshow.c setshow.c
setshow.exp setshow.exp
setvar.c setvar.c
@ -147,6 +162,7 @@ watchpoint.c
watchpoint.exp watchpoint.exp
whatis.c whatis.c
whatis.exp whatis.exp
whatis-expr.exp
Things-to-lose: Things-to-lose:
structs.c structs.c

View File

@ -0,0 +1,128 @@
# Copyright (C) 1997, 1998 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# GDB tests for names beginning with '$'
# This is aimed at HP-UX systems where a lot of system
# routines and names begin with '$' or '$$'. GDB 4.16 was
# unable to deal with these names as they clashed with
# convenience variables. Wildebeest should accept such
# names in preference to convenience variables.
# This file was written by Satish Pai <pai@apollo.hp.com>
# 1997-09-24
if ![ istarget "*-*-hpux*" ] then {
return
}
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "exprs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
#source ${binfile}.ci
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
# Test for millicode routines
send_gdb "print \$\$dyncall\n"
gdb_expect {
-re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall" }
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall -- interpreted as convenience var" }
-re "$gdb_prompt $" { fail "print \$\$dyncall" }
timeout { fail "(timeout) print \$\$dyncall" }
}
send_gdb "print \$\$dyncall_external\n"
gdb_expect {
-re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall_external -- interpreted as convenience var" }
-re "$gdb_prompt $" { fail "print \$\$dyncall_external" }
timeout { fail "(timeout) print \$\$dyncall_external" }
}
# Set a breakpoint on a millicode routine
send_gdb "break \$\$dyncall\n"
gdb_expect {
-re "Breakpoint \[0-9\]* at $hex.*$gdb_prompt $" { pass "break \$\$dyncall" }
-re "Function.*not defined.*$gdb_prompt $" {fail "break \$\$dyncall -- no \$\$dyncall?" }
-re "Convenience variables used in line specs must have integer values\\..*$gdb_prompt $" {
fail "break \$\$dyncall -- treated as convenince variable"
}
-re "$gdb_prompt $" { fail "print break \$\$dyncall" }
timeout { fail "(timeout) print break \$\$dyncall" }
}
# Disassemble $$dyncall
send_gdb "disassemble \$\$dyncall\n"
gdb_expect {
-re "Dump of assembler code for function.*$gdb_prompt $" { pass "disas \$\$dyncall" }
-re "$gdb_prompt $" { fail "disas \$\$dyncall" }
timeout { fail "(timeout) disas \$\$dyncall" }
}
# Try to set $$dyncall like a convenience var.
send_gdb "set \$\$dyncall = 77\n"
gdb_expect {
-re "Invalid cast.*$gdb_prompt $" { pass "set \$\$dyncall = 77" }
-re "$gdb_prompt $" { fail "set \$\$dyncall = 77" }
timeout { fail "(timeout) set \$\$dyncall = 77" }
}
# Try out some other $ name, not millicode
send_gdb "print \$ARGV\n"
gdb_expect {
-re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \$ARGV" }
-re "\\$\[0-9\]* = void.*$gdb_prompt $" { fail "print \$ARGV (interpreted as convenience var)" }
-re "$gdb_prompt $" { fail "print \$ARGV" }
timeout { fail "(timeout) print \$ARGV" }
}
send_gdb "ptype \$ARGV\n"
gdb_expect {
-re "type = <data variable, no debug info>.*$gdb_prompt $" { pass "ptype \$ARGV" }
-re "type = void.*$gdb_prompt $" { fail "ptype \$ARGV (interpreted as convenience var)" }
-re "$gdb_prompt $" { fail "ptype \$ARGV" }
timeout { fail "(timeout) ptype \$ARGV" }
}

View File

@ -0,0 +1,329 @@
# Copyright (C) 1997, 1998 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
if $tracelevel then {
strace $tracelevel
}
global usestubs
#
# test running programs
#
set prms_id 0
set bug_id 0
# This test exists solely to exercise the "environment" commands for
# code-coverage on HP-UX.
#
if ![istarget "hppa*-*-hpux*"] then {
return
}
set testfile "break"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then { fail "environment command tests suppressed" }
# (No, this is not really related to the environment commands. But it's
# a convenient place to verify that this command works.)
#
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
{pass "info program"}
-re "$gdb_prompt $"\
{fail "info program"}
timeout {fail "(timeout) info program"}
}
# We don't really care where this step lands, so long as it gets
# the inferior pushed off the breakpoint it's currently on...
#
send_gdb "next\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "step before info program"}
timeout {fail "(timeout) step before info program"}
}
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
{pass "info program after step"}
-re "$gdb_prompt $"\
{fail "info program after step"}
timeout {fail "(timeout) info program after step"}
}
if ![runto_main] then { fail "environment command tests suppressed" }
send_gdb "delete\n"
gdb_expect {
-re ".*y or n. $"\
{send_gdb "y\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "delete breakpoint before info program"}
timeout {fail "(timeout) delete breakpoint before info program"}
}
}
-re "$gdb_prompt $"\
{fail "delete breakpoint before info program"}
timeout {fail "(timeout) delete breakpoint before info program"}
}
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
{pass "info program after deleted breakpoint"}
-re "$gdb_prompt $"\
{fail "info program after deleted breakpoint"}
timeout {fail "(timeout) info program after deleted breakpoint"}
}
# Verify that we can show all currently-set environment variables.
# (It's a bit hacky, but nonetheless probably safe to check for at
# least the SHELL variable.)
#
# need to increase timeout because of very long output
set oldtimeout $timeout
set timeout [expr "$timeout + 300"]
send_gdb "show environment\n"
gdb_expect {
-re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
{pass "show environment"}
-re "$gdb_prompt $"\
{fail "show environment"}
timeout {fail "(timeout) show environment"}
}
set timeout $oldtimeout
# Verify that we can unset a specific environment variable.
#
send_gdb "unset environment EDITOR\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue unset environment"}
timeout {fail "(timeout) issue unset environment"}
}
send_gdb "show environment EDITOR\n"
gdb_expect {
-re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
{pass "unset environment"}
-re "$gdb_prompt $"\
{fail "unset environment"}
timeout {fail "(timeout) unset environment"}
}
# Verify that we can unset all environment variables.
#
send_gdb "unset environment\n"
gdb_expect {
-re "Delete all environment variables.*y or n. $"\
{send_gdb "y\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "unset entire environment"}
timeout {fail "(timeout) unset entire environment"}
}
}
-re "$gdb_prompt $"\
{fail "unset entire environment"}
timeout {fail "(timeout) unset entire environment"}
}
# Verify that we can set a specific environment variable.
#
send_gdb "set environment EDITOR emacs\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue set environment"}
timeout {fail "(timeout) issue set environment"}
}
send_gdb "show environment EDITOR\n"
gdb_expect {
-re "EDITOR = emacs\r\n$gdb_prompt $"\
{pass "set environment"}
-re "$gdb_prompt $"\
{fail "set environment"}
timeout {fail "(timeout) set environment"}
}
# Verify that GDB responds gracefully to a request to set environment,
# with no variable name.
#
send_gdb "set environment\n"
gdb_expect {
-re "Argument required .environment variable and value..*$gdb_prompt $"\
{pass "set environment without variable disallowed"}
-re "$gdb_prompt $"\
{fail "set environment without variable disallowed"}
timeout {fail "(timeout) set environment without variable disallowed"}
}
# I'm not sure just what GDB has in mind in explicitly checking
# for this variant, but since GDB handles it, test it.
#
send_gdb "set environment =\n"
gdb_expect {
-re "Argument required .environment variable to set..*$gdb_prompt $"\
{pass "set environment equals without variable disallowed"}
-re "$gdb_prompt $"\
{fail "set environment equals without variable disallowed"}
timeout {fail "(timeout) set environment equals without variable disallowed"}
}
# Setting an environment variable without a value sets it to a NULL
# value.
#
send_gdb "set environment EDITOR\n"
gdb_expect {
-re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
{pass "issue set environment without variable value"}
-re "$gdb_prompt $"\
{fail "issue set environment without variable value"}
timeout {fail "(timeout) issue set environment without variable value"}
}
send_gdb "show environment EDITOR\n"
gdb_expect {
-re "EDITOR = \r\n$gdb_prompt $"\
{pass "set environment without variable value"}
-re "$gdb_prompt $"\
{fail "set environment without variable value"}
timeout {fail "(timeout) set environment without variable value"}
}
# Verify that GDB responds gracefully to an attempt to show a
# non-existent environment variable. (We hope this variable is
# undefined!)
#
send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
{pass "show non-existent environment variable disallowed"}
-re "$gdb_prompt $"\
{fail "show non-existent environment variable disallowed"}
timeout {fail "(timeout) show non-existent environment variable disallowed"}
}
# Verify that GDB can set an environment variable hitherto undefined.
#
send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue set environment for previously undefined variable"}
timeout {fail "(timeout) issue set environment for previously undefined variable"}
}
send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
{pass "set environment for previously undefined variable"}
-re "$gdb_prompt $"\
{fail "set environment for previously undefined variable"}
timeout {fail "(timeout) set environment for previously undefined variable"}
}
# Verify that GDB can also set an environment variable using the "="
# syntax.
#
send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue set environment with equals"}
timeout {fail "(timeout) issue set environment with equals"}
}
send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
{pass "set environment with equals"}
-re "$gdb_prompt $"\
{fail "set environment with equals"}
timeout {fail "(timeout) set environment with equals"}
}
# Verify that GDB can set an environment variable to a value that has
# an embedded (trailing, in this case) equals.
#
send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue set environment with trailing equals"}
timeout {fail "(timeout) issue set environment with trailing equals"}
}
send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
{pass "set environment with trailing equals"}
-re "$gdb_prompt $"\
{fail "set environment with trailing equals"}
timeout {fail "(timeout) set environment with trailing equals"}
}
# Verify that GDB can set an environment variable to a value preceded
# by whitespace, and that such whitespace is ignored (not included
# in the set value).
#
send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = foo\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "issue set environment with preceding whitespace"}
timeout {fail "(timeout) issue set environment with preceding whitespace"}
}
send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
{pass "set environment with preceding whitespace"}
-re "$gdb_prompt $"\
{fail "set environment with preceding whitespace"}
timeout {fail "(timeout) set environment with preceding whitespace"}
}
# Verify that GDB can manipulate the distinguished PATH variable.
#
send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
gdb_expect {
-re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
{pass "issue path"}
-re "$gdb_prompt $"\
{fail "issue path"}
timeout {fail "(timeout) issue path"}
}
send_gdb "show paths\n"
gdb_expect {
-re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
{pass "show paths"}
-re "$gdb_prompt $"\
{fail "show paths"}
timeout {fail "(timeout) show paths"}
}
gdb_exit
return 0

View File

@ -0,0 +1,109 @@
# Copyright (C) 1997, 1998 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
if $tracelevel then {
strace $tracelevel
}
global usestubs
#
# test running programs
#
set prms_id 0
set bug_id 0
# This test exists solely to exercise the "section" command for
# code-coverage on HP-UX. (So far as I can tell, the "section"
# command isn't needed on HP-UX, but probably is for embedded
# apps.)
#
if ![istarget "hppa*-*-hpux*"] then {
return
}
set testfile "break"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then { fail "section command tests suppressed" }
# Get the $CODE$ section's starting address.
#
# (Note that this works for PA32 programs, which use the SOM file
# format. PA64 uses ELF, and when support for that is added, it's
# not clear that there'll be a section named "$CODE$" in such
# programs.)
#
send_gdb "info files\n"
gdb_expect {
-re ".*(0x\[0-9a-fA-F\]*) - (0x\[0-9a-fA-F\]*) is .CODE..*$gdb_prompt $"\
{pass "info files"}
-re "$gdb_prompt $"\
{fail "info files"}
timeout {fail "(timeout) info files"}
}
# Reset the section to that same starting address, which should be
# harmless (i.e., we just want to exercise the section command).
#
send_gdb "section \$CODE\$ $expect_out(1,string)\n"
gdb_expect {
-re ".*$expect_out(1,string) \- $expect_out(2,string) is .CODE..*$gdb_prompt $"\
{pass "set section command"}
-re "$gdb_prompt $"\
{fail "set section command"}
timeout {fail "(timeout) set section command"}
}
# Verify that GDB responds gracefully to a non-existent section name.
#
send_gdb "section FOOBARBAZ 0x1234\n"
gdb_expect {
-re "Section FOOBARBAZ not found\r\n$gdb_prompt $"\
{pass "non-existent section disallowed"}
-re "$gdb_prompt $"\
{fail "non-existent section disallowed"}
timeout {fail "(timeout) non-existent section disallowed"}
}
# We "happen to know" that GDB uses a fixed size character buffer to
# parse the section name into, and the buffer is declared to be 100
# characters in length. Verify that GDB gracefully handles section
# names longer than that. (The section is also non-existent.)
#
send_gdb "section A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 0x1234\n"
gdb_expect {
-re "Section A23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 not found\r\n$gdb_prompt $"\
{pass "non-existent too-long section disallowed"}
-re "$gdb_prompt $"\
{fail "non-existent too-long section disallowed"}
timeout {fail "(timeout) non-existent too-long section disallowed"}
}
gdb_exit
return 0

View File

@ -0,0 +1,217 @@
# Copyright (C) 1998 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# tests for whatis command on expressions.
# used in file eval.c. This flavor of whatis
# command performs evaluation of expressions w/o actually
# computing the value, but just the type
# of the result. It goes through the evaluate_subexp_standard
# with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
#
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "int-type"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
#
# test expressions with "int" types
#
gdb_test "set variable x=14" "" "set variable x=14"
gdb_test "set variable y=2" "" "set variable y=2"
gdb_test "set variable z=2" "" "set variable z=2"
gdb_test "set variable w=3" "" "set variable w=3"
send_gdb "print x\n"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
pass "print value of x"
}
-re ".*$gdb_prompt $" { fail "print value of x" }
timeout { fail "(timeout) print value of x" }
}
send_gdb "print y\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of y"
}
-re ".*$gdb_prompt $" { fail "print value of y" }
timeout { fail "(timeout) print value of y" }
}
send_gdb "print z\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of z"
}
-re ".*$gdb_prompt $" { fail "print value of z" }
timeout { fail "(timeout) print value of z" }
}
send_gdb "print w\n"
gdb_expect {
-re ".*3.*$gdb_prompt $" {
pass "print value of w"
}
-re ".*$gdb_prompt $" { fail "print value of w" }
timeout { fail "(timeout) print value of w" }
}
send_gdb "whatis x+y\n"
gdb_expect {
-re ".*type = long.*$gdb_prompt $" {
pass "whatis value of x+y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x+y" }
timeout { fail "(timeout) whatis value of x+y" }
}
send_gdb "whatis x-y\n"
gdb_expect {
-re ".*type = long.*$gdb_prompt $" {
pass "whatis value of x-y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x-y" }
timeout { fail "(timeout) whatis value of x-y" }
}
send_gdb "whatis x*y\n"
gdb_expect {
-re ".*type = long.*$gdb_prompt $" {
pass "whatis value of x*y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x*y" }
timeout { fail "(timeout) whatis value of x*y" }
}
send_gdb "whatis x/y\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x/y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x/y" }
timeout { fail "(timeout) whatis value of x/y" }
}
send_gdb "whatis x%y\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x%y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x%y" }
timeout { fail "(timeout) whatis value of x%y" }
}
send_gdb "whatis x=y\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x=y"
}
-re ".*$gdb_prompt $" { fail "whatis value of x=y" }
timeout { fail "(timeout) whatis value of x=y" }
}
send_gdb "whatis x+=2\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x+=2"
}
-re ".*$gdb_prompt $" { fail "whatis value of x+=2" }
timeout { fail "(timeout) whatis value of x+=2" }
}
send_gdb "whatis ++x\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of ++x"
}
-re ".*$gdb_prompt $" { fail "whatis value of ++x" }
timeout { fail "(timeout) whatis value of ++x" }
}
send_gdb "whatis --x\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of --x"
}
-re ".*$gdb_prompt $" { fail "whatis value of --x" }
timeout { fail "(timeout) whatis value of --x" }
}
send_gdb "whatis x++\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x++"
}
-re ".*$gdb_prompt $" { fail "whatis value of x++" }
timeout { fail "(timeout) whatis value of x++" }
}
send_gdb "whatis x--\n"
gdb_expect {
-re ".*type = int.*$gdb_prompt $" {
pass "whatis value of x--"
}
-re ".*$gdb_prompt $" { fail "whatis value of x--" }
timeout { fail "(timeout) whatis value of x--" }
}
gdb_exit
return 0