* gdb.base/help.exp: Replace most of docstrings for "info signals"
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / break.c
CommitLineData
ef44eed1
SS
1#ifdef vxworks
2# include <vxWorks.h>
3# include <stdioLib.h>
4
5/* VxWorks does not supply atoi. */
6static int
7atoi (z)
8 char *z;
9{
10 int i = 0;
11
12 while (*z >= '0' && *z <= '9')
13 i = i * 10 + (*z++ - '0');
14 return i;
15}
16
17/* I don't know of any way to pass an array to VxWorks. This function
18 can be called directly from gdb. */
19
20vxmain (arg)
21char *arg;
22{
23 char *argv[2];
24
25 argv[0] = "";
26 argv[1] = arg;
27 main (2, argv, (char **) 0);
28}
29
30#else /* ! vxworks */
31# include <stdio.h>
32#endif /* ! vxworks */
33
34/*
35 * The following functions do nothing useful. They are included simply
36 * as places to try setting breakpoints at. They are explicitly
37 * "one-line functions" to verify that this case works (some versions
38 * of gcc have or have had problems with this).
39 */
40
41int marker1 () { return (0); }
42int marker2 (a) int a; { return (1); }
43void marker3 (a, b) char *a, *b; {}
44void marker4 (d) long d; {}
45
46/*
47 * This simple classical example of recursion is useful for
48 * testing stack backtraces and such.
49 */
50
51int
52main (argc, argv, envp)
53int argc;
54char *argv[], **envp;
55{
56 if (argc != 2) {
57 fprintf (stderr, "usage: factorial <number>\n");
58 return 1;
59 } else {
60 printf ("%d\n", factorial (atoi (argv[1])));
61 }
62 marker1 ();
63 marker2 (43);
64 marker3 ("stack", "trace");
65 marker4 (177601976L);
66 return 0;
67}
68
69int factorial (value)
70int value;
71{
72 if (value > 1) {
73 value *= factorial (value - 1);
74 }
75 return (value);
76}
77
This page took 0.051873 seconds and 4 git commands to generate.