| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ExcServer::ExcServer(ExcServer::Interface* interface) | 189 ExcServer::ExcServer(ExcServer::Interface* interface) |
| 190 : MachMessageServer::Interface(), | 190 : MachMessageServer::Interface(), |
| 191 interface_(interface) { | 191 interface_(interface) { |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, | 194 bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header, |
| 195 mach_msg_header_t* out_header, | 195 mach_msg_header_t* out_header, |
| 196 bool* destroy_complex_request) { | 196 bool* destroy_complex_request) { |
| 197 PrepareMIGReplyFromRequest(in_header, out_header); | 197 PrepareMIGReplyFromRequest(in_header, out_header); |
| 198 | 198 |
| 199 const mach_msg_trailer_t* in_trailer = |
| 200 MachMessageTrailerFromHeader(in_header); |
| 201 |
| 199 switch (in_header->msgh_id) { | 202 switch (in_header->msgh_id) { |
| 200 case kMachMessageIDExceptionRaise: { | 203 case kMachMessageIDExceptionRaise: { |
| 201 // exception_raise(), catch_exception_raise(). | 204 // exception_raise(), catch_exception_raise(). |
| 202 using Request = __Request__exception_raise_t; | 205 using Request = __Request__exception_raise_t; |
| 203 const Request* in_request = reinterpret_cast<const Request*>(in_header); | 206 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
| 204 kern_return_t kr = MIGCheckRequestExceptionRaise(in_request); | 207 kern_return_t kr = MIGCheckRequestExceptionRaise(in_request); |
| 205 if (kr != MACH_MSG_SUCCESS) { | 208 if (kr != MACH_MSG_SUCCESS) { |
| 206 SetMIGReplyError(out_header, kr); | 209 SetMIGReplyError(out_header, kr); |
| 207 return true; | 210 return true; |
| 208 } | 211 } |
| 209 | 212 |
| 210 using Reply = __Reply__exception_raise_t; | 213 using Reply = __Reply__exception_raise_t; |
| 211 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 214 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
| 212 out_reply->RetCode = | 215 out_reply->RetCode = |
| 213 interface_->CatchExceptionRaise(in_header->msgh_local_port, | 216 interface_->CatchExceptionRaise(in_header->msgh_local_port, |
| 214 in_request->thread.name, | 217 in_request->thread.name, |
| 215 in_request->task.name, | 218 in_request->task.name, |
| 216 in_request->exception, | 219 in_request->exception, |
| 217 in_request->code, | 220 in_request->code, |
| 218 in_request->codeCnt, | 221 in_request->codeCnt, |
| 222 in_trailer, |
| 219 destroy_complex_request); | 223 destroy_complex_request); |
| 220 if (out_reply->RetCode != KERN_SUCCESS) { | 224 if (out_reply->RetCode != KERN_SUCCESS) { |
| 221 return true; | 225 return true; |
| 222 } | 226 } |
| 223 | 227 |
| 224 out_header->msgh_size = sizeof(*out_reply); | 228 out_header->msgh_size = sizeof(*out_reply); |
| 225 return true; | 229 return true; |
| 226 } | 230 } |
| 227 | 231 |
| 228 case kMachMessageIDExceptionRaiseState: { | 232 case kMachMessageIDExceptionRaiseState: { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 246 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 250 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
| 247 out_reply->RetCode = | 251 out_reply->RetCode = |
| 248 interface_->CatchExceptionRaiseState(in_header->msgh_local_port, | 252 interface_->CatchExceptionRaiseState(in_header->msgh_local_port, |
| 249 in_request->exception, | 253 in_request->exception, |
| 250 in_request->code, | 254 in_request->code, |
| 251 in_request->codeCnt, | 255 in_request->codeCnt, |
| 252 &out_reply->flavor, | 256 &out_reply->flavor, |
| 253 in_request_1->old_state, | 257 in_request_1->old_state, |
| 254 in_request_1->old_stateCnt, | 258 in_request_1->old_stateCnt, |
| 255 out_reply->new_state, | 259 out_reply->new_state, |
| 256 &out_reply->new_stateCnt); | 260 &out_reply->new_stateCnt, |
| 261 in_trailer); |
| 257 if (out_reply->RetCode != KERN_SUCCESS) { | 262 if (out_reply->RetCode != KERN_SUCCESS) { |
| 258 return true; | 263 return true; |
| 259 } | 264 } |
| 260 | 265 |
| 261 out_header->msgh_size = | 266 out_header->msgh_size = |
| 262 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 267 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
| 263 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 268 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
| 264 return true; | 269 return true; |
| 265 } | 270 } |
| 266 | 271 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 289 in_request->thread.name, | 294 in_request->thread.name, |
| 290 in_request->task.name, | 295 in_request->task.name, |
| 291 in_request->exception, | 296 in_request->exception, |
| 292 in_request->code, | 297 in_request->code, |
| 293 in_request->codeCnt, | 298 in_request->codeCnt, |
| 294 &out_reply->flavor, | 299 &out_reply->flavor, |
| 295 in_request_1->old_state, | 300 in_request_1->old_state, |
| 296 in_request_1->old_stateCnt, | 301 in_request_1->old_stateCnt, |
| 297 out_reply->new_state, | 302 out_reply->new_state, |
| 298 &out_reply->new_stateCnt, | 303 &out_reply->new_stateCnt, |
| 304 in_trailer, |
| 299 destroy_complex_request); | 305 destroy_complex_request); |
| 300 if (out_reply->RetCode != KERN_SUCCESS) { | 306 if (out_reply->RetCode != KERN_SUCCESS) { |
| 301 return true; | 307 return true; |
| 302 } | 308 } |
| 303 | 309 |
| 304 out_header->msgh_size = | 310 out_header->msgh_size = |
| 305 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 311 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
| 306 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 312 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
| 307 return true; | 313 return true; |
| 308 } | 314 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 324 : MachMessageServer::Interface(), | 330 : MachMessageServer::Interface(), |
| 325 interface_(interface) { | 331 interface_(interface) { |
| 326 } | 332 } |
| 327 | 333 |
| 328 bool MachExcServer::MachMessageServerFunction( | 334 bool MachExcServer::MachMessageServerFunction( |
| 329 const mach_msg_header_t* in_header, | 335 const mach_msg_header_t* in_header, |
| 330 mach_msg_header_t* out_header, | 336 mach_msg_header_t* out_header, |
| 331 bool* destroy_complex_request) { | 337 bool* destroy_complex_request) { |
| 332 PrepareMIGReplyFromRequest(in_header, out_header); | 338 PrepareMIGReplyFromRequest(in_header, out_header); |
| 333 | 339 |
| 340 const mach_msg_trailer_t* in_trailer = |
| 341 MachMessageTrailerFromHeader(in_header); |
| 342 |
| 334 switch (in_header->msgh_id) { | 343 switch (in_header->msgh_id) { |
| 335 case kMachMessageIDMachExceptionRaise: { | 344 case kMachMessageIDMachExceptionRaise: { |
| 336 // mach_exception_raise(), catch_mach_exception_raise(). | 345 // mach_exception_raise(), catch_mach_exception_raise(). |
| 337 using Request = __Request__mach_exception_raise_t; | 346 using Request = __Request__mach_exception_raise_t; |
| 338 const Request* in_request = reinterpret_cast<const Request*>(in_header); | 347 const Request* in_request = reinterpret_cast<const Request*>(in_header); |
| 339 kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request); | 348 kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request); |
| 340 if (kr != MACH_MSG_SUCCESS) { | 349 if (kr != MACH_MSG_SUCCESS) { |
| 341 SetMIGReplyError(out_header, kr); | 350 SetMIGReplyError(out_header, kr); |
| 342 return true; | 351 return true; |
| 343 } | 352 } |
| 344 | 353 |
| 345 using Reply = __Reply__mach_exception_raise_t; | 354 using Reply = __Reply__mach_exception_raise_t; |
| 346 Reply* out_reply = reinterpret_cast<Reply*>(out_header); | 355 Reply* out_reply = reinterpret_cast<Reply*>(out_header); |
| 347 out_reply->RetCode = | 356 out_reply->RetCode = |
| 348 interface_->CatchMachExceptionRaise(in_header->msgh_local_port, | 357 interface_->CatchMachExceptionRaise(in_header->msgh_local_port, |
| 349 in_request->thread.name, | 358 in_request->thread.name, |
| 350 in_request->task.name, | 359 in_request->task.name, |
| 351 in_request->exception, | 360 in_request->exception, |
| 352 in_request->code, | 361 in_request->code, |
| 353 in_request->codeCnt, | 362 in_request->codeCnt, |
| 363 in_trailer, |
| 354 destroy_complex_request); | 364 destroy_complex_request); |
| 355 if (out_reply->RetCode != KERN_SUCCESS) { | 365 if (out_reply->RetCode != KERN_SUCCESS) { |
| 356 return true; | 366 return true; |
| 357 } | 367 } |
| 358 | 368 |
| 359 out_header->msgh_size = sizeof(*out_reply); | 369 out_header->msgh_size = sizeof(*out_reply); |
| 360 return true; | 370 return true; |
| 361 } | 371 } |
| 362 | 372 |
| 363 case kMachMessageIDMachExceptionRaiseState: { | 373 case kMachMessageIDMachExceptionRaiseState: { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 381 out_reply->new_stateCnt = arraysize(out_reply->new_state); | 391 out_reply->new_stateCnt = arraysize(out_reply->new_state); |
| 382 out_reply->RetCode = | 392 out_reply->RetCode = |
| 383 interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port, | 393 interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port, |
| 384 in_request->exception, | 394 in_request->exception, |
| 385 in_request->code, | 395 in_request->code, |
| 386 in_request->codeCnt, | 396 in_request->codeCnt, |
| 387 &out_reply->flavor, | 397 &out_reply->flavor, |
| 388 in_request_1->old_state, | 398 in_request_1->old_state, |
| 389 in_request_1->old_stateCnt, | 399 in_request_1->old_stateCnt, |
| 390 out_reply->new_state, | 400 out_reply->new_state, |
| 391 &out_reply->new_stateCnt); | 401 &out_reply->new_stateCnt, |
| 402 in_trailer); |
| 392 if (out_reply->RetCode != KERN_SUCCESS) { | 403 if (out_reply->RetCode != KERN_SUCCESS) { |
| 393 return true; | 404 return true; |
| 394 } | 405 } |
| 395 | 406 |
| 396 out_header->msgh_size = | 407 out_header->msgh_size = |
| 397 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 408 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
| 398 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 409 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
| 399 return true; | 410 return true; |
| 400 } | 411 } |
| 401 | 412 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 424 in_request->thread.name, | 435 in_request->thread.name, |
| 425 in_request->task.name, | 436 in_request->task.name, |
| 426 in_request->exception, | 437 in_request->exception, |
| 427 in_request->code, | 438 in_request->code, |
| 428 in_request->codeCnt, | 439 in_request->codeCnt, |
| 429 &out_reply->flavor, | 440 &out_reply->flavor, |
| 430 in_request_1->old_state, | 441 in_request_1->old_state, |
| 431 in_request_1->old_stateCnt, | 442 in_request_1->old_stateCnt, |
| 432 out_reply->new_state, | 443 out_reply->new_state, |
| 433 &out_reply->new_stateCnt, | 444 &out_reply->new_stateCnt, |
| 445 in_trailer, |
| 434 destroy_complex_request); | 446 destroy_complex_request); |
| 435 if (out_reply->RetCode != KERN_SUCCESS) { | 447 if (out_reply->RetCode != KERN_SUCCESS) { |
| 436 return true; | 448 return true; |
| 437 } | 449 } |
| 438 | 450 |
| 439 out_header->msgh_size = | 451 out_header->msgh_size = |
| 440 sizeof(*out_reply) - sizeof(out_reply->new_state) + | 452 sizeof(*out_reply) - sizeof(out_reply->new_state) + |
| 441 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; | 453 sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt; |
| 442 return true; | 454 return true; |
| 443 } | 455 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 462 interface_(interface) { | 474 interface_(interface) { |
| 463 } | 475 } |
| 464 | 476 |
| 465 kern_return_t SimplifiedExcServer::CatchExceptionRaise( | 477 kern_return_t SimplifiedExcServer::CatchExceptionRaise( |
| 466 exception_handler_t exception_port, | 478 exception_handler_t exception_port, |
| 467 thread_t thread, | 479 thread_t thread, |
| 468 task_t task, | 480 task_t task, |
| 469 exception_type_t exception, | 481 exception_type_t exception, |
| 470 const exception_data_type_t* code, | 482 const exception_data_type_t* code, |
| 471 mach_msg_type_number_t code_count, | 483 mach_msg_type_number_t code_count, |
| 484 const mach_msg_trailer_t* trailer, |
| 472 bool* destroy_request) { | 485 bool* destroy_request) { |
| 473 thread_state_flavor_t flavor = THREAD_STATE_NONE; | 486 thread_state_flavor_t flavor = THREAD_STATE_NONE; |
| 474 mach_msg_type_number_t new_state_count = 0; | 487 mach_msg_type_number_t new_state_count = 0; |
| 475 return interface_->CatchException(EXCEPTION_DEFAULT, | 488 return interface_->CatchException(EXCEPTION_DEFAULT, |
| 476 exception_port, | 489 exception_port, |
| 477 thread, | 490 thread, |
| 478 task, | 491 task, |
| 479 exception, | 492 exception, |
| 480 code, | 493 code, |
| 481 code_count, | 494 code_count, |
| 482 &flavor, | 495 &flavor, |
| 483 nullptr, | 496 nullptr, |
| 484 0, | 497 0, |
| 485 nullptr, | 498 nullptr, |
| 486 &new_state_count, | 499 &new_state_count, |
| 500 trailer, |
| 487 destroy_request); | 501 destroy_request); |
| 488 } | 502 } |
| 489 | 503 |
| 490 kern_return_t SimplifiedExcServer::CatchExceptionRaiseState( | 504 kern_return_t SimplifiedExcServer::CatchExceptionRaiseState( |
| 491 exception_handler_t exception_port, | 505 exception_handler_t exception_port, |
| 492 exception_type_t exception, | 506 exception_type_t exception, |
| 493 const exception_data_type_t* code, | 507 const exception_data_type_t* code, |
| 494 mach_msg_type_number_t code_count, | 508 mach_msg_type_number_t code_count, |
| 495 thread_state_flavor_t* flavor, | 509 thread_state_flavor_t* flavor, |
| 496 const natural_t* old_state, | 510 const natural_t* old_state, |
| 497 mach_msg_type_number_t old_state_count, | 511 mach_msg_type_number_t old_state_count, |
| 498 thread_state_t new_state, | 512 thread_state_t new_state, |
| 499 mach_msg_type_number_t* new_state_count) { | 513 mach_msg_type_number_t* new_state_count, |
| 514 const mach_msg_trailer_t* trailer) { |
| 500 bool destroy_complex_request = false; | 515 bool destroy_complex_request = false; |
| 501 return interface_->CatchException(EXCEPTION_STATE, | 516 return interface_->CatchException(EXCEPTION_STATE, |
| 502 exception_port, | 517 exception_port, |
| 503 THREAD_NULL, | 518 THREAD_NULL, |
| 504 TASK_NULL, | 519 TASK_NULL, |
| 505 exception, | 520 exception, |
| 506 code, | 521 code, |
| 507 code_count, | 522 code_count, |
| 508 flavor, | 523 flavor, |
| 509 old_state, | 524 old_state, |
| 510 old_state_count, | 525 old_state_count, |
| 511 new_state, | 526 new_state, |
| 512 new_state_count, | 527 new_state_count, |
| 528 trailer, |
| 513 &destroy_complex_request); | 529 &destroy_complex_request); |
| 514 } | 530 } |
| 515 | 531 |
| 516 kern_return_t SimplifiedExcServer::CatchExceptionRaiseStateIdentity( | 532 kern_return_t SimplifiedExcServer::CatchExceptionRaiseStateIdentity( |
| 517 exception_handler_t exception_port, | 533 exception_handler_t exception_port, |
| 518 thread_t thread, | 534 thread_t thread, |
| 519 task_t task, | 535 task_t task, |
| 520 exception_type_t exception, | 536 exception_type_t exception, |
| 521 const exception_data_type_t* code, | 537 const exception_data_type_t* code, |
| 522 mach_msg_type_number_t code_count, | 538 mach_msg_type_number_t code_count, |
| 523 thread_state_flavor_t* flavor, | 539 thread_state_flavor_t* flavor, |
| 524 const natural_t* old_state, | 540 const natural_t* old_state, |
| 525 mach_msg_type_number_t old_state_count, | 541 mach_msg_type_number_t old_state_count, |
| 526 thread_state_t new_state, | 542 thread_state_t new_state, |
| 527 mach_msg_type_number_t* new_state_count, | 543 mach_msg_type_number_t* new_state_count, |
| 544 const mach_msg_trailer_t* trailer, |
| 528 bool* destroy_request) { | 545 bool* destroy_request) { |
| 529 return interface_->CatchException(EXCEPTION_STATE_IDENTITY, | 546 return interface_->CatchException(EXCEPTION_STATE_IDENTITY, |
| 530 exception_port, | 547 exception_port, |
| 531 thread, | 548 thread, |
| 532 task, | 549 task, |
| 533 exception, | 550 exception, |
| 534 code, | 551 code, |
| 535 code_count, | 552 code_count, |
| 536 flavor, | 553 flavor, |
| 537 old_state, | 554 old_state, |
| 538 old_state_count, | 555 old_state_count, |
| 539 new_state, | 556 new_state, |
| 540 new_state_count, | 557 new_state_count, |
| 558 trailer, |
| 541 destroy_request); | 559 destroy_request); |
| 542 } | 560 } |
| 543 | 561 |
| 544 SimplifiedMachExcServer::SimplifiedMachExcServer( | 562 SimplifiedMachExcServer::SimplifiedMachExcServer( |
| 545 SimplifiedMachExcServer::Interface* interface) | 563 SimplifiedMachExcServer::Interface* interface) |
| 546 : MachExcServer(this), | 564 : MachExcServer(this), |
| 547 MachExcServer::Interface(), | 565 MachExcServer::Interface(), |
| 548 interface_(interface) { | 566 interface_(interface) { |
| 549 } | 567 } |
| 550 | 568 |
| 551 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaise( | 569 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaise( |
| 552 exception_handler_t exception_port, | 570 exception_handler_t exception_port, |
| 553 thread_t thread, | 571 thread_t thread, |
| 554 task_t task, | 572 task_t task, |
| 555 exception_type_t exception, | 573 exception_type_t exception, |
| 556 const mach_exception_data_type_t* code, | 574 const mach_exception_data_type_t* code, |
| 557 mach_msg_type_number_t code_count, | 575 mach_msg_type_number_t code_count, |
| 576 const mach_msg_trailer_t* trailer, |
| 558 bool* destroy_request) { | 577 bool* destroy_request) { |
| 559 thread_state_flavor_t flavor = THREAD_STATE_NONE; | 578 thread_state_flavor_t flavor = THREAD_STATE_NONE; |
| 560 mach_msg_type_number_t new_state_count = 0; | 579 mach_msg_type_number_t new_state_count = 0; |
| 561 return interface_->CatchMachException( | 580 return interface_->CatchMachException( |
| 562 EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, | 581 EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, |
| 563 exception_port, | 582 exception_port, |
| 564 thread, | 583 thread, |
| 565 task, | 584 task, |
| 566 exception, | 585 exception, |
| 567 code, | 586 code, |
| 568 code_count, | 587 code_count, |
| 569 &flavor, | 588 &flavor, |
| 570 nullptr, | 589 nullptr, |
| 571 0, | 590 0, |
| 572 nullptr, | 591 nullptr, |
| 573 &new_state_count, | 592 &new_state_count, |
| 593 trailer, |
| 574 destroy_request); | 594 destroy_request); |
| 575 } | 595 } |
| 576 | 596 |
| 577 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaiseState( | 597 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaiseState( |
| 578 exception_handler_t exception_port, | 598 exception_handler_t exception_port, |
| 579 exception_type_t exception, | 599 exception_type_t exception, |
| 580 const mach_exception_data_type_t* code, | 600 const mach_exception_data_type_t* code, |
| 581 mach_msg_type_number_t code_count, | 601 mach_msg_type_number_t code_count, |
| 582 thread_state_flavor_t* flavor, | 602 thread_state_flavor_t* flavor, |
| 583 const natural_t* old_state, | 603 const natural_t* old_state, |
| 584 mach_msg_type_number_t old_state_count, | 604 mach_msg_type_number_t old_state_count, |
| 585 thread_state_t new_state, | 605 thread_state_t new_state, |
| 586 mach_msg_type_number_t* new_state_count) { | 606 mach_msg_type_number_t* new_state_count, |
| 607 const mach_msg_trailer_t* trailer) { |
| 587 bool destroy_complex_request = false; | 608 bool destroy_complex_request = false; |
| 588 return interface_->CatchMachException(EXCEPTION_STATE | MACH_EXCEPTION_CODES, | 609 return interface_->CatchMachException(EXCEPTION_STATE | MACH_EXCEPTION_CODES, |
| 589 exception_port, | 610 exception_port, |
| 590 THREAD_NULL, | 611 THREAD_NULL, |
| 591 TASK_NULL, | 612 TASK_NULL, |
| 592 exception, | 613 exception, |
| 593 code, | 614 code, |
| 594 code_count, | 615 code_count, |
| 595 flavor, | 616 flavor, |
| 596 old_state, | 617 old_state, |
| 597 old_state_count, | 618 old_state_count, |
| 598 new_state, | 619 new_state, |
| 599 new_state_count, | 620 new_state_count, |
| 621 trailer, |
| 600 &destroy_complex_request); | 622 &destroy_complex_request); |
| 601 } | 623 } |
| 602 | 624 |
| 603 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaiseStateIdentity( | 625 kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaiseStateIdentity( |
| 604 exception_handler_t exception_port, | 626 exception_handler_t exception_port, |
| 605 thread_t thread, | 627 thread_t thread, |
| 606 task_t task, | 628 task_t task, |
| 607 exception_type_t exception, | 629 exception_type_t exception, |
| 608 const mach_exception_data_type_t* code, | 630 const mach_exception_data_type_t* code, |
| 609 mach_msg_type_number_t code_count, | 631 mach_msg_type_number_t code_count, |
| 610 thread_state_flavor_t* flavor, | 632 thread_state_flavor_t* flavor, |
| 611 const natural_t* old_state, | 633 const natural_t* old_state, |
| 612 mach_msg_type_number_t old_state_count, | 634 mach_msg_type_number_t old_state_count, |
| 613 thread_state_t new_state, | 635 thread_state_t new_state, |
| 614 mach_msg_type_number_t* new_state_count, | 636 mach_msg_type_number_t* new_state_count, |
| 637 const mach_msg_trailer_t* trailer, |
| 615 bool* destroy_request) { | 638 bool* destroy_request) { |
| 616 return interface_->CatchMachException( | 639 return interface_->CatchMachException( |
| 617 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, | 640 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, |
| 618 exception_port, | 641 exception_port, |
| 619 thread, | 642 thread, |
| 620 task, | 643 task, |
| 621 exception, | 644 exception, |
| 622 code, | 645 code, |
| 623 code_count, | 646 code_count, |
| 624 flavor, | 647 flavor, |
| 625 old_state, | 648 old_state, |
| 626 old_state_count, | 649 old_state_count, |
| 627 new_state, | 650 new_state, |
| 628 new_state_count, | 651 new_state_count, |
| 652 trailer, |
| 629 destroy_request); | 653 destroy_request); |
| 630 } | 654 } |
| 631 | 655 |
| 632 } // namespace internal | 656 } // namespace internal |
| 633 | 657 |
| 634 UniversalMachExcServer::UniversalMachExcServer() | 658 UniversalMachExcServer::UniversalMachExcServer() |
| 635 : MachMessageServer::Interface(), | 659 : MachMessageServer::Interface(), |
| 636 internal::SimplifiedExcServer::Interface(), | 660 internal::SimplifiedExcServer::Interface(), |
| 637 internal::SimplifiedMachExcServer::Interface(), | 661 internal::SimplifiedMachExcServer::Interface(), |
| 638 exc_server_(this), | 662 exc_server_(this), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 thread_t thread, | 703 thread_t thread, |
| 680 task_t task, | 704 task_t task, |
| 681 exception_type_t exception, | 705 exception_type_t exception, |
| 682 const exception_data_type_t* code, | 706 const exception_data_type_t* code, |
| 683 mach_msg_type_number_t code_count, | 707 mach_msg_type_number_t code_count, |
| 684 thread_state_flavor_t* flavor, | 708 thread_state_flavor_t* flavor, |
| 685 const natural_t* old_state, | 709 const natural_t* old_state, |
| 686 mach_msg_type_number_t old_state_count, | 710 mach_msg_type_number_t old_state_count, |
| 687 thread_state_t new_state, | 711 thread_state_t new_state, |
| 688 mach_msg_type_number_t* new_state_count, | 712 mach_msg_type_number_t* new_state_count, |
| 713 const mach_msg_trailer_t* trailer, |
| 689 bool* destroy_complex_request) { | 714 bool* destroy_complex_request) { |
| 690 std::vector<mach_exception_data_type_t> mach_codes; | 715 std::vector<mach_exception_data_type_t> mach_codes; |
| 691 mach_codes.reserve(code_count); | 716 mach_codes.reserve(code_count); |
| 692 for (size_t index = 0; index < code_count; ++index) { | 717 for (size_t index = 0; index < code_count; ++index) { |
| 693 mach_codes.push_back(code[index]); | 718 mach_codes.push_back(code[index]); |
| 694 } | 719 } |
| 695 | 720 |
| 696 return CatchMachException(behavior, | 721 return CatchMachException(behavior, |
| 697 exception_port, | 722 exception_port, |
| 698 thread, | 723 thread, |
| 699 task, | 724 task, |
| 700 exception, | 725 exception, |
| 701 code_count ? &mach_codes[0] : nullptr, | 726 code_count ? &mach_codes[0] : nullptr, |
| 702 code_count, | 727 code_count, |
| 703 flavor, | 728 flavor, |
| 704 old_state, | 729 old_state, |
| 705 old_state_count, | 730 old_state_count, |
| 706 new_state, | 731 new_state, |
| 707 new_state_count, | 732 new_state_count, |
| 733 trailer, |
| 708 destroy_complex_request); | 734 destroy_complex_request); |
| 709 } | 735 } |
| 710 | 736 |
| 711 exception_type_t ExcCrashRecoverOriginalException( | 737 exception_type_t ExcCrashRecoverOriginalException( |
| 712 mach_exception_code_t code_0, | 738 mach_exception_code_t code_0, |
| 713 mach_exception_code_t* original_code_0, | 739 mach_exception_code_t* original_code_0, |
| 714 int* signal) { | 740 int* signal) { |
| 715 // 10.9.4 xnu-2422.110.17/bsd/kern/kern_exit.c proc_prepareexit() sets code[0] | 741 // 10.9.4 xnu-2422.110.17/bsd/kern/kern_exit.c proc_prepareexit() sets code[0] |
| 716 // based on the signal value, original exception type, and low 20 bits of the | 742 // based on the signal value, original exception type, and low 20 bits of the |
| 717 // original code[0] before calling xnu-2422.110.17/osfmk/kern/exception.c | 743 // original code[0] before calling xnu-2422.110.17/osfmk/kern/exception.c |
| (...skipping 20 matching lines...) Expand all Loading... |
| 738 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, | 764 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, |
| 739 bool set_thread_state) { | 765 bool set_thread_state) { |
| 740 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { | 766 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { |
| 741 return MACH_RCV_PORT_DIED; | 767 return MACH_RCV_PORT_DIED; |
| 742 } | 768 } |
| 743 | 769 |
| 744 return KERN_SUCCESS; | 770 return KERN_SUCCESS; |
| 745 } | 771 } |
| 746 | 772 |
| 747 } // namespace crashpad | 773 } // namespace crashpad |
| OLD | NEW |