]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/break-include.c
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / break-include.c
CommitLineData
a9e40818
JB
1/* This testcase is part of GDB, the GNU debugger.
2
213516ef 3 Copyright 2016-2023 Free Software Foundation, Inc.
a9e40818
JB
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
18int next (int i);
19
20int
21main (void)
22{
23 int result = -1;
24
25 result = next (result);
26 return result;
27}
28
29/* The following function's implementation starts by including a file
30 (break-include.inc) which contains a copyright header followed by
31 a single C statement. When we place a breakpoint on the line where
32 the function name is declared, we expect GDB to skip the function's
33 prologue, and insert the breakpoint on the first line of "user" code
34 for that function, which we have set up to be that single statement
35 break-include.inc provides.
36
37 The purpose of this testcase is to verify that, when we insert
38 that breakpoint, GDB reports the location as being in that include
39 file, but also using the correct line number inside that include
40 file -- NOT the line number we originally used to insert the
41 breakpoint, nor the location where the file is included from.
42 In order to verify that GDB shows the right line number, we must
43 be careful that this first statement located in break-include.inc
44 and our function are not on the same line number. Otherwise,
45 we could potentially have a false PASS.
46
47 This is why we implement the following function as far away
48 from the start of this file as possible, as we know that
49 break-include.inc is a fairly short file (copyright header
50 and single statement only). */
51
52int
53next (int i) /* break here */
54{
55#include "break-include.inc"
56 return i;
57}