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

Side by Side Diff: tests/exception_test/exception_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: taking out of irt tests 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
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 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 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <setjmp.h> 9 #include <setjmp.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 /* 295 /*
296 * TODO(mseaborn): %ebp is preserved when entering the exception 296 * TODO(mseaborn): %ebp is preserved when entering the exception
297 * handler because its value is needed for doing stack backtraces, but 297 * handler because its value is needed for doing stack backtraces, but
298 * it would be better to save its value in the exception frame. 298 * it would be better to save its value in the exception frame.
299 */ 299 */
300 300
301 uint32_t saved_ebp; 301 uint32_t saved_ebp;
302 302
303 void ebp_exception_handler_wrapper(int prog_ctr, int stack_ptr); 303 void ebp_exception_handler_wrapper(int prog_ctr, int stack_ptr);
304 asm(".pushsection .text, \"ax\", @progbits\n" 304 asm(".pushsection .text, \"ax\", @progbits\n"
305 ".p2align NACLENTRYALIGN\n"
Mark Seaborn 2012/02/13 19:04:08 If you could split this out into a separate change
bradn 2012/02/13 23:42:03 Done.
305 "ebp_exception_handler_wrapper:\n" 306 "ebp_exception_handler_wrapper:\n"
306 "mov %ebp, saved_ebp\n" 307 "mov %ebp, saved_ebp\n"
307 "jmp ebp_exception_handler\n" 308 "jmp ebp_exception_handler\n"
308 ".popsection\n"); 309 ".popsection\n");
309 310
310 void ebp_exception_handler() { 311 void ebp_exception_handler() {
311 assert(saved_ebp == 0x12345678); 312 assert(saved_ebp == 0x12345678);
312 /* Return from exception handler. */ 313 /* Return from exception handler. */
313 int rc = NACL_SYSCALL(exception_clear_flag)(); 314 int rc = NACL_SYSCALL(exception_clear_flag)();
314 assert(rc == 0); 315 assert(rc == 0);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 test_unsetting_x86_direction_flag(); 357 test_unsetting_x86_direction_flag();
357 #endif 358 #endif
358 359
359 #if defined(__i386__) 360 #if defined(__i386__)
360 test_preserving_ebp(); 361 test_preserving_ebp();
361 #endif 362 #endif
362 363
363 fprintf(stderr, "** intended_exit_status=0\n"); 364 fprintf(stderr, "** intended_exit_status=0\n");
364 return 0; 365 return 0;
365 } 366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698