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

Side by Side 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 64-bit build issue 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10
11 #include "native_client/tests/untrusted_crash_dump/untrusted_crash_dump.h"
12
13 #if defined(IN_BROWSER)
14 #include "native_client/src/shared/srpc/nacl_srpc.h"
15 #include "native_client/src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h"
16 #endif
17
18 void CallMe(void (*func)(int), int);
19
20 void layer5(int x, int y) {
21 *(volatile int *)x = y;
22 }
23
24 void layer4(int x) {
25 layer5(x, 1);
26 }
27
28 void layer3(int a, int b, int c) {
29 CallMe(layer4, a + b + c);
30 }
31
32 void layer2(int i, int j) {
33 layer3(i, j, 7);
34 }
35
36 void layer1(int s, int t) {
37 layer2(s + 5, t + 1);
38 }
39
40 int main(int argc, char *argv[]) {
41 #if defined(IN_BROWSER)
42 if (!NaClSrpcModuleInit())
43 return -1;
44 NaClPluginLowLevelInitializationComplete();
Mark Seaborn 2012/02/06 19:44:06 Please comment what this is for. Do we actually n
bradn 2012/02/06 22:27:48 Ooops, cargo cult. Dropped.
45 #endif
46
47 NaClCrashDumpInit(argv[0]);
48
49 layer1(2, 9);
50
51 NaClCrashDumpDestroy();
52
53 fprintf(stderr, "** intended_exit_status=0\n");
Mark Seaborn 2012/02/06 19:44:06 Surely you expect it to crash and not reach here?
bradn 2012/02/06 22:27:48 Whoops. Leftover, thanks. Done.
54 return 0;
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698