GDB testsuite: drop non-prototype C function header variants
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-finish-breakpoint.c
CommitLineData
cc72b2a2
KP
1/* This testcase is part of GDB, the GNU debugger.
2
ecd75fc8 3 Copyright 2011-2014 Free Software Foundation, Inc.
cc72b2a2
KP
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
47d48711 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
cc72b2a2
KP
17
18#include <setjmp.h>
19#include <stdlib.h>
20#include <unistd.h>
21
22/* Defined in py-events-shlib.h. */
23extern void do_nothing (void);
24
25int increase_1 (int *a)
26{
27 *a += 1;
28 return -5;
29}
30
31void increase (int *a)
32{
33 increase_1 (a);
34}
35
36int
37test_1 (int i, int j)
38{
39 return i == j;
40}
41
42int
43test (int i, int j)
44{
45 return test_1 (i, j);
46}
47
48int
49call_longjmp_1 (jmp_buf *buf)
50{
51 longjmp (*buf, 1);
52}
53
54int
55call_longjmp (jmp_buf *buf)
56{
57 call_longjmp_1 (buf);
58}
59
60void
3bc96cfb 61test_exec_exit (const char *self_exec)
cc72b2a2 62{
3bc96cfb 63 if (self_exec == NULL)
cc72b2a2
KP
64 exit (0);
65 else
3bc96cfb 66 execl (self_exec, self_exec, "exit", (char *)0);
cc72b2a2
KP
67}
68
69int main (int argc, char *argv[])
70{
71 jmp_buf env;
72 int foo = 5;
73 int bar = 42;
74 int i, j;
75
3bc96cfb
JK
76 if (argc == 2 && strcmp (argv[1], "exit") == 0)
77 return 0;
78
cc72b2a2
KP
79 do_nothing ();
80
81 i = 0;
82 /* Break at increase. */
83 increase (&i);
84 increase (&i);
85 increase (&i);
86
87 for (i = 0; i < 10; i++)
88 {
89 j += 1; /* Condition Break. */
90 }
91
92 if (setjmp (env) == 0) /* longjmp caught */
93 {
94 call_longjmp (&env);
95 }
96 else
97 j += 1; /* after longjmp. */
98
3bc96cfb 99 test_exec_exit (argv[0]);
cc72b2a2
KP
100
101 return j; /* Break at end. */
102}
This page took 0.35392 seconds and 4 git commands to generate.