-/* 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.
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#ifndef __STDC__
#define const /**/
/* 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;
return;
}
}
+ /* Touch buf2 so kernel writes it out into 'core'. */
+ buf2[0] = buf1[0];
}
void
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;
}
-