Chromium Code Reviews| 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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 #include <dlfcn.h> // NOLINT | |
| 10 #include <errno.h> // NOLINT | 11 #include <errno.h> // NOLINT |
| 11 #include <limits.h> // NOLINT | 12 #include <limits.h> // NOLINT |
| 12 #include <malloc.h> // NOLINT | 13 #include <malloc.h> // NOLINT |
| 13 #include <time.h> // NOLINT | 14 #include <time.h> // NOLINT |
| 14 #include <sys/resource.h> // NOLINT | 15 #include <sys/resource.h> // NOLINT |
| 15 #include <sys/time.h> // NOLINT | 16 #include <sys/time.h> // NOLINT |
| 16 #include <sys/types.h> // NOLINT | 17 #include <sys/types.h> // NOLINT |
| 17 #include <unistd.h> // NOLINT | 18 #include <unistd.h> // NOLINT |
| 18 | 19 |
| 19 #include "platform/utils.h" | 20 #include "platform/utils.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 } | 476 } |
| 476 if (FLAG_generate_pprof_symbols != NULL) { | 477 if (FLAG_generate_pprof_symbols != NULL) { |
| 477 CodeObservers::Register(new PprofCodeObserver); | 478 CodeObservers::Register(new PprofCodeObserver); |
| 478 } | 479 } |
| 479 #if defined(DART_VTUNE_SUPPORT) | 480 #if defined(DART_VTUNE_SUPPORT) |
| 480 Register(new VTuneCodeObserver); | 481 Register(new VTuneCodeObserver); |
| 481 #endif | 482 #endif |
| 482 } | 483 } |
| 483 | 484 |
| 484 | 485 |
| 486 const char* OS::ReverseLookupSymbol(uword address) { | |
| 487 // TODO(regis): This does not work for symbols of the main program. | |
| 488 // Passing -export-dynamic to the linker does not help. | |
| 489 Dl_info info; | |
| 490 if (dladdr(reinterpret_cast<void*>(address), &info)) { | |
|
Ivan Posva
2013/03/08 17:00:42
I am not sure this is allowed within the security
| |
| 491 return info.dli_sname; | |
| 492 } else { | |
| 493 return NULL; | |
| 494 } | |
| 495 } | |
| 496 | |
| 497 | |
| 485 void OS::PrintErr(const char* format, ...) { | 498 void OS::PrintErr(const char* format, ...) { |
| 486 va_list args; | 499 va_list args; |
| 487 va_start(args, format); | 500 va_start(args, format); |
| 488 VFPrint(stderr, format, args); | 501 VFPrint(stderr, format, args); |
| 489 va_end(args); | 502 va_end(args); |
| 490 } | 503 } |
| 491 | 504 |
| 492 | 505 |
| 493 void OS::InitOnce() { | 506 void OS::InitOnce() { |
| 494 // TODO(5411554): For now we check that initonce is called only once, | 507 // TODO(5411554): For now we check that initonce is called only once, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 509 } | 522 } |
| 510 | 523 |
| 511 | 524 |
| 512 void OS::Exit(int code) { | 525 void OS::Exit(int code) { |
| 513 exit(code); | 526 exit(code); |
| 514 } | 527 } |
| 515 | 528 |
| 516 } // namespace dart | 529 } // namespace dart |
| 517 | 530 |
| 518 #endif // defined(TARGET_OS_LINUX) | 531 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |