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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 mach_msg_type_number_t code_count, | 110 mach_msg_type_number_t code_count, |
111 thread_state_flavor_t* flavor, | 111 thread_state_flavor_t* flavor, |
112 ConstThreadState old_state, | 112 ConstThreadState old_state, |
113 mach_msg_type_number_t old_state_count, | 113 mach_msg_type_number_t old_state_count, |
114 thread_state_t new_state, | 114 thread_state_t new_state, |
115 mach_msg_type_number_t* new_state_count, | 115 mach_msg_type_number_t* new_state_count, |
116 const mach_msg_trailer_t* trailer, | 116 const mach_msg_trailer_t* trailer, |
117 bool* destroy_complex_request) override { | 117 bool* destroy_complex_request) override { |
118 *destroy_complex_request = true; | 118 *destroy_complex_request = true; |
119 | 119 |
120 EXPECT_EQ(ChildTask(), task); | 120 // In 10.12, dyld fatal errors as tested by test_type_ = kCrashDyld are via |
| 121 // abort_with_payload(). In 10.12.1, the task port delivered in an exception |
| 122 // message for this termination type is a corpse, even when the exception is |
| 123 // EXC_CRASH and not EXC_CORPSE_NOTIFY. The corpse task port (here, |task|) |
| 124 // is distinct from the process’ original task port (ChildTask()). This is |
| 125 // filed as https://openradar.appspot.com/29079442. |
| 126 // |
| 127 // Instead of comparing task ports, compare PIDs. |
| 128 pid_t task_pid; |
| 129 kern_return_t kr = pid_for_task(task, &task_pid); |
| 130 EXPECT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "pid_for_task"); |
| 131 EXPECT_EQ(ChildPID(), task_pid); |
121 | 132 |
122 ProcessReader process_reader; | 133 ProcessReader process_reader; |
123 bool rv = process_reader.Initialize(task); | 134 bool rv = process_reader.Initialize(task); |
124 if (!rv) { | 135 if (!rv) { |
125 ADD_FAILURE(); | 136 ADD_FAILURE(); |
126 } else { | 137 } else { |
127 const std::vector<ProcessReader::Module>& modules = | 138 const std::vector<ProcessReader::Module>& modules = |
128 process_reader.Modules(); | 139 process_reader.Modules(); |
129 std::vector<std::string> all_annotations_vector; | 140 std::vector<std::string> all_annotations_vector; |
130 for (const ProcessReader::Module& module : modules) { | 141 for (const ProcessReader::Module& module : modules) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 418 |
408 TEST(MachOImageAnnotationsReader, CrashDyld) { | 419 TEST(MachOImageAnnotationsReader, CrashDyld) { |
409 TestMachOImageAnnotationsReader test_mach_o_image_annotations_reader( | 420 TestMachOImageAnnotationsReader test_mach_o_image_annotations_reader( |
410 TestMachOImageAnnotationsReader::kCrashDyld); | 421 TestMachOImageAnnotationsReader::kCrashDyld); |
411 test_mach_o_image_annotations_reader.Run(); | 422 test_mach_o_image_annotations_reader.Run(); |
412 } | 423 } |
413 | 424 |
414 } // namespace | 425 } // namespace |
415 } // namespace test | 426 } // namespace test |
416 } // namespace crashpad | 427 } // namespace crashpad |
OLD | NEW |