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/os.h" | 5 #include "vm/os.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <malloc.h> | 9 #include <malloc.h> |
10 #include <time.h> | 10 #include <time.h> |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return sysconf(_SC_NPROCESSORS_ONLN); | 303 return sysconf(_SC_NPROCESSORS_ONLN); |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 void OS::Sleep(int64_t millis) { | 307 void OS::Sleep(int64_t millis) { |
308 // TODO(5411554): For now just use usleep we may have to revisit this. | 308 // TODO(5411554): For now just use usleep we may have to revisit this. |
309 usleep(millis * 1000); | 309 usleep(millis * 1000); |
310 } | 310 } |
311 | 311 |
312 | 312 |
| 313 void OS::DebugBreak() { |
| 314 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32) |
| 315 asm("int $3"); |
| 316 #elif defined(HOST_ARCH_ARM) |
| 317 asm("svc #0x9f0001"); // __ARM_NR_breakpoint |
| 318 #elif defined(HOST_ARCH_MIPS) |
| 319 UNIMPLEMENTED(); |
| 320 #else |
| 321 #error Unsupported architecture. |
| 322 #endif |
| 323 } |
| 324 |
| 325 |
313 void OS::Print(const char* format, ...) { | 326 void OS::Print(const char* format, ...) { |
314 va_list args; | 327 va_list args; |
315 va_start(args, format); | 328 va_start(args, format); |
316 VFPrint(stdout, format, args); | 329 VFPrint(stdout, format, args); |
317 va_end(args); | 330 va_end(args); |
318 } | 331 } |
319 | 332 |
320 | 333 |
321 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 334 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
322 vfprintf(stream, format, args); | 335 vfprintf(stream, format, args); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void OS::Abort() { | 415 void OS::Abort() { |
403 abort(); | 416 abort(); |
404 } | 417 } |
405 | 418 |
406 | 419 |
407 void OS::Exit(int code) { | 420 void OS::Exit(int code) { |
408 exit(code); | 421 exit(code); |
409 } | 422 } |
410 | 423 |
411 } // namespace dart | 424 } // namespace dart |
OLD | NEW |