blob: 3c65257345b697c9b42322d5ab7251ad3755ec32 [file] [log] [blame]
# Copyright 2005 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.
if $tracelevel then {
strace $tracelevel
}
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
set prms_id 0
set bug_id 0
if [target_info exists nocarbon64] {
verbose "Skipping Carbon tests on 64-bit PowerPC."
return
}
set testfile "ostype"
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."
}
# Start with a fresh gdb
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "break [gdb_get_line_number "run to this point"]" "Breakpoint 1 at $hex: file.*, line.*\\." "breakpoint after ostypes set up"
gdb_test "run" "Starting program: $binfile *\r\n\Reading symbols for shared libraries \(\[.+\]\)+ done.*Breakpoint 1, main.*" "continue to breakpoint in main()"
gdb_test "p /T x\[0\]" "= 'FeqA'"
gdb_test "p /T x\[1\]" {= '\\000\\000\\000\\000'}
gdb_test "p /T x\[2\]" {= '\\012\\012\\012\\012'}
# make sure it ignores sizes and counts in the 'p' command
gdb_test "p /8Tg x\[0\]" "Size letters are meaningless in \"print\" command."
gdb_test "p /8T x\[0\]" "Item count other than 1 is meaningless in \"print\" command."
# make sure 'x' honors the count but ignores the size
gdb_test "x /4Tg x" {.*'FeqA'.*'\\000\\000\\000\\000'.*'\\012\\012\\012\\012'.*'XXXX'}
gdb_test "p/T a" "= 'abcd'"
gdb_test "x/T &a" "$hex:\[ \]*'abcd'"
gdb_test "help x" ".*T.OSType.*"
send_gdb "set interpreter mi1\n"
mi_gdb_test "11-stack-list-locals 2 1" "11\\^done,locals=.*" "create varobjs for local variables"
mi_gdb_test "22-var-evaluate-expression var1" "22\\^done,value=.1633837924.*" "value of a as an integer"
mi_gdb_test "33-var-set-format var1 unsigned" "33\\^done,format=.unsigned.*" "set formatting of a to unsigned"
mi_gdb_test "44-var-evaluate-expression var1" "44\\^done,value=.1633837924.*" "value of a as an unsigned"
mi_gdb_test "55-var-set-format var1 OSType" "55\\^done,format=.OSType.*" "set formatting of a to OSType"
mi_gdb_test "66-var-evaluate-expression var1" "66\\^done,value=.abcd.*" "value of a as an OSType"
mi_gdb_test "77-var-set-format var1 unsigned" "77\\^done,format=.unsigned.*" "set formatting of a to unsigned again"
mi_gdb_test "88-var-evaluate-expression var1" "88\\^done,value=.1633837924.*" "value of a as an unsigned again"
gdb_exit
return 0