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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 // There are no predefined constants for these. | 136 // There are no predefined constants for these. |
137 enum MachMessageID : mach_msg_id_t { | 137 enum MachMessageID : mach_msg_id_t { |
138 kMachMessageIDExceptionRaise = 2401, | 138 kMachMessageIDExceptionRaise = 2401, |
139 kMachMessageIDExceptionRaiseState = 2402, | 139 kMachMessageIDExceptionRaiseState = 2402, |
140 kMachMessageIDExceptionRaiseStateIdentity = 2403, | 140 kMachMessageIDExceptionRaiseStateIdentity = 2403, |
141 kMachMessageIDMachExceptionRaise = 2405, | 141 kMachMessageIDMachExceptionRaise = 2405, |
142 kMachMessageIDMachExceptionRaiseState = 2406, | 142 kMachMessageIDMachExceptionRaiseState = 2406, |
143 kMachMessageIDMachExceptionRaiseStateIdentity = 2407, | 143 kMachMessageIDMachExceptionRaiseStateIdentity = 2407, |
144 }; | 144 }; |
145 | 145 |
146 // The MIG-generated __MIG_check__Request__*() functions are not declared as | |
Robert Sesek
2014/09/10 21:56:45
Could you do this in the mig.py script instead, an
Mark Mentovai
2014/09/10 22:35:01
rsesek wrote:
| |
147 // accepting const data, but they could have been because they in fact do not | |
148 // modify the data. These wrapper functions are provided to bridge the const gap | |
149 // between the code in this file, which is const-correct and treats request | |
150 // message data as const, and those generated functions. | |
151 | |
152 kern_return_t MIGCheckRequestExceptionRaise( | |
153 const __Request__exception_raise_t* in_request) { | |
154 typedef __Request__exception_raise_t Request; | |
155 return __MIG_check__Request__exception_raise_t( | |
156 const_cast<Request*>(in_request)); | |
157 } | |
158 | |
159 kern_return_t MIGCheckRequestExceptionRaiseState( | |
160 const __Request__exception_raise_state_t* in_request, | |
161 const __Request__exception_raise_state_t** in_request_1) { | |
162 typedef __Request__exception_raise_state_t Request; | |
163 return __MIG_check__Request__exception_raise_state_t( | |
164 const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); | |
165 } | |
166 | |
167 kern_return_t MIGCheckRequestExceptionRaiseStateIdentity( | |
168 const __Request__exception_raise_state_identity_t* in_request, | |
169 const __Request__exception_raise_state_identity_t** in_request_1) { | |
170 typedef __Request__exception_raise_state_identity_t Request; | |
171 return __MIG_check__Request__exception_raise_state_identity_t( | |
172 const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); | |
173 } | |
174 | |
175 kern_return_t MIGCheckRequestMachExceptionRaise( | |
176 const __Request__mach_exception_raise_t* in_request) { | |
177 typedef __Request__mach_exception_raise_t Request; | |
178 return __MIG_check__Request__mach_exception_raise_t( | |
179 const_cast<Request*>(in_request)); | |
180 } | |
181 | |
182 kern_return_t MIGCheckRequestMachExceptionRaiseState( | |
183 const __Request__mach_exception_raise_state_t* in_request, | |
184 const __Request__mach_exception_raise_state_t** in_request_1) { | |
185 typedef __Request__mach_exception_raise_state_t Request; | |
186 return __MIG_check__Request__mach_exception_raise_state_t( | |
187 const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); | |
188 } | |
189 | |
190 kern_return_t MIGCheckRequestMachExceptionRaiseStateIdentity( | |
191 const __Request__mach_exception_raise_state_identity_t* in_request, | |
192 const __Request__mach_exception_raise_state_identity_t** in_request_1) { | |
193 typedef __Request__mach_exception_raise_state_identity_t Request; | |
194 return __MIG_check__Request__mach_exception_raise_state_identity_t( | |
195 const_cast<Request*>(in_request), const_cast<Request**>(in_request_1)); | |
196 } | |
197 | |
146 } // namespace | 198 } // namespace |
147 | 199 |
148 namespace crashpad { | 200 namespace crashpad { |
149 namespace internal { | 201 namespace internal { |
150 | 202 |
151 ExcServer::ExcServer(ExcServer::Interface* interface) | 203 ExcServer::ExcServer(ExcServer::Interface* interface) |
152 : MachMessageServer::Interface(), | 204 : MachMessageServer::Interface(), |
153 interface_(interface) { | 205 interface_(interface) { |
154 } | 206 } |
155 | 207 |
156 bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header, | 208 bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, |
157 mach_msg_header_t* out_header, | 209 mach_msg_header_t* out_header, |
158 bool* destroy_complex_request) { | 210 bool* destroy_complex_request) { |
159 PrepareReplyFromRequest(in_header, out_header); | 211 PrepareReplyFromRequest(in_header, out_header); |
160 | 212 |
161 switch (in_header->msgh_id) { | 213 switch (in_header->msgh_id) { |
162 case kMachMessageIDExceptionRaise: { | 214 case kMachMessageIDExceptionRaise: { |
163 // exception_raise(), catch_exception_raise(). | 215 // exception_raise(), catch_exception_raise(). |
164 typedef __Request__exception_raise_t Request; | 216 typedef __Request__exception_raise_t Request; |
165 Request* in_request = reinterpret_cast<Request*>(in_header); | 217 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
166 kern_return_t kr = __MIG_check__Request__exception_raise_t(in_request); | 218 kern_return_t kr = MIGCheckRequestExceptionRaise(in_request); |
167 if (kr != MACH_MSG_SUCCESS) { | 219 if (kr != MACH_MSG_SUCCESS) { |
168 SetReplyError(out_header, kr); | 220 SetReplyError(out_header, kr); |
169 return true; | 221 return true; |
170 } | 222 } |
171 | 223 |
172 typedef __Reply__exception_raise_t Reply; | 224 typedef __Reply__exception_raise_t Reply; |
173 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 225 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
174 out_reply->RetCode = | 226 out_reply->RetCode = |
175 interface_->CatchExceptionRaise(in_header->msgh_local_port, | 227 interface_->CatchExceptionRaise(in_header->msgh_local_port, |
176 in_request->thread.name, | 228 in_request->thread.name, |
177 in_request->task.name, | 229 in_request->task.name, |
178 in_request->exception, | 230 in_request->exception, |
179 in_request->code, | 231 in_request->code, |
180 in_request->codeCnt, | 232 in_request->codeCnt, |
181 destroy_complex_request); | 233 destroy_complex_request); |
182 if (out_reply->RetCode != KERN_SUCCESS) { | 234 if (out_reply->RetCode != KERN_SUCCESS) { |
183 return true; | 235 return true; |
184 } | 236 } |
185 | 237 |
186 out_header->msgh_size = sizeof(*out_reply); | 238 out_header->msgh_size = sizeof(*out_reply); |
187 return true; | 239 return true; |
188 } | 240 } |
189 | 241 |
190 case kMachMessageIDExceptionRaiseState: { | 242 case kMachMessageIDExceptionRaiseState: { |
191 // exception_raise_state(), catch_exception_raise_state(). | 243 // exception_raise_state(), catch_exception_raise_state(). |
192 typedef __Request__exception_raise_state_t Request; | 244 typedef __Request__exception_raise_state_t Request; |
193 Request* in_request = reinterpret_cast<Request*>(in_header); | 245 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
194 | 246 |
195 // in_request_1 is used for the portion of the request after the codes, | 247 // in_request_1 is used for the portion of the request after the codes, |
196 // which in theory can be variable-length. The check function will set it. | 248 // which in theory can be variable-length. The check function will set it. |
197 Request* in_request_1; | 249 const Request* in_request_1; |
198 kern_return_t kr = __MIG_check__Request__exception_raise_state_t( | 250 kern_return_t kr = MIGCheckRequestExceptionRaiseState( |
199 in_request, &in_request_1); | 251 in_request, &in_request_1); |
200 if (kr != MACH_MSG_SUCCESS) { | 252 if (kr != MACH_MSG_SUCCESS) { |
201 SetReplyError(out_header, kr); | 253 SetReplyError(out_header, kr); |
202 return true; | 254 return true; |
203 } | 255 } |
204 | 256 |
205 typedef __Reply__exception_raise_state_t Reply; | 257 typedef __Reply__exception_raise_state_t Reply; |
206 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 258 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
259 out_reply->flavor = in_request_1->flavor; | |
207 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 260 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
208 out_reply->RetCode = | 261 out_reply->RetCode = |
209 interface_->CatchExceptionRaiseState(in_header->msgh_local_port, | 262 interface_->CatchExceptionRaiseState(in_header->msgh_local_port, |
210 in_request->exception, | 263 in_request->exception, |
211 in_request->code, | 264 in_request->code, |
212 in_request->codeCnt, | 265 in_request->codeCnt, |
213 &in_request_1->flavor, | 266 &out_reply->flavor, |
214 in_request_1->old_state, | 267 in_request_1->old_state, |
215 in_request_1->old_stateCnt, | 268 in_request_1->old_stateCnt, |
216 out_reply->new_state, | 269 out_reply->new_state, |
217 &out_reply->new_stateCnt); | 270 &out_reply->new_stateCnt); |
218 if (out_reply->RetCode != KERN_SUCCESS) { | 271 if (out_reply->RetCode != KERN_SUCCESS) { |
219 return true; | 272 return true; |
220 } | 273 } |
221 | 274 |
222 out_reply->flavor = in_request_1->flavor; | |
223 out_header->msgh_size = | 275 out_header->msgh_size = |
224 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 276 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
225 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 277 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
226 return true; | 278 return true; |
227 } | 279 } |
228 | 280 |
229 case kMachMessageIDExceptionRaiseStateIdentity: { | 281 case kMachMessageIDExceptionRaiseStateIdentity: { |
230 // exception_raise_state_identity(), | 282 // exception_raise_state_identity(), |
231 // catch_exception_raise_state_identity(). | 283 // catch_exception_raise_state_identity(). |
232 typedef __Request__exception_raise_state_identity_t Request; | 284 typedef __Request__exception_raise_state_identity_t Request; |
233 Request* in_request = reinterpret_cast<Request*>(in_header); | 285 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
234 | 286 |
235 // in_request_1 is used for the portion of the request after the codes, | 287 // in_request_1 is used for the portion of the request after the codes, |
236 // which in theory can be variable-length. The check function will set it. | 288 // which in theory can be variable-length. The check function will set it. |
237 Request* in_request_1; | 289 const Request* in_request_1; |
238 kern_return_t kr = __MIG_check__Request__exception_raise_state_identity_t( | 290 kern_return_t kr = MIGCheckRequestExceptionRaiseStateIdentity( |
239 in_request, &in_request_1); | 291 in_request, &in_request_1); |
240 if (kr != MACH_MSG_SUCCESS) { | 292 if (kr != MACH_MSG_SUCCESS) { |
241 SetReplyError(out_header, kr); | 293 SetReplyError(out_header, kr); |
242 return true; | 294 return true; |
243 } | 295 } |
244 | 296 |
245 typedef __Reply__exception_raise_state_identity_t Reply; | 297 typedef __Reply__exception_raise_state_identity_t Reply; |
246 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 298 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
299 out_reply->flavor = in_request_1->flavor; | |
247 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 300 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
248 out_reply->RetCode = interface_->CatchExceptionRaiseStateIdentity( | 301 out_reply->RetCode = interface_->CatchExceptionRaiseStateIdentity( |
249 in_header->msgh_local_port, | 302 in_header->msgh_local_port, |
250 in_request->thread.name, | 303 in_request->thread.name, |
251 in_request->task.name, | 304 in_request->task.name, |
252 in_request->exception, | 305 in_request->exception, |
253 in_request->code, | 306 in_request->code, |
254 in_request->codeCnt, | 307 in_request->codeCnt, |
255 &in_request_1->flavor, | 308 &out_reply->flavor, |
256 in_request_1->old_state, | 309 in_request_1->old_state, |
257 in_request_1->old_stateCnt, | 310 in_request_1->old_stateCnt, |
258 out_reply->new_state, | 311 out_reply->new_state, |
259 &out_reply->new_stateCnt, | 312 &out_reply->new_stateCnt, |
260 destroy_complex_request); | 313 destroy_complex_request); |
261 if (out_reply->RetCode != KERN_SUCCESS) { | 314 if (out_reply->RetCode != KERN_SUCCESS) { |
262 return true; | 315 return true; |
263 } | 316 } |
264 | 317 |
265 out_reply->flavor = in_request_1->flavor; | |
266 out_header->msgh_size = | 318 out_header->msgh_size = |
267 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 319 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
268 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 320 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
269 return true; | 321 return true; |
270 } | 322 } |
271 } | 323 } |
272 | 324 |
273 SetReplyError(out_header, MIG_BAD_ID); | 325 SetReplyError(out_header, MIG_BAD_ID); |
274 return false; | 326 return false; |
275 } | 327 } |
276 | 328 |
277 mach_msg_size_t ExcServer::MachMessageServerRequestSize() { | 329 mach_msg_size_t ExcServer::MachMessageServerRequestSize() { |
278 return sizeof(__RequestUnion__exc_subsystem); | 330 return sizeof(__RequestUnion__exc_subsystem); |
279 } | 331 } |
280 | 332 |
281 mach_msg_size_t ExcServer::MachMessageServerReplySize() { | 333 mach_msg_size_t ExcServer::MachMessageServerReplySize() { |
282 return sizeof(__ReplyUnion__exc_subsystem); | 334 return sizeof(__ReplyUnion__exc_subsystem); |
283 } | 335 } |
284 | 336 |
285 MachExcServer::MachExcServer(MachExcServer::Interface* interface) | 337 MachExcServer::MachExcServer(MachExcServer::Interface* interface) |
286 : MachMessageServer::Interface(), | 338 : MachMessageServer::Interface(), |
287 interface_(interface) { | 339 interface_(interface) { |
288 } | 340 } |
289 | 341 |
290 bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header, | 342 bool MachExcServer::MachMessageServerFunction( |
291 mach_msg_header_t* out_header, | 343 const mach_msg_header_t* in_header, |
292 bool* destroy_complex_request) { | 344 mach_msg_header_t* out_header, |
345 bool* destroy_complex_request) { | |
293 PrepareReplyFromRequest(in_header, out_header); | 346 PrepareReplyFromRequest(in_header, out_header); |
294 | 347 |
295 switch (in_header->msgh_id) { | 348 switch (in_header->msgh_id) { |
296 case kMachMessageIDMachExceptionRaise: { | 349 case kMachMessageIDMachExceptionRaise: { |
297 // mach_exception_raise(), catch_mach_exception_raise(). | 350 // mach_exception_raise(), catch_mach_exception_raise(). |
298 typedef __Request__mach_exception_raise_t Request; | 351 typedef __Request__mach_exception_raise_t Request; |
299 Request* in_request = reinterpret_cast<Request*>(in_header); | 352 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
300 kern_return_t kr = | 353 kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request); |
301 __MIG_check__Request__mach_exception_raise_t(in_request); | |
302 if (kr != MACH_MSG_SUCCESS) { | 354 if (kr != MACH_MSG_SUCCESS) { |
303 SetReplyError(out_header, kr); | 355 SetReplyError(out_header, kr); |
304 return true; | 356 return true; |
305 } | 357 } |
306 | 358 |
307 typedef __Reply__mach_exception_raise_t Reply; | 359 typedef __Reply__mach_exception_raise_t Reply; |
308 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 360 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
309 out_reply->RetCode = | 361 out_reply->RetCode = |
310 interface_->CatchMachExceptionRaise(in_header->msgh_local_port, | 362 interface_->CatchMachExceptionRaise(in_header->msgh_local_port, |
311 in_request->thread.name, | 363 in_request->thread.name, |
312 in_request->task.name, | 364 in_request->task.name, |
313 in_request->exception, | 365 in_request->exception, |
314 in_request->code, | 366 in_request->code, |
315 in_request->codeCnt, | 367 in_request->codeCnt, |
316 destroy_complex_request); | 368 destroy_complex_request); |
317 if (out_reply->RetCode != KERN_SUCCESS) { | 369 if (out_reply->RetCode != KERN_SUCCESS) { |
318 return true; | 370 return true; |
319 } | 371 } |
320 | 372 |
321 out_header->msgh_size = sizeof(*out_reply); | 373 out_header->msgh_size = sizeof(*out_reply); |
322 return true; | 374 return true; |
323 } | 375 } |
324 | 376 |
325 case kMachMessageIDMachExceptionRaiseState: { | 377 case kMachMessageIDMachExceptionRaiseState: { |
326 // mach_exception_raise_state(), catch_mach_exception_raise_state(). | 378 // mach_exception_raise_state(), catch_mach_exception_raise_state(). |
327 typedef __Request__mach_exception_raise_state_t Request; | 379 typedef __Request__mach_exception_raise_state_t Request; |
328 Request* in_request = reinterpret_cast<Request*>(in_header); | 380 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
329 | 381 |
330 // in_request_1 is used for the portion of the request after the codes, | 382 // in_request_1 is used for the portion of the request after the codes, |
331 // which in theory can be variable-length. The check function will set it. | 383 // which in theory can be variable-length. The check function will set it. |
332 Request* in_request_1; | 384 const Request* in_request_1; |
333 kern_return_t kr = __MIG_check__Request__mach_exception_raise_state_t( | 385 kern_return_t kr = MIGCheckRequestMachExceptionRaiseState( |
334 in_request, &in_request_1); | 386 in_request, &in_request_1); |
335 if (kr != MACH_MSG_SUCCESS) { | 387 if (kr != MACH_MSG_SUCCESS) { |
336 SetReplyError(out_header, kr); | 388 SetReplyError(out_header, kr); |
337 return true; | 389 return true; |
338 } | 390 } |
339 | 391 |
340 typedef __Reply__mach_exception_raise_state_t Reply; | 392 typedef __Reply__mach_exception_raise_state_t Reply; |
341 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 393 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
394 out_reply->flavor = in_request_1->flavor; | |
342 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 395 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
343 out_reply->RetCode = | 396 out_reply->RetCode = |
344 interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port, | 397 interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port, |
345 in_request->exception, | 398 in_request->exception, |
346 in_request->code, | 399 in_request->code, |
347 in_request->codeCnt, | 400 in_request->codeCnt, |
348 &in_request_1->flavor, | 401 &out_reply->flavor, |
349 in_request_1->old_state, | 402 in_request_1->old_state, |
350 in_request_1->old_stateCnt, | 403 in_request_1->old_stateCnt, |
351 out_reply->new_state, | 404 out_reply->new_state, |
352 &out_reply->new_stateCnt); | 405 &out_reply->new_stateCnt); |
353 if (out_reply->RetCode != KERN_SUCCESS) { | 406 if (out_reply->RetCode != KERN_SUCCESS) { |
354 return true; | 407 return true; |
355 } | 408 } |
356 | 409 |
357 out_reply->flavor = in_request_1->flavor; | |
358 out_header->msgh_size = | 410 out_header->msgh_size = |
359 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 411 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
360 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 412 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
361 return true; | 413 return true; |
362 } | 414 } |
363 | 415 |
364 case kMachMessageIDMachExceptionRaiseStateIdentity: { | 416 case kMachMessageIDMachExceptionRaiseStateIdentity: { |
365 // mach_exception_raise_state_identity(), | 417 // mach_exception_raise_state_identity(), |
366 // catch_mach_exception_raise_state_identity(). | 418 // catch_mach_exception_raise_state_identity(). |
367 typedef __Request__mach_exception_raise_state_identity_t Request; | 419 typedef __Request__mach_exception_raise_state_identity_t Request; |
368 Request* in_request = reinterpret_cast<Request*>(in_header); | 420 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
369 | 421 |
370 // in_request_1 is used for the portion of the request after the codes, | 422 // in_request_1 is used for the portion of the request after the codes, |
371 // which in theory can be variable-length. The check function will set it. | 423 // which in theory can be variable-length. The check function will set it. |
372 Request* in_request_1; | 424 const Request* in_request_1; |
373 kern_return_t kr = | 425 kern_return_t kr = MIGCheckRequestMachExceptionRaiseStateIdentity( |
374 __MIG_check__Request__mach_exception_raise_state_identity_t( | 426 in_request, &in_request_1); |
375 in_request, &in_request_1); | |
376 if (kr != MACH_MSG_SUCCESS) { | 427 if (kr != MACH_MSG_SUCCESS) { |
377 SetReplyError(out_header, kr); | 428 SetReplyError(out_header, kr); |
378 return true; | 429 return true; |
379 } | 430 } |
380 | 431 |
381 typedef __Reply__mach_exception_raise_state_identity_t Reply; | 432 typedef __Reply__mach_exception_raise_state_identity_t Reply; |
382 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 433 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
434 out_reply->flavor = in_request_1->flavor; | |
383 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 435 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
384 out_reply->RetCode = interface_->CatchMachExceptionRaiseStateIdentity( | 436 out_reply->RetCode = interface_->CatchMachExceptionRaiseStateIdentity( |
385 in_header->msgh_local_port, | 437 in_header->msgh_local_port, |
386 in_request->thread.name, | 438 in_request->thread.name, |
387 in_request->task.name, | 439 in_request->task.name, |
388 in_request->exception, | 440 in_request->exception, |
389 in_request->code, | 441 in_request->code, |
390 in_request->codeCnt, | 442 in_request->codeCnt, |
391 &in_request_1->flavor, | 443 &out_reply->flavor, |
392 in_request_1->old_state, | 444 in_request_1->old_state, |
393 in_request_1->old_stateCnt, | 445 in_request_1->old_stateCnt, |
394 out_reply->new_state, | 446 out_reply->new_state, |
395 &out_reply->new_stateCnt, | 447 &out_reply->new_stateCnt, |
396 destroy_complex_request); | 448 destroy_complex_request); |
397 if (out_reply->RetCode != KERN_SUCCESS) { | 449 if (out_reply->RetCode != KERN_SUCCESS) { |
398 return true; | 450 return true; |
399 } | 451 } |
400 | 452 |
401 out_reply->flavor = in_request_1->flavor; | |
402 out_header->msgh_size = | 453 out_header->msgh_size = |
403 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 454 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
404 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 455 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
405 return true; | 456 return true; |
406 } | 457 } |
407 } | 458 } |
408 | 459 |
409 SetReplyError(out_header, MIG_BAD_ID); | 460 SetReplyError(out_header, MIG_BAD_ID); |
410 return false; | 461 return false; |
411 } | 462 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 | 647 |
597 UniversalMachExcServer::UniversalMachExcServer() | 648 UniversalMachExcServer::UniversalMachExcServer() |
598 : MachMessageServer::Interface(), | 649 : MachMessageServer::Interface(), |
599 internal::SimplifiedExcServer::Interface(), | 650 internal::SimplifiedExcServer::Interface(), |
600 internal::SimplifiedMachExcServer::Interface(), | 651 internal::SimplifiedMachExcServer::Interface(), |
601 exc_server_(this), | 652 exc_server_(this), |
602 mach_exc_server_(this) { | 653 mach_exc_server_(this) { |
603 } | 654 } |
604 | 655 |
605 bool UniversalMachExcServer::MachMessageServerFunction( | 656 bool UniversalMachExcServer::MachMessageServerFunction( |
606 mach_msg_header_t* in_header, | 657 const mach_msg_header_t* in_header, |
607 mach_msg_header_t* out_header, | 658 mach_msg_header_t* out_header, |
608 bool* destroy_complex_request) { | 659 bool* destroy_complex_request) { |
609 switch (in_header->msgh_id) { | 660 switch (in_header->msgh_id) { |
610 case kMachMessageIDMachExceptionRaise: | 661 case kMachMessageIDMachExceptionRaise: |
611 case kMachMessageIDMachExceptionRaiseState: | 662 case kMachMessageIDMachExceptionRaiseState: |
612 case kMachMessageIDMachExceptionRaiseStateIdentity: | 663 case kMachMessageIDMachExceptionRaiseStateIdentity: |
613 return mach_exc_server_.MachMessageServerFunction( | 664 return mach_exc_server_.MachMessageServerFunction( |
614 in_header, out_header, destroy_complex_request); | 665 in_header, out_header, destroy_complex_request); |
615 case kMachMessageIDExceptionRaise: | 666 case kMachMessageIDExceptionRaise: |
616 case kMachMessageIDExceptionRaiseState: | 667 case kMachMessageIDExceptionRaiseState: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 code_count, | 716 code_count, |
666 flavor, | 717 flavor, |
667 old_state, | 718 old_state, |
668 old_state_count, | 719 old_state_count, |
669 new_state, | 720 new_state, |
670 new_state_count, | 721 new_state_count, |
671 destroy_complex_request); | 722 destroy_complex_request); |
672 } | 723 } |
673 | 724 |
674 } // namespace crashpad | 725 } // namespace crashpad |
OLD | NEW |