| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 //! \brief The primary interface for an application to have Crashpad monitor | 37 //! \brief The primary interface for an application to have Crashpad monitor |
| 38 //! it for crashes. | 38 //! it for crashes. |
| 39 class CrashpadClient { | 39 class CrashpadClient { |
| 40 public: | 40 public: |
| 41 CrashpadClient(); | 41 CrashpadClient(); |
| 42 ~CrashpadClient(); | 42 ~CrashpadClient(); |
| 43 | 43 |
| 44 //! \brief Starts a Crashpad handler process, performing any necessary | 44 //! \brief Starts a Crashpad handler process, performing any necessary |
| 45 //! handshake to configure it. | 45 //! handshake to configure it. |
| 46 //! | 46 //! |
| 47 //! This method directs crashes to the Crashpad handler. On Mac OS X, this | 47 //! This method directs crashes to the Crashpad handler. On macOS, this is |
| 48 //! is applicable to this process and all child processes. On Windows, child | 48 //! applicable to this process and all subsequent child processes. On Windows, |
| 49 //! processes must also register by using SetHandlerIPCPipe(). | 49 //! child processes must also register by using SetHandlerIPCPipe(). |
| 50 //! | 50 //! |
| 51 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach send | 51 //! On macOS, this method starts a Crashpad handler and obtains a Mach send |
| 52 //! right corresponding to a receive right held by the handler process. The | 52 //! right corresponding to a receive right held by the handler process. The |
| 53 //! handler process runs an exception server on this port. This method sets | 53 //! handler process runs an exception server on this port. This method sets |
| 54 //! the task’s exception port for `EXC_CRASH`, `EXC_RESOURCE`, and `EXC_GUARD` | 54 //! the task’s exception port for `EXC_CRASH`, `EXC_RESOURCE`, and `EXC_GUARD` |
| 55 //! exceptions to the Mach send right obtained. The handler will be installed | 55 //! exceptions to the Mach send right obtained. The handler will be installed |
| 56 //! with behavior `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread | 56 //! with behavior `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread |
| 57 //! state flavor `MACHINE_THREAD_STATE`. Exception ports are inherited, so a | 57 //! state flavor `MACHINE_THREAD_STATE`. Exception ports are inherited, so a |
| 58 //! Crashpad handler started here will remain the handler for any child | 58 //! Crashpad handler started here will remain the handler for any child |
| 59 //! processes created after StartHandler() is called. Child processes do not | 59 //! processes created after StartHandler() is called. These child processes do |
| 60 //! need to call StartHandler() or be aware of Crashpad in any way. The | 60 //! not need to call StartHandler() or be aware of Crashpad in any way. The |
| 61 //! Crashpad handler will receive crashes from child processes that have | 61 //! Crashpad handler will receive crashes from child processes that have |
| 62 //! inherited it as their exception handler even after the process that called | 62 //! inherited it as their exception handler even after the process that called |
| 63 //! StartHandler() exits. | 63 //! StartHandler() exits. |
| 64 //! | 64 //! |
| 65 //! On Windows, if \a asynchronous_start is `true`, this function will not | 65 //! On Windows, if \a asynchronous_start is `true`, this function will not |
| 66 //! directly call `CreateProcess()`, making it suitable for use in a | 66 //! directly call `CreateProcess()`, making it suitable for use in a |
| 67 //! `DllMain()`. In that case, the handler is started from a background | 67 //! `DllMain()`. In that case, the handler is started from a background |
| 68 //! thread, deferring the handler's startup. Nevertheless, regardless of the | 68 //! thread, deferring the handler's startup. Nevertheless, regardless of the |
| 69 //! value of \a asynchronous_start, after calling this method, the global | 69 //! value of \a asynchronous_start, after calling this method, the global |
| 70 //! unhandled exception filter is set up, and all crashes will be handled by | 70 //! unhandled exception filter is set up, and all crashes will be handled by |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const std::string& url, | 102 const std::string& url, |
| 103 const std::map<std::string, std::string>& annotations, | 103 const std::map<std::string, std::string>& annotations, |
| 104 const std::vector<std::string>& arguments, | 104 const std::vector<std::string>& arguments, |
| 105 bool restartable, | 105 bool restartable, |
| 106 bool asynchronous_start); | 106 bool asynchronous_start); |
| 107 | 107 |
| 108 #if defined(OS_MACOSX) || DOXYGEN | 108 #if defined(OS_MACOSX) || DOXYGEN |
| 109 //! \brief Sets the process’ crash handler to a Mach service registered with | 109 //! \brief Sets the process’ crash handler to a Mach service registered with |
| 110 //! the bootstrap server. | 110 //! the bootstrap server. |
| 111 //! | 111 //! |
| 112 //! This method is only defined on OS X. | 112 //! This method is only defined on macOS. |
| 113 //! | 113 //! |
| 114 //! See StartHandler() for more detail on how the port and handler are | 114 //! See StartHandler() for more detail on how the port and handler are |
| 115 //! configured. | 115 //! configured. |
| 116 //! | 116 //! |
| 117 //! \param[in] service_name The service name of a Crashpad exception handler | 117 //! \param[in] service_name The service name of a Crashpad exception handler |
| 118 //! service previously registered with the bootstrap server. | 118 //! service previously registered with the bootstrap server. |
| 119 //! | 119 //! |
| 120 //! \return `true` on success, `false` on failure with a message logged. | 120 //! \return `true` on success, `false` on failure with a message logged. |
| 121 bool SetHandlerMachService(const std::string& service_name); | 121 bool SetHandlerMachService(const std::string& service_name); |
| 122 | 122 |
| 123 //! \brief Sets the process’ crash handler to a Mach port. | 123 //! \brief Sets the process’ crash handler to a Mach port. |
| 124 //! | 124 //! |
| 125 //! This method is only defined on OS X. | 125 //! This method is only defined on macOS. |
| 126 //! | 126 //! |
| 127 //! See StartHandler() for more detail on how the port and handler are | 127 //! See StartHandler() for more detail on how the port and handler are |
| 128 //! configured. | 128 //! configured. |
| 129 //! | 129 //! |
| 130 //! \param[in] exception_port An `exception_port_t` corresponding to a | 130 //! \param[in] exception_port An `exception_port_t` corresponding to a |
| 131 //! Crashpad exception handler service. | 131 //! Crashpad exception handler service. |
| 132 //! | 132 //! |
| 133 //! \return `true` on success, `false` on failure with a message logged. | 133 //! \return `true` on success, `false` on failure with a message logged. |
| 134 bool SetHandlerMachPort(base::mac::ScopedMachSendRight exception_port); | 134 bool SetHandlerMachPort(base::mac::ScopedMachSendRight exception_port); |
| 135 #endif | 135 #endif |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 //! confusion with real exception codes which tend to have those bits | 227 //! confusion with real exception codes which tend to have those bits |
| 228 //! set. | 228 //! set. |
| 229 kTriggeredExceptionCode = 0xcca11ed, | 229 kTriggeredExceptionCode = 0xcca11ed, |
| 230 }; | 230 }; |
| 231 #endif | 231 #endif |
| 232 | 232 |
| 233 #if defined(OS_MACOSX) || DOXYGEN | 233 #if defined(OS_MACOSX) || DOXYGEN |
| 234 //! \brief Configures the process to direct its crashes to the default handler | 234 //! \brief Configures the process to direct its crashes to the default handler |
| 235 //! for the operating system. | 235 //! for the operating system. |
| 236 //! | 236 //! |
| 237 //! On OS X, this sets the task’s exception port as in SetHandlerMachPort(), | 237 //! On macOS, this sets the task’s exception port as in SetHandlerMachPort(), |
| 238 //! but the exception handler used is obtained from | 238 //! but the exception handler used is obtained from |
| 239 //! SystemCrashReporterHandler(). If the system’s crash reporter handler | 239 //! SystemCrashReporterHandler(). If the system’s crash reporter handler |
| 240 //! cannot be determined or set, the task’s exception ports for crash-type | 240 //! cannot be determined or set, the task’s exception ports for crash-type |
| 241 //! exceptions are cleared. | 241 //! exceptions are cleared. |
| 242 //! | 242 //! |
| 243 //! Use of this function is strongly discouraged. | 243 //! Use of this function is strongly discouraged. |
| 244 //! | 244 //! |
| 245 //! \warning After a call to this function, Crashpad will no longer monitor | 245 //! \warning After a call to this function, Crashpad will no longer monitor |
| 246 //! the process for crashes until a subsequent call to | 246 //! the process for crashes until a subsequent call to |
| 247 //! SetHandlerMachPort(). | 247 //! SetHandlerMachPort(). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 258 std::wstring ipc_pipe_; | 258 std::wstring ipc_pipe_; |
| 259 ScopedKernelHANDLE handler_start_thread_; | 259 ScopedKernelHANDLE handler_start_thread_; |
| 260 #endif | 260 #endif |
| 261 | 261 |
| 262 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); | 262 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); |
| 263 }; | 263 }; |
| 264 | 264 |
| 265 } // namespace crashpad | 265 } // namespace crashpad |
| 266 | 266 |
| 267 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 267 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
| OLD | NEW |