aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/auxv.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2004-03-16 21:47:03 +0000
committerRoland McGrath <roland@gnu.org>2004-03-16 21:47:03 +0000
commitd65308ae79413c95905bf24c08bb8353d23f475f (patch)
treef5e9dc2ee78fd92e431974c0fb6fcf12622c2afd /gdb/testsuite/gdb.base/auxv.c
parent73912b9b231e5040ff1d3ec3dc6bfc791b575cf3 (diff)
downloadgdb-d65308ae79413c95905bf24c08bb8353d23f475f.zip
gdb-d65308ae79413c95905bf24c08bb8353d23f475f.tar.gz
gdb-d65308ae79413c95905bf24c08bb8353d23f475f.tar.bz2
2004-03-16 Roland McGrath <roland@redhat.com>
* gdb.base/auxv.exp: New file. * gdb.base/auxv.c: New file, copied verbatim from coremaker2.c.
Diffstat (limited to 'gdb/testsuite/gdb.base/auxv.c')
-rw-r--r--gdb/testsuite/gdb.base/auxv.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/auxv.c b/gdb/testsuite/gdb.base/auxv.c
new file mode 100644
index 0000000..94f9d00
--- /dev/null
+++ b/gdb/testsuite/gdb.base/auxv.c
@@ -0,0 +1,58 @@
+/* Simple little program that just generates a core dump from inside some
+ nested function calls. Keep this as self contained as possible, I.E.
+ use no environment resources other than possibly abort(). */
+
+#ifndef __STDC__
+#define const /**/
+#endif
+
+#ifndef HAVE_ABORT
+#define HAVE_ABORT 1
+#endif
+
+#if HAVE_ABORT
+#define ABORT abort()
+#else
+#define ABORT {char *invalid = 0; *invalid = 0xFF;}
+#endif
+
+/* Don't make these automatic vars or we will have to walk back up the
+ stack to access them. */
+
+char *buf1;
+char *buf2;
+
+int coremaker_data = 1; /* In Data section */
+int coremaker_bss; /* In BSS section */
+
+const int coremaker_ro = 201; /* In Read-Only Data section */
+
+void
+func2 (int x)
+{
+ int coremaker_local[5];
+ int i;
+ static int y;
+
+ /* Make sure that coremaker_local doesn't get optimized away. */
+ for (i = 0; i < 5; i++)
+ coremaker_local[i] = i;
+ coremaker_bss = 0;
+ for (i = 0; i < 5; i++)
+ coremaker_bss += coremaker_local[i];
+ coremaker_data = coremaker_ro + 1;
+ y = 10 * x;
+ ABORT;
+}
+
+void
+func1 (int x)
+{
+ func2 (x * 2);
+}
+
+int main ()
+{
+ func1 (10);
+ return 0;
+}