OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
9 | 9 |
10 #if !TARGET_OS_IOS | 10 #if !TARGET_OS_IOS |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "bin/file.h" | 21 #include "bin/file.h" |
22 | 22 |
23 namespace dart { | 23 namespace dart { |
24 namespace bin { | 24 namespace bin { |
25 | 25 |
26 const char* Platform::executable_name_ = NULL; | 26 const char* Platform::executable_name_ = NULL; |
27 char* Platform::resolved_executable_name_ = NULL; | 27 char* Platform::resolved_executable_name_ = NULL; |
28 int Platform::script_index_ = 1; | 28 int Platform::script_index_ = 1; |
29 char** Platform::argv_ = NULL; | 29 char** Platform::argv_ = NULL; |
30 | 30 |
| 31 static void segv_handler(int signal, siginfo_t* siginfo, void* context) { |
| 32 Dart_DumpNativeStackTrace(context); |
| 33 abort(); |
| 34 } |
| 35 |
| 36 |
31 bool Platform::Initialize() { | 37 bool Platform::Initialize() { |
32 // Turn off the signal handler for SIGPIPE as it causes the process | 38 // Turn off the signal handler for SIGPIPE as it causes the process |
33 // to terminate on writing to a closed pipe. Without the signal | 39 // to terminate on writing to a closed pipe. Without the signal |
34 // handler error EPIPE is set instead. | 40 // handler error EPIPE is set instead. |
35 struct sigaction act; | 41 struct sigaction act; |
36 bzero(&act, sizeof(act)); | 42 bzero(&act, sizeof(act)); |
37 act.sa_handler = SIG_IGN; | 43 act.sa_handler = SIG_IGN; |
38 if (sigaction(SIGPIPE, &act, 0) != 0) { | 44 if (sigaction(SIGPIPE, &act, 0) != 0) { |
39 perror("Setting signal handler failed"); | 45 perror("Setting signal handler failed"); |
40 return false; | 46 return false; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 151 |
146 | 152 |
147 void Platform::Exit(int exit_code) { | 153 void Platform::Exit(int exit_code) { |
148 exit(exit_code); | 154 exit(exit_code); |
149 } | 155 } |
150 | 156 |
151 } // namespace bin | 157 } // namespace bin |
152 } // namespace dart | 158 } // namespace dart |
153 | 159 |
154 #endif // defined(TARGET_OS_MACOS) | 160 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |