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