OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // A file you can include instead of <execinfo.h> if your project might have | 5 // A file you can include instead of <execinfo.h> if your project might need |
6 // been compiled with our SUPPORT_MACOSX_10_4 flag defined. | 6 // to run on Mac OS X 10.4. |
7 // If SUPPORT_MACOSX_10_4 is not defined it just includes execinfo.h as normal, | |
8 // otherwise it defines the symbols itself as weak linked imports, which enables | |
9 // launching on 10.4 where they are not defined. | |
10 | 7 |
11 #ifndef BASE_COMPAT_EXECINFO_H | 8 #ifndef BASE_COMPAT_EXECINFO_H |
12 #define BASE_COMPAT_EXECINFO_H | 9 #define BASE_COMPAT_EXECINFO_H |
13 | 10 |
14 #ifdef SUPPORT_MACOSX_10_4 | 11 #include "build/build_config.h" |
| 12 |
| 13 #if defined(OS_MACOSX) |
| 14 #include <AvailabilityMacros.h> |
| 15 #endif |
| 16 |
| 17 #if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 |
15 // Manually define these here as weak imports, rather than including execinfo.h. | 18 // Manually define these here as weak imports, rather than including execinfo.h. |
16 // This lets us launch on 10.4 which does not have these calls. | 19 // This lets us launch on 10.4 which does not have these calls. |
17 extern "C" { | 20 extern "C" { |
18 extern int backtrace(void**, int) __attribute__((weak_import)); | 21 |
19 extern char** backtrace_symbols(void* const*, int) | 22 extern int backtrace(void**, int) __attribute__((weak_import)); |
20 __attribute__((weak_import)); | 23 extern char** backtrace_symbols(void* const*, int) |
21 extern void backtrace_symbols_fd(void* const*, int, int) | 24 __attribute__((weak_import)); |
22 __attribute__((weak_import)); | 25 extern void backtrace_symbols_fd(void* const*, int, int) |
23 } | 26 __attribute__((weak_import)); |
| 27 |
| 28 } // extern "C" |
24 #else | 29 #else |
25 #include <execinfo.h> | 30 #include <execinfo.h> |
26 #endif | 31 #endif |
27 | 32 |
28 #endif // BASE_COMPAT_EXECINFO_H | 33 #endif // BASE_COMPAT_EXECINFO_H |
29 | |
OLD | NEW |