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 <string> | 19 #include <string> |
19 #include <vector> | 20 #include <vector> |
20 | 21 |
21 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
22 #include "base/files/file_path.h" | 23 #include "base/files/file_path.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 | 25 |
25 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
26 #include "base/mac/scoped_mach_port.h" | 27 #include "base/mac/scoped_mach_port.h" |
27 #endif | 28 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
42 //! because there may be alternative ways to use an existing Crashpad handler | 43 //! because there may be alternative ways to use an existing Crashpad handler |
43 //! without having to start one. To begin directing crashes to the handler, | 44 //! without having to start one. To begin directing crashes to the handler, |
44 //! started by this method, call UseHandler() after this method returns | 45 //! started by this method, call UseHandler() after this method returns |
45 //! successfully. | 46 //! successfully. |
46 //! | 47 //! |
47 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach | 48 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach |
48 //! send right corresponding to a receive right held by the handler process. | 49 //! send right corresponding to a receive right held by the handler process. |
49 //! The handler process runs an exception server on this port. | 50 //! The handler process runs an exception server on this port. |
50 //! | 51 //! |
51 //! \param[in] handler The path to a Crashpad handler executable. | 52 //! \param[in] handler The path to a Crashpad handler executable. |
52 //! \param[in] handler_arguments Arguments to pass to the Crashpad handler. | 53 //! \param[in] database The path to a Crashpad database. The handler will be |
53 //! Arguments required to perform the handshake are the responsibility of | 54 //! started with this path as its `--database` argument. |
54 //! this method, and must not be specified in this parameter. | 55 //! \param[in] url The URL of an upload server. The handler will be started |
| 56 //! with this URL as its `--url` argument. |
| 57 //! \param[in] annotations Process annotations to set in each crash report. |
| 58 //! The handler will be started with an `--annotation` argument for each |
| 59 //! element in this map. |
| 60 //! \param[in] arguments Additional arguments to pass to the Crashpad handler. |
| 61 //! Arguments passed in other parameters and arguments required to perform |
| 62 //! the handshake are the responsibility of this method, and must not be |
| 63 //! specified in this parameter. |
55 //! | 64 //! |
56 //! \return `true` on success, `false` on failure with a message logged. | 65 //! \return `true` on success, `false` on failure with a message logged. |
57 bool StartHandler(const base::FilePath& handler, | 66 bool StartHandler(const base::FilePath& handler, |
58 const std::vector<std::string>& handler_arguments); | 67 const base::FilePath& database, |
| 68 const std::string& url, |
| 69 const std::map<std::string, std::string>& annotations, |
| 70 const std::vector<std::string>& arguments); |
59 | 71 |
60 //! \brief Configures the process to direct its crashes to a Crashpad handler. | 72 //! \brief Configures the process to direct its crashes to a Crashpad handler. |
61 //! | 73 //! |
62 //! The Crashpad handler must previously have been started by StartHandler(). | 74 //! The Crashpad handler must previously have been started by StartHandler(). |
63 //! | 75 //! |
64 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, | 76 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, |
65 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained | 77 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained |
66 //! by StartHandler(). The handler will be installed with behavior | 78 //! by StartHandler(). The handler will be installed with behavior |
67 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor | 79 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor |
68 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad | 80 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad |
(...skipping 11 matching lines...) Expand all Loading... |
80 #if defined(OS_MACOSX) | 92 #if defined(OS_MACOSX) |
81 base::mac::ScopedMachSendRight exception_port_; | 93 base::mac::ScopedMachSendRight exception_port_; |
82 #endif | 94 #endif |
83 | 95 |
84 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); | 96 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); |
85 }; | 97 }; |
86 | 98 |
87 } // namespace crashpad | 99 } // namespace crashpad |
88 | 100 |
89 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 101 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
OLD | NEW |