gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / coremaker.c
index 2cfa15aee454c041e3cdcdb42a118206b69d4f0a..3cc97e1e8e5931dfdfd49cf718a780b4693dfafd 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2007, 2008
-   Free Software Foundation, Inc.
+/* Copyright 1992-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -26,6 +25,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 #ifndef __STDC__
 #define        const   /**/
@@ -77,7 +77,7 @@ mmapdata ()
   /* Now map the file into our address space as buf2 */
 
   buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
-  if (buf2 == (char *) -1)
+  if (buf2 == (char *) MAP_FAILED)
     {
       perror ("mmap failed");
       return;
@@ -96,6 +96,8 @@ mmapdata ()
          return;
        }
     }
+  /* Touch buf2 so kernel writes it out into 'core'. */
+  buf2[0] = buf1[0];
 }
 
 void
@@ -131,10 +133,15 @@ func1 ()
   func2 ();
 }
 
-int 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.024118 seconds and 4 git commands to generate.