1 /* Copyright 1994, 1995, 1999, 2002, 2003, 2004, 2007
2 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 Please email any bugs, comments, and/or additions to this file to:
19 bug-gdb@prep.ai.mit.edu */
25 /* VxWorks does not supply atoi. */
32 while (*z
>= '0' && *z
<= '9')
33 i
= i
* 10 + (*z
++ - '0');
37 /* I don't know of any way to pass an array to VxWorks. This function
38 can be called directly from gdb. */
47 main (2, argv
, (char **) 0);
53 #endif /* ! vxworks */
56 * The following functions do nothing useful. They are included simply
57 * as places to try setting breakpoints at. They are explicitly
58 * "one-line functions" to verify that this case works (some versions
59 * of gcc have or have had problems with this).
63 int marker1 (void) { return (0); }
64 int marker2 (int a
) { return (1); } /* set breakpoint 8 here */
65 void marker3 (char *a
, char *b
) {}
66 void marker4 (long d
) {} /* set breakpoint 14 here */
68 int marker1 () { return (0); }
69 int marker2 (a
) int a
; { return (1); } /* set breakpoint 9 here */
70 void marker3 (a
, b
) char *a
, *b
; {}
71 void marker4 (d
) long d
; {} /* set breakpoint 13 here */
75 * This simple classical example of recursion is useful for
76 * testing stack backtraces and such.
83 main (int argc
, char **argv
, char **envp
)
86 main (argc
, argv
, envp
)
92 set_debug_traps(); /* set breakpoint 5 here */
95 if (argc
== 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
96 fprintf (stderr
, "usage: factorial <number>\n");
99 printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */
100 /* set breakpoint 12 here */
101 marker1 (); /* set breakpoint 11 here */
103 marker3 ("stack", "trace");
104 marker4 (177601976L);
105 argc
= (argc
== 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
106 return argc
; /* set breakpoint 10 here */
110 int factorial (int value
)
112 int factorial (value
)
116 if (value
> 1) { /* set breakpoint 7 here */
117 value
*= factorial (value
- 1);
123 int multi_line_if_conditional (int a
, int b
, int c
)
125 int multi_line_if_conditional (a
, b
, c
)
129 if (a
/* set breakpoint 3 here */
138 int multi_line_while_conditional (int a
, int b
, int c
)
140 int multi_line_while_conditional (a
, b
, c
)
144 while (a
/* set breakpoint 4 here */
This page took 0.032103 seconds and 4 git commands to generate.