| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ExcCrashRecoverOriginalException(code[0], &original_code_0, &signal); | 126 ExcCrashRecoverOriginalException(code[0], &original_code_0, &signal); |
| 127 fprintf(options_.file, | 127 fprintf(options_.file, |
| 128 ", original exception %s, original code[0] %lld, signal %s", | 128 ", original exception %s, original code[0] %lld, signal %s", |
| 129 ExceptionToString(original_exception, | 129 ExceptionToString(original_exception, |
| 130 kUseFullName | kUnknownIsNumeric).c_str(), | 130 kUseFullName | kUnknownIsNumeric).c_str(), |
| 131 original_code_0, | 131 original_code_0, |
| 132 SignalToString(signal, kUseFullName | kUnknownIsNumeric).c_str()); | 132 SignalToString(signal, kUseFullName | kUnknownIsNumeric).c_str()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (ExceptionBehaviorHasState(behavior)) { | 135 if (ExceptionBehaviorHasState(behavior)) { |
| 136 // If this is a state-carrying exception, make new_state something valid. | |
| 137 memcpy( | |
| 138 new_state, | |
| 139 old_state, | |
| 140 std::min(old_state_count, *new_state_count) * sizeof(old_state[0])); | |
| 141 *new_state_count = old_state_count; | |
| 142 | |
| 143 std::string flavor_string = | 136 std::string flavor_string = |
| 144 ThreadStateFlavorToString(*flavor, kUseFullName | kUnknownIsNumeric); | 137 ThreadStateFlavorToString(*flavor, kUseFullName | kUnknownIsNumeric); |
| 145 fprintf(options_.file, | 138 fprintf(options_.file, |
| 146 ", flavor %s, old_state_count %d", | 139 ", flavor %s, old_state_count %d", |
| 147 flavor_string.c_str(), | 140 flavor_string.c_str(), |
| 148 old_state_count); | 141 old_state_count); |
| 149 } | 142 } |
| 150 | 143 |
| 151 fprintf(options_.file, "\n"); | 144 fprintf(options_.file, "\n"); |
| 152 fflush(options_.file); | 145 fflush(options_.file); |
| 153 | 146 |
| 154 if (exception != EXC_CRASH && exception != kMachExceptionSimulated) { | 147 if (exception != EXC_CRASH && exception != kMachExceptionSimulated) { |
| 155 // Find another handler. | 148 // Find another handler. |
| 156 return KERN_FAILURE; | 149 return KERN_FAILURE; |
| 157 } | 150 } |
| 158 | 151 |
| 152 ExcServerCopyState( |
| 153 behavior, old_state, old_state_count, new_state, new_state_count); |
| 154 |
| 159 return ExcServerSuccessfulReturnValue(behavior, false); | 155 return ExcServerSuccessfulReturnValue(behavior, false); |
| 160 } | 156 } |
| 161 | 157 |
| 162 private: | 158 private: |
| 163 const Options& options_; | 159 const Options& options_; |
| 164 const std::string& me_; | 160 const std::string& me_; |
| 165 int* exceptions_handled_; | 161 int* exceptions_handled_; |
| 166 }; | 162 }; |
| 167 | 163 |
| 168 void Usage(const std::string& me) { | 164 void Usage(const std::string& me) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 304 |
| 309 return EXIT_SUCCESS; | 305 return EXIT_SUCCESS; |
| 310 } | 306 } |
| 311 | 307 |
| 312 } // namespace | 308 } // namespace |
| 313 } // namespace crashpad | 309 } // namespace crashpad |
| 314 | 310 |
| 315 int main(int argc, char* argv[]) { | 311 int main(int argc, char* argv[]) { |
| 316 return crashpad::CatchExceptionToolMain(argc, argv); | 312 return crashpad::CatchExceptionToolMain(argc, argv); |
| 317 } | 313 } |
| OLD | NEW |