| 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #ifndef CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 15 #ifndef CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
| 16 #define CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 16 #define CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
| 17 | 17 |
| 18 #include <map> | 18 #include <map> |
| 19 #include <string> | 19 #include <string> |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "base/files/file_path.h" | 23 #include "base/files/file_path.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 | 25 |
| 26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 27 #include "base/mac/scoped_mach_port.h" | 27 #include "base/mac/scoped_mach_port.h" |
| 28 #elif defined(OS_WIN) |
| 29 #include <windows.h> |
| 28 #endif | 30 #endif |
| 29 | 31 |
| 30 namespace crashpad { | 32 namespace crashpad { |
| 31 | 33 |
| 32 //! \brief The primary interface for an application to have Crashpad monitor | 34 //! \brief The primary interface for an application to have Crashpad monitor |
| 33 //! it for crashes. | 35 //! it for crashes. |
| 34 class CrashpadClient { | 36 class CrashpadClient { |
| 35 public: | 37 public: |
| 36 CrashpadClient(); | 38 CrashpadClient(); |
| 37 ~CrashpadClient(); | 39 ~CrashpadClient(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 //! until UseHandler() is called. | 82 //! until UseHandler() is called. |
| 81 //! | 83 //! |
| 82 //! The IPC port name (somehow) encodes enough information so that | 84 //! The IPC port name (somehow) encodes enough information so that |
| 83 //! registration is done with a crash handler using the appropriate database | 85 //! registration is done with a crash handler using the appropriate database |
| 84 //! and upload server. | 86 //! and upload server. |
| 85 //! | 87 //! |
| 86 //! \param[in] ipc_port The full name of the crash handler IPC port. | 88 //! \param[in] ipc_port The full name of the crash handler IPC port. |
| 87 //! | 89 //! |
| 88 //! \return `true` on success and `false` on failure. | 90 //! \return `true` on success and `false` on failure. |
| 89 bool SetHandler(const std::string& ipc_port); | 91 bool SetHandler(const std::string& ipc_port); |
| 92 |
| 93 //! \brief Requests that the handler capture a dump even though there hasn't |
| 94 //! been a crash. |
| 95 //! |
| 96 //! \param[in] context A CONTEXT, generally captured by `RtlCaptureContext()` |
| 97 //! or similar. |
| 98 static void DumpWithoutCrash(const CONTEXT& context); |
| 90 #endif | 99 #endif |
| 91 | 100 |
| 92 //! \brief Configures the process to direct its crashes to a Crashpad handler. | 101 //! \brief Configures the process to direct its crashes to a Crashpad handler. |
| 93 //! | 102 //! |
| 94 //! The Crashpad handler must previously have been started by StartHandler() | 103 //! The Crashpad handler must previously have been started by StartHandler() |
| 95 //! or configured by SetHandler(). | 104 //! or configured by SetHandler(). |
| 96 //! | 105 //! |
| 97 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, | 106 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, |
| 98 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained | 107 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained |
| 99 //! by StartHandler(). The handler will be installed with behavior | 108 //! by StartHandler(). The handler will be installed with behavior |
| (...skipping 17 matching lines...) Expand all Loading... |
| 117 #if defined(OS_MACOSX) | 126 #if defined(OS_MACOSX) |
| 118 base::mac::ScopedMachSendRight exception_port_; | 127 base::mac::ScopedMachSendRight exception_port_; |
| 119 #endif | 128 #endif |
| 120 | 129 |
| 121 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); | 130 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); |
| 122 }; | 131 }; |
| 123 | 132 |
| 124 } // namespace crashpad | 133 } // namespace crashpad |
| 125 | 134 |
| 126 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 135 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
| OLD | NEW |