xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/ending-run.c (revision e5cb852c65c532c79a7d83e6e6c8663886e00327)
1 /* Test program for <next-at-end> and
2  * <leaves-core-file-on-quit> bugs.
3  */
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include "../lib/unbuffer_output.c"
8 
callee(int x)9 int callee (int x)
10 {
11     int y = x * x;		/* -break1- */
12     return (y - 2);
13 }
14 
main()15 int main()
16 {
17 
18     int *p;
19     int i;
20 
21     gdb_unbuffer_output ();
22 
23     p = (int *) malloc( 4 );
24 
25     for (i = 1; i < 10; i++)
26         {
27             printf( "%d ", callee( i ));
28             fflush (stdout);
29         }
30     printf( " Goodbye!\n" ); fflush (stdout); /* -break2- */
31     return 0;
32 }
33