Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: client/crashpad_client.h

Issue 1414533006: mac: Add a mode to crashpad_handler to run from launchd (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | client/crashpad_client_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 //! it for crashes. 35 //! it for crashes.
36 class CrashpadClient { 36 class CrashpadClient {
37 public: 37 public:
38 CrashpadClient(); 38 CrashpadClient();
39 ~CrashpadClient(); 39 ~CrashpadClient();
40 40
41 //! \brief Starts a Crashpad handler process, performing any necessary 41 //! \brief Starts a Crashpad handler process, performing any necessary
42 //! handshake to configure it. 42 //! handshake to configure it.
43 //! 43 //!
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 are alternative ways to use an existing Crashpad handler. To
46 //! without having to start one. To begin directing crashes to the handler, 46 //! begin directing crashes to the handler started by this method, call
47 //! started by this method, call UseHandler() after this method returns 47 //! UseHandler() after this method returns successfully.
48 //! successfully.
49 //! 48 //!
50 //! On Mac OS X, this method starts a Crashpad handler and obtains a Mach 49 //! 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. 50 //! send right corresponding to a receive right held by the handler process.
52 //! The handler process runs an exception server on this port. 51 //! The handler process runs an exception server on this port.
53 //! 52 //!
54 //! \param[in] handler The path to a Crashpad handler executable. 53 //! \param[in] handler The path to a Crashpad handler executable.
55 //! \param[in] database The path to a Crashpad database. The handler will be 54 //! \param[in] database The path to a Crashpad database. The handler will be
56 //! started with this path as its `--database` argument. 55 //! started with this path as its `--database` argument.
57 //! \param[in] url The URL of an upload server. The handler will be started 56 //! \param[in] url The URL of an upload server. The handler will be started
58 //! with this URL as its `--url` argument. 57 //! with this URL as its `--url` argument.
(...skipping 10 matching lines...) Expand all
69 //! not supported, it will be ignored. 68 //! not supported, it will be ignored.
70 //! 69 //!
71 //! \return `true` on success, `false` on failure with a message logged. 70 //! \return `true` on success, `false` on failure with a message logged.
72 bool StartHandler(const base::FilePath& handler, 71 bool StartHandler(const base::FilePath& handler,
73 const base::FilePath& database, 72 const base::FilePath& database,
74 const std::string& url, 73 const std::string& url,
75 const std::map<std::string, std::string>& annotations, 74 const std::map<std::string, std::string>& annotations,
76 const std::vector<std::string>& arguments, 75 const std::vector<std::string>& arguments,
77 bool restartable); 76 bool restartable);
78 77
78 #if defined(OS_MACOSX) || DOXYGEN
79 //! \brief Sets the process’ crash handler to a Mach service registered with
80 //! the bootstrap server.
81 //!
82 //! This method does not actually direct any crashes to the Crashpad handler,
83 //! because there are alternative ways to start or use an existing Crashpad
84 //! handler. To begin directing crashes to the handler set by this method,
85 //! call UseHandler() after this method returns successfully.
86 //!
87 //! This method is only defined on OS X.
88 //!
89 //! \param[in] service_name The service name of a Crashpad exception handler
90 //! service previously registered with the bootstrap server.
91 //!
92 //! \return `true` on success, `false` on failure with a message logged.
93 bool SetHandlerMachService(const std::string& service_name);
94
95 //! \brief Sets the process’ crash handler to a Mach port.
96 //!
97 //! This method does not actually direct any crashes to the Crashpad handler,
98 //! because there are alternative ways to start or use an existing Crashpad
99 //! handler. To begin directing crashes to the handler set by this method,
100 //! call UseHandler() after this method.
101 //!
102 //! This method is only defined on OS X.
103 //!
104 //! \param[in] exception_port An `exception_port_t` corresponding to a
105 //! Crashpad exception handler service.
106 void SetHandlerMachPort(base::mac::ScopedMachSendRight exception_port);
107 #endif
108
79 #if defined(OS_WIN) || DOXYGEN 109 #if defined(OS_WIN) || DOXYGEN
80 //! \brief Sets the IPC pipe of a presumably-running Crashpad handler process 110 //! \brief Sets the IPC pipe of a presumably-running Crashpad handler process
81 //! which was started with StartHandler() or by other compatible means 111 //! which was started with StartHandler() or by other compatible means
82 //! and does an IPC message exchange to register this process with the 112 //! and does an IPC message exchange to register this process with the
83 //! handler. However, just like StartHandler(), crashes are not serviced 113 //! handler. However, just like StartHandler(), crashes are not serviced
84 //! until UseHandler() is called. 114 //! until UseHandler() is called.
85 //! 115 //!
116 //! This method is only defined on Windows.
117 //!
86 //! \param[in] ipc_pipe The full name of the crash handler IPC pipe. This is 118 //! \param[in] ipc_pipe The full name of the crash handler IPC pipe. This is
87 //! a string of the form `&quot;\\.\pipe\NAME&quot;`. 119 //! a string of the form `&quot;\\.\pipe\NAME&quot;`.
88 //! 120 //!
89 //! \return `true` on success and `false` on failure. 121 //! \return `true` on success and `false` on failure.
90 bool SetHandlerIPCPipe(const std::wstring& ipc_pipe); 122 bool SetHandlerIPCPipe(const std::wstring& ipc_pipe);
91 123
92 //! \brief Retrieves the IPC pipe name used to register with the Crashpad 124 //! \brief Retrieves the IPC pipe name used to register with the Crashpad
93 //! handler. 125 //! handler.
94 //! 126 //!
95 //! This method retrieves the IPC pipe name set by SetHandlerIPCPipe(), or a 127 //! This method retrieves the IPC pipe name set by SetHandlerIPCPipe(), or a
(...skipping 12 matching lines...) Expand all
108 //! been a crash. 140 //! been a crash.
109 //! 141 //!
110 //! \param[in] context A `CONTEXT`, generally captured by CaptureContext() or 142 //! \param[in] context A `CONTEXT`, generally captured by CaptureContext() or
111 //! similar. 143 //! similar.
112 static void DumpWithoutCrash(const CONTEXT& context); 144 static void DumpWithoutCrash(const CONTEXT& context);
113 #endif 145 #endif
114 146
115 //! \brief Configures the process to direct its crashes to a Crashpad handler. 147 //! \brief Configures the process to direct its crashes to a Crashpad handler.
116 //! 148 //!
117 //! The Crashpad handler must previously have been started by StartHandler() 149 //! The Crashpad handler must previously have been started by StartHandler()
118 //! or configured by SetHandlerIPCPipe(). 150 //! or configured by SetHandlerMachService(), SetHandlerMachPort(), or
151 //! SetHandlerIPCPipe().
119 //! 152 //!
120 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`, 153 //! On Mac OS X, this method sets the task’s exception port for `EXC_CRASH`,
121 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained 154 //! `EXC_RESOURCE`, and `EXC_GUARD` exceptions to the Mach send right obtained
122 //! by StartHandler(). The handler will be installed with behavior 155 //! by StartHandler(). The handler will be installed with behavior
123 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor 156 //! `EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES` and thread state flavor
124 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad 157 //! `MACHINE_THREAD_STATE`. Exception ports are inherited, so a Crashpad
125 //! handler chosen by UseHandler() will remain the handler for any child 158 //! handler chosen by UseHandler() will remain the handler for any child
126 //! processes created after UseHandler() is called. Child processes do not 159 //! processes created after UseHandler() is called. Child processes do not
127 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any 160 //! need to call StartHandler() or UseHandler() or be aware of Crashpad in any
128 //! way. The Crashpad handler will receive crashes from child processes that 161 //! way. The Crashpad handler will receive crashes from child processes that
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #elif defined(OS_WIN) 196 #elif defined(OS_WIN)
164 std::wstring ipc_pipe_; 197 std::wstring ipc_pipe_;
165 #endif 198 #endif
166 199
167 DISALLOW_COPY_AND_ASSIGN(CrashpadClient); 200 DISALLOW_COPY_AND_ASSIGN(CrashpadClient);
168 }; 201 };
169 202
170 } // namespace crashpad 203 } // namespace crashpad
171 204
172 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_ 205 #endif // CRASHPAD_CLIENT_CRASHPAD_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | client/crashpad_client_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698