OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [testsuite/] [gdb.java/] [jv-print.exp] - Diff between revs 157 and 223

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# Copyright 1999, 2007, 2008 Free Software Foundation, Inc.
# Copyright 1999, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
# along with this program.  If not, see .
# Please email any bugs, comments, and/or additions to this file to:
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# bug-gdb@prep.ai.mit.edu
if $tracelevel then {
if $tracelevel then {
        strace $tracelevel
        strace $tracelevel
}
}
set prms_id 0
set prms_id 0
set bug_id 0
set bug_id 0
# Set the current language to Java.  This counts as a test.  If it
# Set the current language to Java.  This counts as a test.  If it
# fails, then we skip the other tests.
# fails, then we skip the other tests.
proc set_lang_java {} {
proc set_lang_java {} {
    global gdb_prompt
    global gdb_prompt
    if [gdb_test "set language java" "" "set language java"] {
    if [gdb_test "set language java" "" "set language java"] {
        return 0
        return 0
    }
    }
    if [gdb_test "show language" ".* source language is \"java\".*"] {
    if [gdb_test "show language" ".* source language is \"java\".*"] {
        return 0
        return 0
    }
    }
    return 1;
    return 1;
}
}
proc test_integer_literals_accepted {} {
proc test_integer_literals_accepted {} {
    global gdb_prompt
    global gdb_prompt
    # Test various decimal values.
    # Test various decimal values.
    gdb_test "p 123" " = 123"
    gdb_test "p 123" " = 123"
    gdb_test "p -123" " = -123"
    gdb_test "p -123" " = -123"
    gdb_test "p/d 123" " = 123"
    gdb_test "p/d 123" " = 123"
    # Test various octal values.
    # Test various octal values.
    gdb_test "p 0123" " = 83"
    gdb_test "p 0123" " = 83"
    gdb_test "p 00123" " = 83"
    gdb_test "p 00123" " = 83"
    gdb_test "p -0123" " = -83"
    gdb_test "p -0123" " = -83"
    gdb_test "p/o 0123" " = 0123"
    gdb_test "p/o 0123" " = 0123"
    # Test various hexadecimal values.
    # Test various hexadecimal values.
    gdb_test "p 0x123" " = 291"
    gdb_test "p 0x123" " = 291"
    gdb_test "p -0x123" " = -291"
    gdb_test "p -0x123" " = -291"
    gdb_test "p 0x0123" " = 291"
    gdb_test "p 0x0123" " = 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 0xabcdef" " = 11259375"
    gdb_test "p 0xAbCdEf" " = 11259375"
    gdb_test "p 0xAbCdEf" " = 11259375"
    gdb_test "p/x 0x123" " = 0x123"
    gdb_test "p/x 0x123" " = 0x123"
}
}
proc test_character_literals_accepted {} {
proc test_character_literals_accepted {} {
    global gdb_prompt
    global gdb_prompt
    gdb_test "p 'a'" " = 'a'"
    gdb_test "p 'a'" " = 'a'"
    gdb_test "p/c 'a'" " = 'a'"
    gdb_test "p/c 'a'" " = 'a'"
    gdb_test "p/c 70" " = 'F'"
    gdb_test "p/c 70" " = 'F'"
    gdb_test "p/x 'a'" " = 0x61"
    gdb_test "p/x 'a'" " = 0x61"
    gdb_test "p/d 'a'" " = 97"
    gdb_test "p/d 'a'" " = 97"
    gdb_test "p/t 'a'" " = 1100001"
    gdb_test "p/t 'a'" " = 1100001"
    gdb_test "p/x '\\377'" " = 0xff"
    gdb_test "p/x '\\377'" " = 0xff"
    gdb_test "p '\\''" " = '\\\\''"
    gdb_test "p '\\''" " = '\\\\''"
    # Note "p '\\'" => "= 92 '\\'"
    # Note "p '\\'" => "= 92 '\\'"
    gdb_test "p '\\\\'" " = '\\\\\\\\'"
    gdb_test "p '\\\\'" " = '\\\\\\\\'"
    # Test the /c print format.
    # Test the /c print format.
}
}
proc test_integer_literals_rejected {} {
proc test_integer_literals_rejected {} {
    global gdb_prompt
    global gdb_prompt
    test_print_reject "p 0x"
    test_print_reject "p 0x"
    gdb_test "p ''" "Empty character constant"
    gdb_test "p ''" "Empty character constant"
    gdb_test "p '''" "Empty character constant"
    gdb_test "p '''" "Empty character constant"
    test_print_reject "p '\\'"
    test_print_reject "p '\\'"
    # Note that this turns into "p '\\\'" at gdb's input.
    # Note that this turns into "p '\\\'" at gdb's input.
    test_print_reject "p '\\\\\\'"
    test_print_reject "p '\\\\\\'"
    # Test various decimal values.
    # Test various decimal values.
    test_print_reject "p DEADBEEF"
    test_print_reject "p DEADBEEF"
    test_print_reject "p 123DEADBEEF"
    test_print_reject "p 123DEADBEEF"
    test_print_reject "p 123foobar.bazfoo3"
    test_print_reject "p 123foobar.bazfoo3"
    test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
    test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
    gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
    gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
    # Test various octal values.
    # Test various octal values.
    test_print_reject "p 09"
    test_print_reject "p 09"
    test_print_reject "p 079"
    test_print_reject "p 079"
    # Test various hexadecimal values.
    # Test various hexadecimal values.
    test_print_reject "p 0xG"
    test_print_reject "p 0xG"
    test_print_reject "p 0xAG"
    test_print_reject "p 0xAG"
}
}
# Start with a fresh gdb.
# Start with a fresh gdb.
gdb_exit
gdb_exit
gdb_start
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_reinitialize_dir $srcdir/$subdir
gdb_test "print \$pc" "No registers\\."
gdb_test "print \$pc" "No registers\\."
# FIXME: should also test "print $pc" when there is an execfile but no
# FIXME: should also test "print $pc" when there is an execfile but no
# remote debugging target, process or corefile.
# remote debugging target, process or corefile.
gdb_test "set print sevenbit-strings" ""
gdb_test "set print sevenbit-strings" ""
gdb_test "set print address off" "" ""
gdb_test "set print address off" "" ""
gdb_test "set width 0" ""
gdb_test "set width 0" ""
if [set_lang_java] then {
if [set_lang_java] then {
    test_integer_literals_accepted
    test_integer_literals_accepted
    test_character_literals_accepted
    test_character_literals_accepted
    test_integer_literals_rejected
    test_integer_literals_rejected
} else {
} else {
    fail "Java print command tests suppressed"
    fail "Java print command tests suppressed"
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.