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 "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 // We should only ever see an interrupt error. | 148 // We should only ever see an interrupt error. |
149 ASSERT(errno == EINTR); | 149 ASSERT(errno == EINTR); |
150 // Copy remainder into requested and repeat. | 150 // Copy remainder into requested and repeat. |
151 req = rem; | 151 req = rem; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 | 155 |
156 void OS::DebugBreak() { | 156 void OS::DebugBreak() { |
157 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32) | 157 __builtin_trap(); |
158 asm("int $3"); | |
159 #else | |
160 #error Unsupported architecture. | |
161 #endif | |
162 } | 158 } |
163 | 159 |
164 | 160 |
165 char* OS::StrNDup(const char* s, intptr_t n) { | 161 char* OS::StrNDup(const char* s, intptr_t n) { |
166 // strndup has only been added to Mac OS X in 10.7. We are supplying | 162 // strndup has only been added to Mac OS X in 10.7. We are supplying |
167 // our own copy here if needed. | 163 // our own copy here if needed. |
168 #if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \ | 164 #if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \ |
169 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1060 | 165 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1060 |
170 intptr_t len = strlen(s); | 166 intptr_t len = strlen(s); |
171 if ((n < 0) || (len < 0)) { | 167 if ((n < 0) || (len < 0)) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 264 } |
269 | 265 |
270 | 266 |
271 void OS::Exit(int code) { | 267 void OS::Exit(int code) { |
272 exit(code); | 268 exit(code); |
273 } | 269 } |
274 | 270 |
275 } // namespace dart | 271 } // namespace dart |
276 | 272 |
277 #endif // defined(TARGET_OS_MACOS) | 273 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |