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

Side by Side Diff: src/trusted/service_runtime/sel_ldr_standard.c

Issue 6995160: Hooks for out-of-process (OOP) debugger. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 6 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) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 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 /* 7 /*
8 * NaCl Simple/secure ELF loader (NaCl SEL). 8 * NaCl Simple/secure ELF loader (NaCl SEL).
9 */ 9 */
10 10
(...skipping 13 matching lines...) Expand all
24 #include "native_client/src/shared/platform/nacl_time.h" 24 #include "native_client/src/shared/platform/nacl_time.h"
25 #include "native_client/src/trusted/perf_counter/nacl_perf_counter.h" 25 #include "native_client/src/trusted/perf_counter/nacl_perf_counter.h"
26 26
27 #include "native_client/src/trusted/service_runtime/include/sys/errno.h" 27 #include "native_client/src/trusted/service_runtime/include/sys/errno.h"
28 28
29 #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h" 29 #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h"
30 #include "native_client/src/trusted/service_runtime/elf_util.h" 30 #include "native_client/src/trusted/service_runtime/elf_util.h"
31 #include "native_client/src/trusted/service_runtime/nacl_app_thread.h" 31 #include "native_client/src/trusted/service_runtime/nacl_app_thread.h"
32 #include "native_client/src/trusted/service_runtime/nacl_closure.h" 32 #include "native_client/src/trusted/service_runtime/nacl_closure.h"
33 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h" 33 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h"
34 #include "native_client/src/trusted/service_runtime/nacl_oop_debugger_hooks.h"
34 #include "native_client/src/trusted/service_runtime/nacl_sync_queue.h" 35 #include "native_client/src/trusted/service_runtime/nacl_sync_queue.h"
35 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" 36 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h"
36 #include "native_client/src/trusted/service_runtime/nacl_text.h" 37 #include "native_client/src/trusted/service_runtime/nacl_text.h"
37 #include "native_client/src/trusted/service_runtime/outer_sandbox.h" 38 #include "native_client/src/trusted/service_runtime/outer_sandbox.h"
38 #include "native_client/src/trusted/service_runtime/sel_memory.h" 39 #include "native_client/src/trusted/service_runtime/sel_memory.h"
39 #include "native_client/src/trusted/service_runtime/sel_ldr.h" 40 #include "native_client/src/trusted/service_runtime/sel_ldr.h"
40 #include "native_client/src/trusted/service_runtime/sel_util.h" 41 #include "native_client/src/trusted/service_runtime/sel_util.h"
41 #include "native_client/src/trusted/service_runtime/sel_addrspace.h" 42 #include "native_client/src/trusted/service_runtime/sel_addrspace.h"
42 43
43 #if !defined(SIZE_T_MAX) 44 #if !defined(SIZE_T_MAX)
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 701
701 /* now actually spawn the thread */ 702 /* now actually spawn the thread */
702 natp = malloc(sizeof *natp); 703 natp = malloc(sizeof *natp);
703 if (!natp) { 704 if (!natp) {
704 goto cleanup; 705 goto cleanup;
705 } 706 }
706 707
707 /* We are ready to distinguish crashes in trusted and untrusted code. */ 708 /* We are ready to distinguish crashes in trusted and untrusted code. */
708 NaClSignalRegisterApp(nap); 709 NaClSignalRegisterApp(nap);
709 710
711 /* NaClApp initialization is completed, call OOP debugger hook. */
712 NaClOopDebuggerAppCreateHook(nap);
713
710 NaClXMutexLock(&nap->mu); 714 NaClXMutexLock(&nap->mu);
711 nap->running = 1; 715 nap->running = 1;
712 NaClXMutexUnlock(&nap->mu); 716 NaClXMutexUnlock(&nap->mu);
713 717
714 NaClVmHoleWaitToStartThread(nap); 718 NaClVmHoleWaitToStartThread(nap);
715 719
716 NaClLog(2, "system stack ptr : %016"NACL_PRIxPTR"\n", stack_ptr); 720 NaClLog(2, "system stack ptr : %016"NACL_PRIxPTR"\n", stack_ptr);
717 NaClLog(2, " user stack ptr : %016"NACL_PRIxPTR"\n", 721 NaClLog(2, " user stack ptr : %016"NACL_PRIxPTR"\n",
718 NaClSysToUserStackAddr(nap, stack_ptr)); 722 NaClSysToUserStackAddr(nap, stack_ptr));
719 723
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 764 }
761 NaClXMutexUnlock(&nap->mu); 765 NaClXMutexUnlock(&nap->mu);
762 /* 766 /*
763 * Some thread invoked the exit (exit_group) syscall. 767 * Some thread invoked the exit (exit_group) syscall.
764 */ 768 */
765 769
766 if (NULL != nap->debug_stub_callbacks) { 770 if (NULL != nap->debug_stub_callbacks) {
767 nap->debug_stub_callbacks->process_exit_hook(nap->exit_status); 771 nap->debug_stub_callbacks->process_exit_hook(nap->exit_status);
768 } 772 }
769 773
774 NaClOopDebuggerAppExitHook(nap->exit_status);
775
770 return (nap->exit_status); 776 return (nap->exit_status);
771 } 777 }
772 778
773 /* 779 /*
774 * stack_ptr is from syscall, so a 32-bit address. 780 * stack_ptr is from syscall, so a 32-bit address.
775 */ 781 */
776 int32_t NaClCreateAdditionalThread(struct NaClApp *nap, 782 int32_t NaClCreateAdditionalThread(struct NaClApp *nap,
777 uintptr_t prog_ctr, 783 uintptr_t prog_ctr,
778 uintptr_t sys_stack_ptr, 784 uintptr_t sys_stack_ptr,
779 uintptr_t sys_tdb, 785 uintptr_t sys_tdb,
(...skipping 25 matching lines...) Expand all
805 sys_tdb, 811 sys_tdb,
806 tdb_size)) { 812 tdb_size)) {
807 NaClLog(LOG_WARNING, 813 NaClLog(LOG_WARNING,
808 ("NaClCreateAdditionalThread: could not allocate thread index." 814 ("NaClCreateAdditionalThread: could not allocate thread index."
809 " Returning EAGAIN per POSIX specs.\n")); 815 " Returning EAGAIN per POSIX specs.\n"));
810 free(natp); 816 free(natp);
811 return -NACL_ABI_EAGAIN; 817 return -NACL_ABI_EAGAIN;
812 } 818 }
813 return 0; 819 return 0;
814 } 820 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698