GNU Binutils with patches for OS216
Revision | 51550d1a9e579cc2163fc6f09744867302f12fb5 (tree) |
---|---|
Time | 2004-03-13 02:46:28 |
Author | nobody <> |
Commiter | nobody <> |
This commit was manufactured by cvs2svn to create branch 'gdb_6_1-branch'.
Cherrypick from master 2004-03-12 17:46:27 UTC David Carlton <carlton@bactrian.org> '2004-03-12 David Carlton <carlton@kealia.com>':
@@ -0,0 +1,53 @@ | ||
1 | +class A { | |
2 | +public: | |
3 | + class B; | |
4 | + class C; | |
5 | +}; | |
6 | + | |
7 | +class A::B { | |
8 | + int a_b; | |
9 | + | |
10 | +public: | |
11 | + C* get_c(int i); | |
12 | +}; | |
13 | + | |
14 | +class A::C | |
15 | +{ | |
16 | + int a_c; | |
17 | +}; | |
18 | + | |
19 | +class E { | |
20 | +public: | |
21 | + class F; | |
22 | +}; | |
23 | + | |
24 | +class E::F { | |
25 | +public: | |
26 | + int e_f; | |
27 | + | |
28 | + F& operator=(const F &other); | |
29 | +}; | |
30 | + | |
31 | +void refer_to (E::F *f) { | |
32 | + // Do nothing. | |
33 | +} | |
34 | + | |
35 | +void refer_to (A::C **ref) { | |
36 | + // Do nothing. But, while we're at it, force out debug info for | |
37 | + // A::B and E::F. | |
38 | + | |
39 | + A::B b; | |
40 | + E::F f; | |
41 | + | |
42 | + refer_to (&f); | |
43 | +} | |
44 | + | |
45 | +int main () { | |
46 | + A::C* c_var; | |
47 | + A::B* b_var; | |
48 | + E *e_var; | |
49 | + | |
50 | + // Keep around a reference so that GCC 3.4 doesn't optimize the variable | |
51 | + // away. | |
52 | + refer_to (&c_var); | |
53 | +} |
@@ -0,0 +1,62 @@ | ||
1 | +# Copyright 2004 Free Software Foundation, Inc. | |
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 | |
5 | +# the Free Software Foundation; either version 2 of the License, or | |
6 | +# (at your option) any later version. | |
7 | +# | |
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. | |
12 | +# | |
13 | +# You should have received a copy of the GNU General Public License | |
14 | +# along with this program; if not, write to the Free Software | |
15 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | + | |
17 | +# Test for PR gdb/1553. | |
18 | + | |
19 | +# This file is part of the gdb testsuite. | |
20 | + | |
21 | +set ws "\[\r\n\t \]+" | |
22 | + | |
23 | +if $tracelevel then { | |
24 | + strace $tracelevel | |
25 | +} | |
26 | + | |
27 | +if { [skip_cplus_tests] } { continue } | |
28 | + | |
29 | +# | |
30 | +# test running programs | |
31 | +# | |
32 | +set prms_id 0 | |
33 | +set bug_id 0 | |
34 | + | |
35 | +set testfile "pr-1553" | |
36 | +set srcfile ${testfile}.cc | |
37 | +set binfile ${objdir}/${subdir}/${testfile} | |
38 | + | |
39 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
40 | + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
41 | +} | |
42 | + | |
43 | +if [get_compiler_info ${binfile} "c++"] { | |
44 | + return -1 | |
45 | +} | |
46 | + | |
47 | +gdb_exit | |
48 | +gdb_start | |
49 | +gdb_reinitialize_dir $srcdir/$subdir | |
50 | +gdb_load ${binfile} | |
51 | + | |
52 | +if ![runto_main] then { | |
53 | + perror "couldn't run to breakpoint" | |
54 | + continue | |
55 | +} | |
56 | + | |
57 | +gdb_test "ptype c_var" "type = class A::C \{${ws}private:${ws}int a_c;${ws}\} \\*" | |
58 | + | |
59 | +gdb_test "ptype E::F" "type = class E::F \{${ws}public:${ws}int e_f;${ws}E::F & operator=\\(E::F const ?&\\);${ws}\}" | |
60 | + | |
61 | +gdb_exit | |
62 | +return 0 |