| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/mac/exception_processor.h" | 5 #import "chrome/browser/mac/exception_processor.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <libunwind.h> | 9 #include <libunwind.h> |
| 10 #include <objc/objc-exception.h> | 10 #include <objc/objc-exception.h> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 // This handler does not belong to us, so continue the search. | 165 // This handler does not belong to us, so continue the search. |
| 166 continue; | 166 continue; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Check if the function is one that is known to obscure (by way of | 169 // Check if the function is one that is known to obscure (by way of |
| 170 // catch-and-rethrow) exception stack traces. If it is, sinkhole it | 170 // catch-and-rethrow) exception stack traces. If it is, sinkhole it |
| 171 // by crashing here at the point of throw. | 171 // by crashing here at the point of throw. |
| 172 for (const auto& sinkhole : kExceptionSinkholes) { | 172 for (auto* sinkhole : kExceptionSinkholes) { |
| 173 if (strcmp(sinkhole, proc_name) == 0) { | 173 if (strcmp(sinkhole, proc_name) == 0) { |
| 174 TERMINATING_FROM_UNCAUGHT_NSEXCEPTION(exception); | 174 TERMINATING_FROM_UNCAUGHT_NSEXCEPTION(exception); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 DVLOG(1) << "Stopping search for exception handler at " << proc_name; | 178 DVLOG(1) << "Stopping search for exception handler at " << proc_name; |
| 179 | 179 |
| 180 break; | 180 break; |
| 181 } | 181 } |
| 182 } | 182 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 195 g_next_preprocessor = | 195 g_next_preprocessor = |
| 196 objc_setExceptionPreprocessor(&ObjcExceptionPreprocessor); | 196 objc_setExceptionPreprocessor(&ObjcExceptionPreprocessor); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void UninstallObjcExceptionPreprocessor() { | 199 void UninstallObjcExceptionPreprocessor() { |
| 200 objc_setExceptionPreprocessor(g_next_preprocessor); | 200 objc_setExceptionPreprocessor(g_next_preprocessor); |
| 201 g_next_preprocessor = nullptr; | 201 g_next_preprocessor = nullptr; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace chrome | 204 } // namespace chrome |
| OLD | NEW |