| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ui/cocoa/objc_zombie.h" | 5 #import "chrome/browser/ui/cocoa/objc_zombie.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <mach-o/dyld.h> | 8 #include <mach-o/dyld.h> |
| 9 #include <mach-o/nlist.h> | 9 #include <mach-o/nlist.h> |
| 10 | 10 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (viaSelector != NULL) { | 198 if (viaSelector != NULL) { |
| 199 const char* viaName = sel_getName(viaSelector); | 199 const char* viaName = sel_getName(viaSelector); |
| 200 aString = [aString stringByAppendingFormat:@" (via -%s)", viaName]; | 200 aString = [aString stringByAppendingFormat:@" (via -%s)", viaName]; |
| 201 } | 201 } |
| 202 | 202 |
| 203 // Set a value for breakpad to report, then crash. | 203 // Set a value for breakpad to report, then crash. |
| 204 SetCrashKeyValue(@"zombie", aString); | 204 SetCrashKeyValue(@"zombie", aString); |
| 205 LOG(ERROR) << [aString UTF8String]; | 205 LOG(ERROR) << [aString UTF8String]; |
| 206 | 206 |
| 207 // This is how about:crash is implemented. Using instead of | 207 // This is how about:crash is implemented. Using instead of |
| 208 // |DebugUtil::BreakDebugger()| or |LOG(FATAL)| to make the top of | 208 // |baes::debug::BreakDebugger()| or |LOG(FATAL)| to make the top of |
| 209 // stack more immediately obvious in crash dumps. | 209 // stack more immediately obvious in crash dumps. |
| 210 int* zero = NULL; | 210 int* zero = NULL; |
| 211 *zero = 0; | 211 *zero = 0; |
| 212 } | 212 } |
| 213 | 213 |
| 214 // Initialize our globals, returning YES on success. | 214 // Initialize our globals, returning YES on success. |
| 215 BOOL ZombieInit() { | 215 BOOL ZombieInit() { |
| 216 static BOOL initialized = NO; | 216 static BOOL initialized = NO; |
| 217 if (initialized) | 217 if (initialized) |
| 218 return YES; | 218 return YES; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (oldZombies) { | 405 if (oldZombies) { |
| 406 for (size_t i = 0; i < oldCount; ++i) { | 406 for (size_t i = 0; i < oldCount; ++i) { |
| 407 if (oldZombies[i].object) | 407 if (oldZombies[i].object) |
| 408 free(oldZombies[i].object); | 408 free(oldZombies[i].object); |
| 409 } | 409 } |
| 410 free(oldZombies); | 410 free(oldZombies); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace ObjcEvilDoers | 414 } // namespace ObjcEvilDoers |
| OLD | NEW |