gdb:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.opt / inline-break.exp
CommitLineData
481860b3
GB
1# Copyright 2012 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 3 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, see <http://www.gnu.org/licenses/>.
15
16# Note that the testcase gdb.dwarf2/dw2-inline-break.exp largely
17# mirrors this testcase, and should be updated if this testcase is
18# changed.
19
20set basename "inline-break"
21set testfile $basename
22
23if { [prepare_for_testing $testfile.exp $testfile $testfile.c \
24 {debug optimize=-O2 additional_flags=-Winline}] } {
25 return -1
26}
27
28#
29# func1 is a static inlined function that is called once.
30# The result should be a single-location breakpoint.
31#
32gdb_test "break func1" \
33 "Breakpoint.*at.* file .*$basename\\.c, line.*"
34
35#
36# func2 is a non-static inlined function that is called once.
37# The result should be a breakpoint with two locations: the
38# out-of-line function and the single inlined instance.
39#
40gdb_test "break func2" \
41 "Breakpoint.*at.*func2.*\\(2 locations\\)"
42
43#
44# func3b is a static inlined function that is called once from
45# within another static inlined function. The result should be
46# a single-location breakpoint.
47#
48gdb_test "break func3b" \
49 "Breakpoint.*at.* file .*$basename\\.c, line.*"
50
51#
52# func4b is a static inlined function that is called once from
53# within a non-static inlined function. The result should be
54# a breakpoint with two locations: the inlined instance within
55# the inlined call to func4a in main, and the inlined instance
56# within the out-of-line func4a.
57#
58gdb_test "break func4b" \
59 "Breakpoint.*at.*func4b.*\\(2 locations\\)"
60
61#
62# func5b is a non-static inlined function that is called once
63# from within a static inlined function. The result should be a
64# breakpoint with two locations: the out-of-line function and the
65# inlined instance within the inlined call to func5a in main.
66#
67gdb_test "break func5b" \
68 "Breakpoint.*at.*func5b.*\\(2 locations\\)"
69#
70# func6b is a non-static inlined function that is called once from
71# within another non-static inlined function. The result should be
72# a breakpoint with three locations: the out-of-line function, the
73# inlined instance within the out-of-line func6a, and the inlined
74# instance within the inlined call to func6a in main,
75#
76gdb_test "break func6b" \
77 "Breakpoint.*at.*func6b.*\\(3 locations\\)"
78
79#
80# func7b is a static inlined function that is called twice: once from
81# func7a, and once from main. The result should be a breakpoint with
82# two locations: the inlined instance within the inlined instance of
83# func7a, and the inlined instance within main.
84#
85gdb_test "break func7b" \
86 "Breakpoint.*at.*func7b.*\\(2 locations\\)"
87
88#
89# func8b is a non-static inlined function that is called twice: once
90# func8a, and once from main. The result should be a breakpoint with
91# three locations: the out-of-line function, the inlined instance
92# within the inlined instance of func7a, and the inlined instance
93# within main.
94#
95gdb_test "break func8b" \
96 "Breakpoint.*at.*func8b.*\\(3 locations\\)"
97
98#
99# func1 is a static inlined function. The result should be that no
100# symbol is found to print.
101#
102gdb_test "print func1" \
103 "No symbol \"func1\" in current context."
104
105#
106# func2 is a non-static inlined function. The result should be that
107# one symbol is found to print, and that the printed symbol is called
108# "func2". Note that this does not cover the failure case that two
109# symbols were found, but that gdb chose the out-of-line copy to
110# print, but if this was failing the "print func1" test would likely
111# fail instead.
112#
113gdb_test "print func2" \
114 "\\\$.* = {int \\(int\\)} .* <func2>"
This page took 0.029006 seconds and 4 git commands to generate.