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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 req = rem; | 259 req = rem; |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 | 263 |
264 void OS::DebugBreak() { | 264 void OS::DebugBreak() { |
265 __builtin_trap(); | 265 __builtin_trap(); |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 uintptr_t DART_NOINLINE OS::GetProgramCounter() { | |
270 return reinterpret_cast<uintptr_t>( | |
271 __builtin_extract_return_addr(__builtin_return_address(0))); | |
272 } | |
273 | |
274 | |
275 char* OS::StrNDup(const char* s, intptr_t n) { | 269 char* OS::StrNDup(const char* s, intptr_t n) { |
276 // strndup has only been added to Mac OS X in 10.7. We are supplying | 270 // strndup has only been added to Mac OS X in 10.7. We are supplying |
277 // our own copy here if needed. | 271 // our own copy here if needed. |
278 #if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \ | 272 #if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \ |
279 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1060 | 273 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1060 |
280 intptr_t len = strlen(s); | 274 intptr_t len = strlen(s); |
281 if ((n < 0) || (len < 0)) { | 275 if ((n < 0) || (len < 0)) { |
282 return NULL; | 276 return NULL; |
283 } | 277 } |
284 if (n < len) { | 278 if (n < len) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 433 } |
440 | 434 |
441 | 435 |
442 void OS::Exit(int code) { | 436 void OS::Exit(int code) { |
443 exit(code); | 437 exit(code); |
444 } | 438 } |
445 | 439 |
446 } // namespace dart | 440 } // namespace dart |
447 | 441 |
448 #endif // defined(TARGET_OS_MACOS) | 442 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |