Index: tests/untrusted_crash_dump/untrusted_crash_dump_test.c |
diff --git a/tests/untrusted_crash_dump/untrusted_crash_dump_test.c b/tests/untrusted_crash_dump/untrusted_crash_dump_test.c |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6378228c08c74853efec7f365d7ba78ce96518a |
--- /dev/null |
+++ b/tests/untrusted_crash_dump/untrusted_crash_dump_test.c |
@@ -0,0 +1,48 @@ |
+/* |
+ * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include <assert.h> |
+#include <stdio.h> |
+#include <stdlib.h> |
+ |
+#include "native_client/src/untrusted/crash_dump/untrusted_crash_dump.h" |
+ |
+#if defined(IN_BROWSER) |
+#include "native_client/src/shared/srpc/nacl_srpc.h" |
Mark Seaborn
2012/02/16 18:42:50
srpc #includes are not needed.
bradn
2012/02/16 20:13:10
Done.
|
+#include "native_client/src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h" |
+#endif |
+ |
+void CallMe(void (*func)(int), int); |
+ |
+void layer5(int x, int y) { |
+ *(volatile int *) x = y; |
+} |
+ |
+void layer4(int x) { |
+ layer5(x, 1); |
+} |
+ |
+void layer3(int a, int b, int c) { |
Mark Seaborn
2012/02/16 18:42:50
Are all of these dummy arguments adding anything?
bradn
2012/02/16 20:13:10
Done.
|
+ CallMe(layer4, a + b + c); |
+} |
+ |
+void layer2(int i, int j) { |
+ layer3(i, j, 7); |
+} |
+ |
+void layer1(int s, int t) { |
+ int *junk = (int*)alloca(sizeof(int)* 1234); |
+ junk[0] = s + 5; |
+ layer2(junk[0], t + 1); |
+} |
+ |
+int main() { |
+ NaClCrashDumpInit(); |
+ |
+ layer1(2, 9); |
+ |
+ return 1; |
+} |