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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 //! This method does not actually direct any crashes to the Crashpad handler, | 42 //! This method does not actually direct any crashes to the Crashpad handler, |
43 //! 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 |
44 //! 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, |
45 //! started by this method, call UseHandler() after this method returns | 45 //! started by this method, call UseHandler() after this method returns |
46 //! successfully. | 46 //! successfully. |
47 //! | 47 //! |
48 //! 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 |
49 //! 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. |
50 //! The handler process runs an exception server on this port. | 50 //! The handler process runs an exception server on this port. |
51 //! | 51 //! |
52 //! On Windows, SetHandler() is normally used instead since the handler is | |
53 //! started by other means. | |
54 //! | |
52 //! \param[in] handler The path to a Crashpad handler executable. | 55 //! \param[in] handler The path to a Crashpad handler executable. |
53 //! \param[in] database The path to a Crashpad database. The handler will be | 56 //! \param[in] database The path to a Crashpad database. The handler will be |
54 //! started with this path as its `--database` argument. | 57 //! started with this path as its `--database` argument. |
55 //! \param[in] url The URL of an upload server. The handler will be started | 58 //! \param[in] url The URL of an upload server. The handler will be started |
56 //! with this URL as its `--url` argument. | 59 //! with this URL as its `--url` argument. |
57 //! \param[in] annotations Process annotations to set in each crash report. | 60 //! \param[in] annotations Process annotations to set in each crash report. |
58 //! The handler will be started with an `--annotation` argument for each | 61 //! The handler will be started with an `--annotation` argument for each |
59 //! element in this map. | 62 //! element in this map. |
60 //! \param[in] arguments Additional arguments to pass to the Crashpad handler. | 63 //! \param[in] arguments Additional arguments to pass to the Crashpad handler. |
61 //! Arguments passed in other parameters and arguments required to perform | 64 //! Arguments passed in other parameters and arguments required to perform |
62 //! the handshake are the responsibility of this method, and must not be | 65 //! the handshake are the responsibility of this method, and must not be |
63 //! specified in this parameter. | 66 //! specified in this parameter. |
64 //! | 67 //! |
65 //! \return `true` on success, `false` on failure with a message logged. | 68 //! \return `true` on success, `false` on failure with a message logged. |
66 bool StartHandler(const base::FilePath& handler, | 69 bool StartHandler(const base::FilePath& handler, |
67 const base::FilePath& database, | 70 const base::FilePath& database, |
68 const std::string& url, | 71 const std::string& url, |
69 const std::map<std::string, std::string>& annotations, | 72 const std::map<std::string, std::string>& annotations, |
70 const std::vector<std::string>& arguments); | 73 const std::vector<std::string>& arguments); |
71 | 74 |
75 //! \brief Sets the IPC port of a presumably running Crashpad handler process | |
Mark Mentovai
2015/04/28 17:53:04
presumably-running
| |
76 //! which was started with StartHandler() or by other compatible means | |
77 //! and does an IPC message exchange to register this process with the | |
78 //! handler. However, just like StartHandler() crashes are not serviced | |
Mark Mentovai
2015/04/28 17:53:05
comma after StartHandler()
| |
79 //! until UseHandler() is called. | |
80 //! | |
81 //! The IPC port name (somehow) encodes enough information so that | |
scottmg
2015/04/24 04:55:06
Maybe make the "enough information" explicit param
cpu_(ooo_6.6-7.5)
2015/04/24 19:40:11
The "encodes" is misleading, I think the pipe name
| |
82 //! registration is done with a crash handler using the appropiate database | |
83 //! and upload server. | |
84 //! | |
85 //! \param[in] the full name of the crash handler IPC port. | |
scottmg
2015/04/24 04:55:06
I think this should be
\param[in] ipc_port the
Mark Mentovai
2015/04/28 17:53:05
scottmg wrote:
cpu_(ooo_6.6-7.5)
2015/04/29 01:34:17
Acknowledged.
| |
86 //! | |
87 //! \return 'true' on success `false` on failure. | |
scottmg
2015/04/24 04:55:06
`true` instead of 'true'
Mark Mentovai
2015/04/28 17:53:04
and a comma or an “and” in between the true and fa
cpu_(ooo_6.6-7.5)
2015/04/29 01:34:17
Acknowledged.
| |
88 bool SetHandler(const std::string& ipc_port); | |
scottmg
2015/04/24 04:55:06
Probably just make this #if WIN and remove from th
Mark Mentovai
2015/04/28 17:53:04
scottmg wrote:
cpu_(ooo_6.6-7.5)
2015/04/29 01:34:17
Acknowledged.
| |
89 | |
72 //! \brief Configures the process to direct its crashes to a Crashpad handler. | 90 //! \brief Configures the process to direct its crashes to a Crashpad handler. |
73 //! | 91 //! |
74 //! The Crashpad handler must previously have been started by StartHandler(). | 92 //! The Crashpad handler must previously have been started by StartHandler() |
93 //! or contacted by SetHandler(). | |
Mark Mentovai
2015/04/28 17:53:05
SetHandler() may not need to contact the handler,
cpu_(ooo_6.6-7.5)
2015/04/29 01:34:17
Acknowledged.
| |
75 //! | 94 //! |
76 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, | 95 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, |
77 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained | 96 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained |
78 //! by StartHandler(). The handler will be installed with behavior | 97 //! by StartHandler(). The handler will be installed with behavior |
79 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor | 98 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor |
80 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad | 99 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad |
81 //! handler chosen by UseHandler() will remain the handler for any child | 100 //! handler chosen by UseHandler() will remain the handler for any child |
82 //! processes created after UseHandler() is called. Child processes do not | 101 //! processes created after UseHandler() is called. Child processes do not |
83 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any | 102 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any |
84 //! way. The Crashpad handler will receive crashes from child processes that | 103 //! way. The Crashpad handler will receive crashes from child processes that |
85 //! have inherited it as their exception handler even after the process that | 104 //! have inherited it as their exception handler even after the process that |
86 //! called StartHandler() exits. | 105 //! called StartHandler() exits. |
87 //! | 106 //! |
107 //! On Windows, this method sets the unhandled exception handler to a local | |
108 //! function that when reached it will "signal and wait" for the crash | |
109 //! handler process to create the dump. | |
110 //! | |
88 //! \return `true` on success, `false` on failure with a message logged. | 111 //! \return `true` on success, `false` on failure with a message logged. |
89 bool UseHandler(); | 112 bool UseHandler(); |
90 | 113 |
91 private: | 114 private: |
92 #if defined(OS_MACOSX) | 115 #if defined(OS_MACOSX) |
93 base::mac::ScopedMachSendRight exception_port_; | 116 base::mac::ScopedMachSendRight exception_port_; |
94 #endif | 117 #endif |
95 | 118 |
96 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); | 119 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); |
97 }; | 120 }; |
98 | 121 |
99 } // namespace crashpad | 122 } // namespace crashpad |
100 | 123 |
101 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ | 124 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ |
OLD | NEW |