2011-01-01 15:34:07 +00:00
|
|
|
# Copyright 1999, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
1999-06-15 01:08:59 +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
|
2007-08-23 18:14:19 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-06-15 01:08:59 +00:00
|
|
|
# (at your option) any later version.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-06-15 01:08:59 +00:00
|
|
|
# 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.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-06-15 01:08:59 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:14:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-06-15 01:08:59 +00:00
|
|
|
|
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
* lib/gdb.exp (gdb_compile_test): New.
(skip_ada_tests, skip_java_tests): New.
(gdb_compile): Use gdb_compile_test for f77.
* lib/ada.exp (gdb_compile_ada): Use gdb_compile_test to record result.
* lib/java.exp (compile_java_from_source): Remove runtests check,
use gdb_compile_test to record result.
* gdb.ada/packed_array.exp, gdb.ada/fixed_points.exp,
gdb.ada/exec_changed.exp, gdb.ada/start.exp,
gdb.ada/watch_arg.exp, gdb.ada/null_record.exp,
gdb.ada/array_return.exp, gdb.ada/arrayidx.exp,
gdb.mi/mi-var-child-f.exp, gdb.fortran/types.exp,
gdb.fortran/array-element.exp, gdb.fortran/subarray.exp,
gdb.fortran/derived-type.exp, gdb.fortran/exprs.exp,
gdb.java/jmisc.exp, gdb.java/jmisc1.exp, gdb.java/jprint.exp,
gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip,
adjust gdb_compile invocations.
2009-11-10 10:16:10 +00:00
|
|
|
load_lib "java.exp"
|
|
|
|
|
|
|
|
if { [skip_java_tests] } { continue }
|
|
|
|
|
1999-06-15 01:08:59 +00:00
|
|
|
proc test_integer_literals_accepted {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
gdb_test "p 123" " = 123"
|
|
|
|
gdb_test "p -123" " = -123"
|
|
|
|
gdb_test "p/d 123" " = 123"
|
|
|
|
|
|
|
|
# Test various octal values.
|
|
|
|
|
|
|
|
gdb_test "p 0123" " = 83"
|
|
|
|
gdb_test "p 00123" " = 83"
|
|
|
|
gdb_test "p -0123" " = -83"
|
|
|
|
gdb_test "p/o 0123" " = 0123"
|
|
|
|
|
|
|
|
# Test various hexadecimal values.
|
|
|
|
|
|
|
|
gdb_test "p 0x123" " = 291"
|
|
|
|
gdb_test "p -0x123" " = -291"
|
|
|
|
gdb_test "p 0x0123" " = 291"
|
|
|
|
gdb_test "p -0x0123" " = -291"
|
|
|
|
gdb_test "p 0xABCDEF" " = 11259375"
|
|
|
|
gdb_test "p 0xabcdef" " = 11259375"
|
|
|
|
gdb_test "p 0xAbCdEf" " = 11259375"
|
|
|
|
gdb_test "p/x 0x123" " = 0x123"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_character_literals_accepted {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
gdb_test "p 'a'" " = 'a'"
|
|
|
|
gdb_test "p/c 'a'" " = 'a'"
|
|
|
|
gdb_test "p/c 70" " = 'F'"
|
|
|
|
gdb_test "p/x 'a'" " = 0x61"
|
|
|
|
gdb_test "p/d 'a'" " = 97"
|
|
|
|
gdb_test "p/t 'a'" " = 1100001"
|
|
|
|
gdb_test "p/x '\\377'" " = 0xff"
|
|
|
|
gdb_test "p '\\''" " = '\\\\''"
|
|
|
|
# Note "p '\\'" => "= 92 '\\'"
|
|
|
|
gdb_test "p '\\\\'" " = '\\\\\\\\'"
|
|
|
|
|
|
|
|
# Test the /c print format.
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_integer_literals_rejected {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
test_print_reject "p 0x"
|
2002-08-15 17:18:50 +00:00
|
|
|
gdb_test "p ''" "Empty character constant"
|
|
|
|
gdb_test "p '''" "Empty character constant"
|
1999-06-15 01:08:59 +00:00
|
|
|
test_print_reject "p '\\'"
|
|
|
|
|
|
|
|
# Note that this turns into "p '\\\'" at gdb's input.
|
|
|
|
test_print_reject "p '\\\\\\'"
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
test_print_reject "p DEADBEEF"
|
|
|
|
|
|
|
|
test_print_reject "p 123DEADBEEF"
|
|
|
|
test_print_reject "p 123foobar.bazfoo3"
|
|
|
|
test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
|
|
|
|
gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
|
|
|
|
|
|
|
|
# Test various octal values.
|
|
|
|
|
|
|
|
test_print_reject "p 09"
|
|
|
|
test_print_reject "p 079"
|
|
|
|
|
|
|
|
# Test various hexadecimal values.
|
|
|
|
|
|
|
|
test_print_reject "p 0xG"
|
|
|
|
test_print_reject "p 0xAG"
|
|
|
|
}
|
|
|
|
|
2010-08-19 13:33:15 +00:00
|
|
|
proc test_float_accepted {} {
|
2010-09-06 15:48:34 +00:00
|
|
|
global gdb_prompt
|
|
|
|
|
2010-08-19 13:33:15 +00:00
|
|
|
# Test parsing of fp value with legit text following.
|
|
|
|
gdb_test "p 1234.5+1" " = 1235.5" "check fp + text"
|
|
|
|
|
|
|
|
# Test all the suffixes (including no suffix).
|
|
|
|
gdb_test "p 1." " = 1"
|
|
|
|
gdb_test "p 1.5" " = 1.5"
|
|
|
|
gdb_test "p 1.f" " = 1"
|
|
|
|
gdb_test "p 1.5f" " = 1.5"
|
|
|
|
gdb_test "p 1.d" " = 1"
|
|
|
|
gdb_test "p 1.5d" " = 1.5"
|
2010-09-06 15:48:34 +00:00
|
|
|
|
|
|
|
# Test hexadecimal floating point.
|
|
|
|
set test "p 0x1.1"
|
|
|
|
gdb_test_multiple $test $test {
|
|
|
|
-re " = 1\\.0625\r\n$gdb_prompt $" {
|
|
|
|
pass $test
|
|
|
|
}
|
|
|
|
-re "Invalid number \"0x1\\.1\"\r\n$gdb_prompt $" {
|
|
|
|
# Older glibc does not support hex float, newer does.
|
|
|
|
xfail $test
|
|
|
|
}
|
|
|
|
}
|
2010-08-19 13:33:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_float_rejected {} {
|
|
|
|
# Test bad suffixes.
|
|
|
|
test_print_reject "p 1.1x"
|
|
|
|
test_print_reject "p 1.1ff"
|
|
|
|
test_print_reject "p 1.1dd"
|
|
|
|
}
|
1999-06-15 01:08:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Start with a fresh gdb.
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
|
|
|
|
gdb_test "print \$pc" "No registers\\."
|
|
|
|
# FIXME: should also test "print $pc" when there is an execfile but no
|
|
|
|
# remote debugging target, process or corefile.
|
|
|
|
|
|
|
|
gdb_test "set print sevenbit-strings" ""
|
|
|
|
gdb_test "set print address off" "" ""
|
|
|
|
gdb_test "set width 0" ""
|
|
|
|
|
|
|
|
if [set_lang_java] then {
|
|
|
|
test_integer_literals_accepted
|
|
|
|
test_character_literals_accepted
|
|
|
|
test_integer_literals_rejected
|
2010-08-19 13:33:15 +00:00
|
|
|
test_float_accepted
|
|
|
|
test_float_rejected
|
1999-06-15 01:08:59 +00:00
|
|
|
} else {
|
2010-08-18 16:37:22 +00:00
|
|
|
warning "Java print command tests suppressed"
|
1999-06-15 01:08:59 +00:00
|
|
|
}
|