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 code_count); | 110 code_count); |
111 | 111 |
112 for (size_t index = 0; index < code_count; ++index) { | 112 for (size_t index = 0; index < code_count; ++index) { |
113 fprintf(options_.file, | 113 fprintf(options_.file, |
114 "%#llx%s", | 114 "%#llx%s", |
115 code[index], | 115 code[index], |
116 index != code_count - 1 ? ", " : ""); | 116 index != code_count - 1 ? ", " : ""); |
117 } | 117 } |
118 | 118 |
119 if (exception == EXC_CRASH) { | 119 if (exception == EXC_CRASH) { |
120 // 10.9.4 xnu-2422.110.17/bsd/kern/kern_exit.c proc_prepareexit() sets | 120 mach_exception_data_type_t original_code_0; |
121 // code[0] based on the signal value, original exception type, and low 20 | 121 int signal; |
122 // bits of the original code[0] before calling | 122 exception_type_t original_exception = |
123 // xnu-2422.110.17/osfmk/kern/exception.c task_exception_notify() to raise | 123 ExcCrashRecoverOriginalException(code[0], &original_code_0, &signal); |
124 // an EXC_CRASH. | |
125 int sig = (code[0] >> 24) & 0xff; | |
126 int orig_exception = (code[0] >> 20) & 0xf; | |
127 int orig_code_0 = code[0] & 0xfffff; | |
128 fprintf(options_.file, | 124 fprintf(options_.file, |
129 ", original exception %s, original code0 %d, signal %s", | 125 ", original exception %s, original code[0] %lld, signal %s", |
130 ExceptionToString(orig_exception, | 126 ExceptionToString(original_exception, |
131 kUseFullName | kUnknownIsNumeric).c_str(), | 127 kUseFullName | kUnknownIsNumeric).c_str(), |
132 orig_code_0, | 128 original_code_0, |
133 SignalToString(sig, kUseFullName | kUnknownIsNumeric).c_str()); | 129 SignalToString(signal, kUseFullName | kUnknownIsNumeric).c_str()); |
134 } | 130 } |
135 | 131 |
136 fprintf(options_.file, "\n"); | 132 fprintf(options_.file, "\n"); |
137 fflush(options_.file); | 133 fflush(options_.file); |
138 | 134 |
139 if (exception != EXC_CRASH && exception != kMachExceptionSimulated) { | 135 if (exception != EXC_CRASH && exception != kMachExceptionSimulated) { |
140 // Find another handler. | 136 // Find another handler. |
141 return KERN_FAILURE; | 137 return KERN_FAILURE; |
142 } | 138 } |
143 | 139 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // This is not an error: when exiting on timeout during persistent | 276 // This is not an error: when exiting on timeout during persistent |
281 // processing and at least one exception was handled, it’s considered a | 277 // processing and at least one exception was handled, it’s considered a |
282 // success. | 278 // success. |
283 } else if (mr != MACH_MSG_SUCCESS) { | 279 } else if (mr != MACH_MSG_SUCCESS) { |
284 MACH_LOG(ERROR, mr) << "MachMessageServer::Run"; | 280 MACH_LOG(ERROR, mr) << "MachMessageServer::Run"; |
285 return EXIT_FAILURE; | 281 return EXIT_FAILURE; |
286 } | 282 } |
287 | 283 |
288 return EXIT_SUCCESS; | 284 return EXIT_SUCCESS; |
289 } | 285 } |
OLD | NEW |