Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: src/platform-macos.cc

Issue 132002: Make some small Mac-specific modifications to V8 to make it work on MacOS X 1... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « SConstruct ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-macos.cc
===================================================================
--- src/platform-macos.cc (revision 2212)
+++ src/platform-macos.cc (working copy)
@@ -35,10 +35,6 @@
#include <AvailabilityMacros.h>
-#ifdef MAC_OS_X_VERSION_10_5
-# include <execinfo.h> // backtrace, backtrace_symbols
-#endif
-
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
@@ -58,6 +54,17 @@
#include "platform.h"
+// Manually define these here as weak imports, rather than including execinfo.h.
+// This lets us launch on 10.4 which does not have these calls.
+extern "C" {
+ extern int backtrace(void**, int) __attribute__((weak_import));
+ extern char** backtrace_symbols(void* const*, int)
+ __attribute__((weak_import));
+ extern void backtrace_symbols_fd(void* const*, int, int)
+ __attribute__((weak_import));
+}
+
+
namespace v8 {
namespace internal {
@@ -214,9 +221,10 @@
int OS::StackWalk(Vector<StackFrame> frames) {
-#ifndef MAC_OS_X_VERSION_10_5
- return 0;
-#else
+ // If weak link to execinfo lib has failed, ie because we are on 10.4, abort.
+ if (backtrace == NULL)
+ return 0;
+
int frames_size = frames.length();
void** addresses = NewArray<void*>(frames_size);
int frames_count = backtrace(addresses, frames_size);
@@ -244,7 +252,6 @@
free(symbols);
return frames_count;
-#endif
}
« no previous file with comments | « SConstruct ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698