LCOV - code coverage report
Current view: directory - src/trusted/service_runtime/win - debug_exception_handler.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 8 8 100.0 %
Date: 2014-06-18 Functions: 0 0 -

       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                 : #ifndef NATIVE_CLIENT_SERVICE_RUNTIME_WIN_DEBUG_EXCEPTION_HANDLER_H_
       8                 : #define NATIVE_CLIENT_SERVICE_RUNTIME_WIN_DEBUG_EXCEPTION_HANDLER_H_
       9                 : 
      10                 : #include "native_client/src/include/nacl_base.h"
      11                 : #include "native_client/src/include/nacl_compiler_annotations.h"
      12                 : 
      13                 : #if NACL_WINDOWS
      14                 : 
      15                 : #include <windows.h>
      16                 : 
      17                 : EXTERN_C_BEGIN
      18                 : 
      19                 : struct NaClApp;
      20                 : 
      21                 : /*
      22                 :  * This runs the debug exception handler in the current thread.  The
      23                 :  * current thread should already have attached to the target process
      24                 :  * through the Windows debug API by calling DebugActiveProcess() or by
      25                 :  * calling CreateProcess() with DEBUG_PROCESS.
      26                 :  *
      27                 :  * In info/info_size this function expects to receive an array of
      28                 :  * bytes that was passed to a NaClAttachDebugExceptionHandlerFunc
      29                 :  * callback by NaClDebugExceptionHandlerEnsureAttached().
      30                 :  */
      31                 : void NaClDebugExceptionHandlerRun(HANDLE process_handle,
      32                 :                                   const void *info, size_t info_size);
      33                 : 
      34                 : /*
      35                 :  * This requests that a debug exception handler be attached to the
      36                 :  * current process, and returns whether this succeeded.
      37                 :  */
      38                 : int NaClDebugExceptionHandlerEnsureAttached(struct NaClApp *nap);
      39                 : 
      40                 : /*
      41                 :  * This is an implementation of the
      42                 :  * NaClAttachDebugExceptionHandlerFunc callback.  It attaches a debug
      43                 :  * exception handler to the current process by launching sel_ldr with
      44                 :  * --debug-exception-handler.
      45                 :  */
      46                 : int NaClDebugExceptionHandlerStandaloneAttach(const void *info,
      47                 :                                               size_t info_size);
      48                 : 
      49                 : /*
      50                 :  * This implements sel_ldr's --debug-exception-handler option.
      51                 :  */
      52                 : void NaClDebugExceptionHandlerStandaloneHandleArgs(int argc, char **argv);
      53                 : 
      54                 : EXTERN_C_END
      55                 : 
      56                 : #else
      57                 : 
      58                 : /*
      59                 :  * We provide no-op implementations for the non-Windows case to reduce
      60                 :  * the number of #ifs where these functions are called.
      61                 :  */
      62                 : 
      63             119 : static INLINE int NaClDebugExceptionHandlerEnsureAttached(struct NaClApp *nap) {
      64             238 :   UNREFERENCED_PARAMETER(nap);
      65                 : 
      66             119 :   return 1;
      67                 : }
      68                 : 
      69             261 : static INLINE void NaClDebugExceptionHandlerStandaloneHandleArgs(int argc,
      70             261 :                                                                  char **argv) {
      71             522 :   UNREFERENCED_PARAMETER(argc);
      72             522 :   UNREFERENCED_PARAMETER(argv);
      73             261 : }
      74                 : 
      75                 : #endif
      76                 : 
      77                 : #endif /* NATIVE_CLIENT_SERVICE_RUNTIME_WIN_DEBUG_EXCEPTION_HANDLER_H_ */

Generated by: LCOV version 1.7