1 # Copyright 2012 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"
32 set testfile "dw2-$basename"
34 if { [prepare_for_testing $testfile.exp $testfile $testfile.S {nodebug}] } {
39 # func1 is a static inlined function that is called once.
40 # The result should be a single-location breakpoint.
42 gdb_test "break func1" \
43 "Breakpoint.*at.* file .*$basename\\.c, line.*"
46 # func2 is a non-static inlined function that is called once.
47 # The result should be a breakpoint with two locations: the
48 # out-of-line function and the single inlined instance.
50 gdb_test "break func2" \
51 "Breakpoint.*at.*func2.*\\(2 locations\\)"
54 # func3b is a static inlined function that is called once from
55 # within another static inlined function. The result should be
56 # a single-location breakpoint.
58 gdb_test "break func3b" \
59 "Breakpoint.*at.* file .*$basename\\.c, line.*"
62 # func4b is a static inlined function that is called once from
63 # within a non-static inlined function. The result should be
64 # a breakpoint with two locations: the inlined instance within
65 # the inlined call to func4a in main, and the inlined instance
66 # within the out-of-line func4a.
68 gdb_test "break func4b" \
69 "Breakpoint.*at.*func4b.*\\(2 locations\\)"
72 # func5b is a non-static inlined function that is called once
73 # from within a static inlined function. The result should be a
74 # breakpoint with two locations: the out-of-line function and the
75 # inlined instance within the inlined call to func5a in main.
77 gdb_test "break func5b" \
78 "Breakpoint.*at.*func5b.*\\(2 locations\\)"
80 # func6b is a non-static inlined function that is called once from
81 # within another non-static inlined function. The result should be
82 # a breakpoint with three locations: the out-of-line function, the
83 # inlined instance within the out-of-line func6a, and the inlined
84 # instance within the inlined call to func6a in main,
86 gdb_test "break func6b" \
87 "Breakpoint.*at.*func6b.*\\(3 locations\\)"
90 # func7b is a static inlined function that is called twice: once from
91 # func7a, and once from main. The result should be a breakpoint with
92 # two locations: the inlined instance within the inlined instance of
93 # func7a, and the inlined instance within main.
95 gdb_test "break func7b" \
96 "Breakpoint.*at.*func7b.*\\(2 locations\\)"
99 # func8b is a non-static inlined function that is called twice: once
100 # func8a, and once from main. The result should be a breakpoint with
101 # three locations: the out-of-line function, the inlined instance
102 # within the inlined instance of func7a, and the inlined instance
105 gdb_test "break func8b" \
106 "Breakpoint.*at.*func8b.*\\(3 locations\\)"
109 # func1 is a static inlined function. The result should be that no
110 # symbol is found to print.
112 gdb_test "print func1" \
113 "No symbol \"func1\" in current context."
116 # func2 is a non-static inlined function. The result should be that
117 # one symbol is found to print, and that the printed symbol is called
118 # "func2". Note that this does not cover the failure case that two
119 # symbols were found, but that gdb chose the out-of-line copy to
120 # print, but if this was failing the "print func1" test would likely
123 gdb_test "print func2" \
124 "\\\$.* = {int \\(int\\)} .* <func2>"