+/* Copyright 1992-2016 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
/* Simple little program that just generates a core dump from inside some
nested function calls. */
#include <fcntl.h>
#include <sys/mman.h>
#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#ifndef __STDC__
#define const /**/
mmapdata ()
{
int j, fd;
- extern void *malloc ();
/* Allocate and initialize a buffer that will be used to write
the file that is later mapped in. */
return;
}
}
+ /* Touch buf2 so kernel writes it out into 'core'. */
+ buf2[0] = buf1[0];
}
void
func2 ();
}
-main ()
+int
+main (int argc, char **argv)
{
+ if (argc == 2 && strcmp (argv[1], "sleep") == 0)
+ {
+ sleep (60);
+ return 0;
+ }
mmapdata ();
func1 ();
+ return 0;
}
-