Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: tests/untrusted_crash_dump/untrusted_crash_dump_test.c

Issue 9316125: Adding untrusted crash dump / stack trace tests. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fixing - thing. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..da61b98789d397a7c00dc7819aed42dfde9b7355
--- /dev/null
+++ b/tests/untrusted_crash_dump/untrusted_crash_dump_test.c
@@ -0,0 +1,50 @@
+/*
+ * 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"
+
+
+void CallMe(void (*func)(int), int);
+
+
+/*
+ * Calling thru several layers of functions, varying arguments to yield
Mark Seaborn 2012/02/17 01:13:40 'through'
bradn 2012/02/17 01:28:02 Done. Though Noah Webster is rolling in his grave
+ * differently size stack frames.
Mark Seaborn 2012/02/17 01:13:40 'differently sized' or 'different size'
bradn 2012/02/17 01:28:02 Done.
+ */
+
+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) {
+ 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;
+}
« no previous file with comments | « tests/untrusted_crash_dump/untrusted_crash_dump_lib.c ('k') | tests/untrusted_crash_dump/untrusted_crash_dump_test.nmf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698