1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 1992-2014 Free Software Foundation, Inc.
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.
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.
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/>. */
22 /* VxWorks does not supply atoi. */
29 while (*z
>= '0' && *z
<= '9')
30 i
= i
* 10 + (*z
++ - '0');
34 /* I don't know of any way to pass an array to VxWorks. This function
35 can be called directly from gdb. */
44 main (2, argv
, (char **) 0);
50 #endif /* ! vxworks */
53 extern int marker1 (void);
54 extern int marker2 (int a
);
55 extern void marker3 (char *a
, char *b
);
56 extern void marker4 (long d
);
58 extern int marker1 ();
59 extern int marker2 ();
60 extern void marker3 ();
61 extern void marker4 ();
64 /* We're used by a test that requires malloc, so make sure it is in
72 * This simple classical example of recursion is useful for
73 * testing stack backtraces and such.
80 main (int argc
, char **argv
, char **envp
)
83 main (argc
, argv
, envp
)
88 if (argc
== 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
89 fprintf (stderr
, "usage: factorial <number>\n");
92 printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */
93 /* set breakpoint 12 here */
94 marker1 (); /* set breakpoint 11 here */
95 marker2 (43); /* set breakpoint 20 here */
96 marker3 ("stack", "trace"); /* set breakpoint 21 here */
98 /* We're used by a test that requires malloc, so make sure it is
102 argc
= (argc
== 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
103 return argc
; /* set breakpoint 10 here */
104 } /* set breakpoint 10a here */
107 int factorial (int value
)
109 int factorial (value
)
113 if (value
> 1) { /* set breakpoint 7 here */
114 value
*= factorial (value
- 1);
116 return (value
); /* set breakpoint 19 here */
120 int multi_line_if_conditional (int a
, int b
, int c
)
122 int multi_line_if_conditional (a
, b
, c
)
126 if (a
/* set breakpoint 3 here */
135 int multi_line_while_conditional (int a
, int b
, int c
)
137 int multi_line_while_conditional (a
, b
, c
)
141 while (a
/* set breakpoint 4 here */
This page took 0.088125 seconds and 4 git commands to generate.