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