Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/src/untrusted/crash_dump/untrusted_crash_dump.h" | |
| 12 | |
| 13 | |
| 14 void CallMe(void (*func)(int), int); | |
| 15 | |
| 16 | |
| 17 /* | |
| 18 * 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
| |
| 19 * 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.
| |
| 20 */ | |
| 21 | |
| 22 void layer5(int x, int y) { | |
| 23 *(volatile int *) x = y; | |
| 24 } | |
| 25 | |
| 26 void layer4(int x) { | |
| 27 layer5(x, 1); | |
| 28 } | |
| 29 | |
| 30 void layer3(int a, int b, int c) { | |
| 31 CallMe(layer4, a + b + c); | |
| 32 } | |
| 33 | |
| 34 void layer2(int i, int j) { | |
| 35 layer3(i, j, 7); | |
| 36 } | |
| 37 | |
| 38 void layer1(int s, int t) { | |
| 39 int *junk = (int*)alloca(sizeof(int)* 1234); | |
| 40 junk[0] = s + 5; | |
| 41 layer2(junk[0], t + 1); | |
| 42 } | |
| 43 | |
| 44 int main() { | |
| 45 NaClCrashDumpInit(); | |
| 46 | |
| 47 layer1(2, 9); | |
| 48 | |
| 49 return 1; | |
| 50 } | |
| OLD | NEW |