GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / coremaker.c
index 56239e9286f4ddeed1d9b88e9f5da080b95782ba..7ac63351140176ebf18931823fa6dd271fb252b9 100644 (file)
@@ -1,3 +1,20 @@
+/* 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. */
 
@@ -6,6 +23,9 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 #include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 
 #ifndef __STDC__
 #define        const   /**/
@@ -33,7 +53,6 @@ void
 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. */
@@ -77,6 +96,8 @@ mmapdata ()
          return;
        }
     }
+  /* Touch buf2 so kernel writes it out into 'core'. */
+  buf2[0] = buf1[0];
 }
 
 void
@@ -112,9 +133,15 @@ func1 ()
   func2 ();
 }
 
-main ()
+int
+main (int argc, char **argv)
 {
+  if (argc == 2 && strcmp (argv[1], "sleep") == 0)
+    {
+      sleep (60);
+      return 0;
+    }
   mmapdata ();
   func1 ();
+  return 0;
 }
-
This page took 0.026041 seconds and 4 git commands to generate.