[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.base / run.c
blob614b018260d7a213f016ec72acded19c0343bac1
1 /*
2 * This simple classical example of recursion is useful for
3 * testing stack backtraces and such.
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
9 #include "../lib/unbuffer_output.c"
11 int factorial (int);
13 int
14 main (int argc, char **argv, char **envp)
16 gdb_unbuffer_output ();
18 #ifdef FAKEARGV
19 printf ("%d\n", factorial (1)); /* commands.exp: hw local_var out of scope */
20 #else
21 if (argc != 2) {
22 printf ("usage: factorial <number>\n");
23 return 1;
24 } else {
25 printf ("%d\n", factorial (atoi (argv[1])));
27 #endif
28 return 0;
31 int factorial (int value)
33 int local_var;
35 if (value > 1) {
36 value *= factorial (value - 1);
38 local_var = value;
39 return (value);
40 } /* commands.exp: local_var out of scope */