Commit | Line | Data |
---|---|---|
a766d390 DE |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | ||
b811d2c2 | 3 | # Copyright 2012-2020 Free Software Foundation, Inc. |
a766d390 DE |
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 | # Test various aspects of methods. | |
19 | ||
20 | load_lib "go.exp" | |
21 | ||
22 | if { [skip_go_tests] } { continue } | |
d7445728 | 23 | if { [support_go_compile] == 0 } { continue } |
a766d390 | 24 | |
8a3e1f8d | 25 | standard_testfile .go |
a766d390 | 26 | |
5b362f04 | 27 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug go}] } { |
a766d390 DE |
28 | return -1 |
29 | } | |
30 | ||
31 | set bp_location1 {main.T.Foo} | |
70d49700 | 32 | set bp_location2 {main.T.Bar} |
a766d390 DE |
33 | |
34 | if { [go_runto_main] < 0 } { | |
5b362f04 | 35 | untested "could not run to main" |
a766d390 DE |
36 | return -1 |
37 | } | |
38 | ||
75525152 TV |
39 | set found_wrong_foo 0 |
40 | set found_wrong_bar 0 | |
41 | gdb_test_multiple "maintenance print symbols" "" { | |
42 | -re "^\r\n void main.Foo.N6_main.T\[^\r\n\]*(?=\r\n)" { | |
43 | set found_wrong_foo 1 | |
44 | exp_continue | |
45 | } | |
46 | -re "^\r\n void main.Bar.pN6_main.T\[^\r\n\]*(?=\r\n)" { | |
47 | set found_wrong_bar 1 | |
48 | exp_continue | |
49 | } | |
50 | -re "^\r\n void main.T.Bar\[^\r\n\]*(?=\r\n)" { | |
75525152 TV |
51 | exp_continue |
52 | } | |
53 | -re "\r\n$gdb_prompt $" { | |
54 | pass $gdb_test_name | |
55 | } | |
56 | -re "\r\n\[^\r\n\]*(?=\r\n)" { | |
57 | exp_continue | |
58 | } | |
a766d390 | 59 | } |
a766d390 | 60 | |
75525152 TV |
61 | if { $found_wrong_foo } { |
62 | # We have with gccgo-6/7: | |
63 | # <1><553>: Abbrev Number: 21 (DW_TAG_subprogram) | |
64 | # <554> DW_AT_name : main.Foo.N6_main.T | |
65 | setup_xfail "*-*-*" | |
66 | } else { | |
67 | # We have with gccgo-8/9/10: | |
68 | # <1><1e24>: Abbrev Number: 40 (DW_TAG_subprogram) | |
69 | # <1e25> DW_AT_name : main.Foo.main.T | |
70 | # <1e2c> DW_AT_linkage_name: main.T.Foo | |
71 | ||
72 | # For reference: with go1.11.13: | |
73 | # <1><6c46b>: Abbrev Number: 2 (DW_TAG_subprogram) | |
74 | # <6c46c> DW_AT_name : main.T.Foo | |
75 | } | |
76 | ||
77 | if { [gdb_breakpoint ${bp_location1} message]} { | |
78 | gdb_test "cont" "Breakpoint .*, ${bp_location1}.*" \ | |
79 | "going to first breakpoint" | |
80 | } | |
81 | ||
82 | if { $found_wrong_bar == 1 } { | |
83 | # We have with gccgo-6/7: | |
84 | # <1><528>: Abbrev Number: 19 (DW_TAG_subprogram) | |
85 | # <529> DW_AT_name : main.Bar.pN6_main.T | |
86 | setup_xfail "*-*-*" | |
70d49700 | 87 | } else { |
75525152 TV |
88 | # We have with gccgo-8/9/10: |
89 | # <1><6e4>: Abbrev Number: 24 (DW_TAG_subprogram) | |
90 | # <6e5> DW_AT_name : main.Bar..1main.T | |
91 | # <6ec> DW_AT_linkage_name: main.T.Bar | |
70d49700 | 92 | |
75525152 TV |
93 | # For reference: with go1.11.13: |
94 | # <1><6c49a>: Abbrev Number: 2 (DW_TAG_subprogram) | |
95 | # <6c49b> DW_AT_name : main.(*T).Bar | |
70d49700 TV |
96 | |
97 | # It has been clarified in PR gcc/93866 that it's ok that symbols names | |
98 | # diverge between gc and gccgo. So, we accept the main.T.Bar as valid. | |
99 | } | |
75525152 TV |
100 | |
101 | if { [gdb_breakpoint ${bp_location2} message] } { | |
70d49700 | 102 | gdb_test "cont" "Breakpoint .*, ${bp_location2}.*" \ |
75525152 | 103 | "going to second breakpoint" |
a766d390 | 104 | } |