26f3a8e4eceb560ec50a517bd788dc963adb6cd1
[platform/upstream/gdb.git] / gdb / testsuite / gdb.base / enumval.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2012-2014 Free Software Foundation, Inc.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 standard_testfile
19
20 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
21     untested $testfile.exp
22     return -1
23 }
24
25 # Check the real contents.
26
27 set test "print e"
28 gdb_test_multiple $test $test {
29     -re " = J\r\n$gdb_prompt $" {
30         pass $test
31     }
32     -re " = 4294967295\r\n$gdb_prompt $" {
33         if {[test_compiler_info {gcc-[0-3]-*}]
34             || [test_compiler_info {gcc-4-[0-6]-*}]} {
35             xfail $test
36         } else {
37             fail $test
38         }
39     }
40 }
41
42 set test "print f"
43 gdb_test_multiple $test $test {
44     -re " = K\r\n$gdb_prompt $" {
45         pass $test
46     }
47     -re " = -1152921504606846976\r\n$gdb_prompt $" {
48         if {[test_compiler_info {gcc-[0-3]-*}]
49             || [test_compiler_info {gcc-4-[0-6]-*}]} {
50             xfail $test
51         } else {
52             fail $test
53         }
54     }
55 }
56
57 gdb_test "print J" "= J"
58
59 set test "print K"
60 gdb_test_multiple $test $test {
61     -re " = K\r\n$gdb_prompt $" {
62         pass $test
63     }
64     -re " = <optimized out>\r\n$gdb_prompt $" {
65         if {[test_compiler_info {gcc-[0-3]-*}]
66             || [test_compiler_info {gcc-4-[0-6]-*}]} {
67             xfail $test
68         } else {
69             fail $test
70         }
71     }
72 }
73
74 # gold/15021
75 # With -fdebug-types-section, Gold's .gdb_index entry for ZERO refers to the
76 # CU, but the CU doesn't use the TU (type unit) that defines ZERO.
77 # Thus gdb has to read in every TU for the CU.
78 gdb_test "p ZERO" "ZERO"