]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2003-2024 Free Software Foundation, Inc. |
cdbf20f7 MC |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
cdbf20f7 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
cdbf20f7 MC |
8 | # This program is distributed in the hope that it will be useful, |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
e22f8b7c | 12 | # |
cdbf20f7 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
cdbf20f7 MC |
15 | |
16 | # Tests for PR gdb/1355, which is a reference to PR gcc/12066. | |
17 | # 2003-08-26 Michael Chastain <mec@shout.net> | |
18 | ||
19 | # This file is part of the gdb testsuite. | |
20 | ||
21 | set ws "\[\r\n\t \]*" | |
22 | set nl "\[\r\n\]+" | |
23 | ||
0b94d2b9 | 24 | require allow_cplus_tests |
cdbf20f7 MC |
25 | |
26 | # | |
27 | # test running programs | |
28 | # | |
cdbf20f7 | 29 | |
f5f3a911 | 30 | standard_testfile .cc |
cdbf20f7 | 31 | |
5b362f04 | 32 | if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { |
f5f3a911 TT |
33 | return -1 |
34 | } | |
cdbf20f7 | 35 | |
95701cae | 36 | if {![runto_main]} { |
cdd42066 | 37 | return |
cdbf20f7 MC |
38 | } |
39 | ||
40 | # See http://sources.redhat.com/gdb/bugs/1355 | |
41 | # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12066 | |
42 | # | |
43 | # g++ -gstabs+ does not emit stabs for fundamental types. | |
44 | # They get emitted later inside other types, so they have no names | |
45 | # and gdb cannot handle them. | |
46 | ||
47 | set s_head "${ws}(struct|class) mystruct \{(${ws}public:|)" | |
48 | set s_tail ".*" | |
49 | ||
50 | set f_i "${ws}int m_int;" | |
51 | set f_c "${ws}char m_char;" | |
71c25dea | 52 | set f_li "${ws}long( int)? m_long_int;" |
cdbf20f7 | 53 | set f_ui "${ws}unsigned int m_unsigned_int;" |
71c25dea TT |
54 | set f_lui "${ws}(long unsigned int|unsigned long) m_long_unsigned_int;" |
55 | set f_si "${ws}short( int)? m_short_int;" | |
56 | set f_sui "${ws}(short unsigned int|unsigned short) m_short_unsigned_int;" | |
cdbf20f7 MC |
57 | set f_uc "${ws}unsigned char m_unsigned_char;" |
58 | set f_f "${ws}float m_float;" | |
59 | set f_d "${ws}double m_double;" | |
60 | set f_ld "${ws}long double m_long_double;" | |
61 | set f_b "${ws}bool m_bool;" | |
62 | ||
63 | set itc "<invalid type code ${decimal}>" | |
4ec70201 | 64 | set bad_i "${ws}(${itc}|int) m_int;" |
cdbf20f7 MC |
65 | set bad_c "${ws}(${itc}|char) m_char;" |
66 | set bad_li "${ws}(${itc}|long int) m_long_int;" | |
67 | set bad_ui "${ws}(${itc}|unsigned int) m_unsigned_int;" | |
68 | set bad_lui "${ws}(${itc}|long unsigned int) m_long_unsigned_int;" | |
69 | set bad_si "${ws}(${itc}|short int) m_short_int;" | |
70 | set bad_sui "${ws}(${itc}|short unsigned int) m_short_unsigned_int;" | |
71 | set bad_uc "${ws}(${itc}|unsigned char) m_unsigned_char;" | |
72 | set bad_f "${ws}(${itc}|float) m_float;" | |
73 | set bad_d "${ws}(${itc}|double) m_double;" | |
74 | set bad_ld "${ws}(${itc}|long double) m_long_double;" | |
75 | set bad_b "${ws}(${itc}|bool) m_bool;" | |
76 | ||
77 | gdb_test_multiple "ptype s1" "ptype s1" { | |
78 | -re "type = ${s_head}${f_i}${f_c}${f_li}${f_ui}${f_lui}${f_si}${f_sui}${f_uc}${f_f}${f_d}${f_ld}${f_b}${s_tail}\}$nl$gdb_prompt $" { | |
79 | pass "ptype s1" | |
80 | } | |
81 | -re "type = ${s_head}${bad_i}${bad_c}${bad_li}${bad_ui}${bad_lui}${bad_si}${bad_sui}${bad_uc}${bad_f}${bad_d}${bad_ld}${bad_b}${s_tail}\}$nl$gdb_prompt $" { | |
82 | # This happened with gcc HEAD 2003-08-20 08:00:00 UTC, -gstabs+. | |
83 | kfail "gdb/1355" "ptype s1" | |
84 | } | |
85 | } | |
86 | ||
87 | gdb_test_multiple "print s1" "print s1" { | |
88 | -re "$decimal = \{m_int = 117, m_char = 97 'a', m_long_int = 118, m_unsigned_int = 119, m_long_unsigned_int = 120, m_short_int = 123, m_short_unsigned_int = 124, m_unsigned_char = 98 'b', m_float = 125, m_double = 126, m_long_double = 127, m_bool = true\}$nl$gdb_prompt $" { | |
89 | pass "print s1" | |
90 | } | |
91 | -re "$decimal = \{m_int = 117, m_char = 97 'a', m_long_int = 118, m_unsigned_int = 119, m_long_unsigned_int = 120, m_short_int = 123, m_short_unsigned_int = 124, m_unsigned_char = 98 'b', m_float = 125, m_double = 126, m_long_double = 127, m_bool = 117\}$nl$gdb_prompt $" { | |
92 | # This pattern is very picky, but if more different output | |
93 | # shows up, I can just add more arms. -- chastain 2003-08-26 | |
94 | # | |
95 | # This happened with gcc HEAD 2003-08-20 08:00:00 UTC, -gstabs+. | |
96 | # Look at the value of m_bool. It looks like gdb latched onto | |
97 | # random int type and then used the data at structure offset 0. | |
98 | kfail "gdb/1355" "print s1" | |
99 | } | |
100 | } |