1 # Copyright
2012-2022 Free Software Foundation
, Inc.
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
3 of the License
, or
6 #
(at your option
) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
16 # Note that the testcase gdb.opt
/inline
-break.exp largely mirrors
17 # this testcase
, and should be updated
if this testcase is changed.
21 # This test can only be run
on targets which support DWARF
-2 and use gas.
22 if ![dwarf2_support
] {
26 # This test can only be run
on x86_64 targets.
27 if {![istarget
"x86_64-*-*"] || ![is_lp64_target]} {
31 set basename
"inline-break"
35 if { [prepare_for_testing
"failed to prepare" $testfile $srcfile {nodebug}] } {
40 # func1 is a static inlined function that is called once.
41 # The result should be a single
-location breakpoint.
43 gdb_test
"break func1" \
44 "Breakpoint.*at.* file .*$basename\\.c, line.*"
47 # func2 is a non
-static inlined function that is called once.
48 # The result should be a breakpoint with two locations
: the
49 # out
-of
-line function and the single inlined instance.
51 gdb_test
"break func2" \
52 "Breakpoint.*at.*func2.*\\(2 locations\\)"
55 # func3b is a static inlined function that is called once from
56 # within another static inlined function. The result should be
57 # a single
-location breakpoint.
59 gdb_test
"break func3b" \
60 "Breakpoint.*at.* file .*$basename\\.c, line.*"
63 # func4b is a static inlined function that is called once from
64 # within a non
-static inlined function. The result should be
65 # a breakpoint with two locations
: the inlined instance within
66 # the inlined
call to func4a in main
, and the inlined instance
67 # within the out
-of
-line func4a.
69 gdb_test
"break func4b" \
70 "Breakpoint.*at.*func4b.*\\(2 locations\\)"
73 # func5b is a non
-static inlined function that is called once
74 # from within a static inlined function. The result should be a
75 # breakpoint with two locations
: the out
-of
-line function and the
76 # inlined instance within the inlined
call to func5a in main.
78 gdb_test
"break func5b" \
79 "Breakpoint.*at.*func5b.*\\(2 locations\\)"
81 # func6b is a non
-static inlined function that is called once from
82 # within another non
-static inlined function. The result should be
83 # a breakpoint with three locations
: the out
-of
-line function
, the
84 # inlined instance within the out
-of
-line func6a
, and the inlined
85 # instance within the inlined
call to func6a in main
,
87 gdb_test
"break func6b" \
88 "Breakpoint.*at.*func6b.*\\(3 locations\\)"
91 # func7b is a static inlined function that is called twice
: once from
92 # func7a
, and once from main. The result should be a breakpoint with
93 # two locations
: the inlined instance within the inlined instance of
94 # func7a
, and the inlined instance within main.
96 gdb_test
"break func7b" \
97 "Breakpoint.*at.*func7b.*\\(2 locations\\)"
100 # func8b is a non
-static inlined function that is called twice
: once
101 # func8a
, and once from main. The result should be a breakpoint with
102 # three locations
: the out
-of
-line function
, the inlined instance
103 # within the inlined instance of func7a
, and the inlined instance
106 gdb_test
"break func8b" \
107 "Breakpoint.*at.*func8b.*\\(3 locations\\)"
110 # func1 is a static inlined function. The result should be that no
111 # symbol is found to print.
113 gdb_test
"print func1" \
114 "No symbol \"func1\" in current context."
117 # func2 is a non
-static inlined function. The result should be that
118 # one symbol is found to print
, and that the printed symbol is called
119 #
"func2". Note that this does not cover the failure case that two
120 # symbols were found
, but that gdb chose the out
-of
-line copy to
121 # print
, but
if this was failing the
"print func1" test would likely
124 gdb_test
"print func2" \
125 "\\\$.* = {int \\(int\\)} .* <func2>"