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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 //! This method does not actually direct any crashes to the Crashpad handler, | 44 //! This method does not actually direct any crashes to the Crashpad handler, |
45 //! because there may be alternative ways to use an existing Crashpad handler | 45 //! because there may be alternative ways to use an existing Crashpad handler |
46 //! without having to start one. To begin directing crashes to the handler, | 46 //! without having to start one. To begin directing crashes to the handler, |
47 //! started by this method, call UseHandler() after this method returns | 47 //! started by this method, call UseHandler() after this method returns |
48 //! successfully. | 48 //! successfully. |
49 //! | 49 //! |
50 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach | 50 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach |
51 //! send right corresponding to a receive right held by the handler process. | 51 //! send right corresponding to a receive right held by the handler process. |
52 //! The handler process runs an exception server on this port. | 52 //! The handler process runs an exception server on this port. |
53 //! | 53 //! |
54 //! On Windows, SetHandler() is normally used instead since the handler is | |
55 //! started by other means. | |
56 //! | |
57 //! \param[in] handler The path to a Crashpad handler executable. | 54 //! \param[in] handler The path to a Crashpad handler executable. |
58 //! \param[in] database The path to a Crashpad database. The handler will be | 55 //! \param[in] database The path to a Crashpad database. The handler will be |
59 //! started with this path as its `--database` argument. | 56 //! started with this path as its `--database` argument. |
60 //! \param[in] url The URL of an upload server. The handler will be started | 57 //! \param[in] url The URL of an upload server. The handler will be started |
61 //! with this URL as its `--url` argument. | 58 //! with this URL as its `--url` argument. |
62 //! \param[in] annotations Process annotations to set in each crash report. | 59 //! \param[in] annotations Process annotations to set in each crash report. |
63 //! The handler will be started with an `--annotation` argument for each | 60 //! The handler will be started with an `--annotation` argument for each |
64 //! element in this map. | 61 //! element in this map. |
65 //! \param[in] arguments Additional arguments to pass to the Crashpad handler. | 62 //! \param[in] arguments Additional arguments to pass to the Crashpad handler. |
66 //! Arguments passed in other parameters and arguments required to perform | 63 //! Arguments passed in other parameters and arguments required to perform |
(...skipping 11 matching lines...) Expand all Loading... |
78 //! \brief Sets the IPC port of a presumably-running Crashpad handler process | 75 //! \brief Sets the IPC port of a presumably-running Crashpad handler process |
79 //! which was started with StartHandler() or by other compatible means | 76 //! which was started with StartHandler() or by other compatible means |
80 //! and does an IPC message exchange to register this process with the | 77 //! and does an IPC message exchange to register this process with the |
81 //! handler. However, just like StartHandler(), crashes are not serviced | 78 //! handler. However, just like StartHandler(), crashes are not serviced |
82 //! until UseHandler() is called. | 79 //! until UseHandler() is called. |
83 //! | 80 //! |
84 //! The IPC port name (somehow) encodes enough information so that | 81 //! The IPC port name (somehow) encodes enough information so that |
85 //! registration is done with a crash handler using the appropriate database | 82 //! registration is done with a crash handler using the appropriate database |
86 //! and upload server. | 83 //! and upload server. |
87 //! | 84 //! |
88 //! \param[in] ipc_port The full name of the crash handler IPC port. | 85 //! \param[in] ipc_pipe The full name of the crash handler IPC pipe. This is |
| 86 //! a string of the form `"\\.\pipe\NAME"`. |
89 //! | 87 //! |
90 //! \return `true` on success and `false` on failure. | 88 //! \return `true` on success and `false` on failure. |
91 bool SetHandler(const std::string& ipc_port); | 89 bool SetHandlerIPCPipe(const std::wstring& ipc_pipe); |
92 | 90 |
93 //! \brief Requests that the handler capture a dump even though there hasn't | 91 //! \brief Requests that the handler capture a dump even though there hasn't |
94 //! been a crash. | 92 //! been a crash. |
95 //! | 93 //! |
96 //! \param[in] context A `CONTEXT`, generally captured by CaptureContext() or | 94 //! \param[in] context A `CONTEXT`, generally captured by CaptureContext() or |
97 //! similar. | 95 //! similar. |
98 static void DumpWithoutCrash(const CONTEXT& context); | 96 static void DumpWithoutCrash(const CONTEXT& context); |
99 #endif | 97 #endif |
100 | 98 |
101 //! \brief Configures the process to direct its crashes to a Crashpad handler. | 99 //! \brief Configures the process to direct its crashes to a Crashpad handler. |
102 //! | 100 //! |
103 //! The Crashpad handler must previously have been started by StartHandler() | 101 //! The Crashpad handler must previously have been started by StartHandler() |
104 //! or configured by SetHandler(). | 102 //! or configured by SetHandlerIPCPipe(). |
105 //! | 103 //! |
106 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, | 104 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, |
107 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained | 105 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained |
108 //! by StartHandler(). The handler will be installed with behavior | 106 //! by StartHandler(). The handler will be installed with behavior |
109 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor | 107 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor |
110 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad | 108 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad |
111 //! handler chosen by UseHandler() will remain the handler for any child | 109 //! handler chosen by UseHandler() will remain the handler for any child |
112 //! processes created after UseHandler() is called. Child processes do not | 110 //! processes created after UseHandler() is called. Child processes do not |
113 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any | 111 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any |
114 //! way. The Crashpad handler will receive crashes from child processes that | 112 //! way. The Crashpad handler will receive crashes from child processes that |
(...skipping 25 matching lines...) Expand all Loading... |
140 //! situations where a CrashpadClient object is not otherwise available. | 138 //! situations where a CrashpadClient object is not otherwise available. |
141 //! This may be useful when a child process inherits its parent’s Crashpad | 139 //! This may be useful when a child process inherits its parent’s Crashpad |
142 //! handler, but wants to sever this tie. | 140 //! handler, but wants to sever this tie. |
143 static void UseSystemDefaultHandler(); | 141 static void UseSystemDefaultHandler(); |
144 #endif | 142 #endif |
145 | 143 |
146 private: | 144 private: |
147 #if defined(OS_MACOSX) | 145 #if defined(OS_MACOSX) |
148 base::mac::ScopedMachSendRight exception_port_; | 146 base::mac::ScopedMachSendRight exception_port_; |
149 #elif defined(OS_WIN) | 147 #elif defined(OS_WIN) |
150 std::string ipc_port_; | 148 std::wstring ipc_pipe_; |
151 #endif | 149 #endif |
152 | 150 |
153 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); | 151 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); |
154 }; | 152 }; |
155 | 153 |
156 } // namespace crashpad | 154 } // namespace crashpad |
157 | 155 |
158 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 156 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
OLD | NEW |