| 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 <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 <mach/mach.h> // NOLINT | 13 #include <mach/mach.h> // NOLINT |
| 13 #include <mach/clock.h> // NOLINT | 14 #include <mach/clock.h> // NOLINT |
| 14 #include <mach/mach_time.h> // NOLINT | 15 #include <mach/mach_time.h> // NOLINT |
| 15 #include <sys/time.h> // NOLINT | 16 #include <sys/time.h> // NOLINT |
| 16 #include <sys/resource.h> // NOLINT | 17 #include <sys/resource.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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 errno = 0; | 184 errno = 0; |
| 184 *value = strtoll(str, &endptr, base); | 185 *value = strtoll(str, &endptr, base); |
| 185 return ((errno == 0) && (endptr != str) && (*endptr == 0)); | 186 return ((errno == 0) && (endptr != str) && (*endptr == 0)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 | 189 |
| 189 void OS::RegisterCodeObservers() { | 190 void OS::RegisterCodeObservers() { |
| 190 } | 191 } |
| 191 | 192 |
| 192 | 193 |
| 194 const char* OS::ReverseLookupSymbol(uword address) { |
| 195 // TODO(regis): This does not work for symbols of the main program. |
| 196 // Passing -export-dynamic to the linker does not help. |
| 197 Dl_info info; |
| 198 if (dladdr(reinterpret_cast<void*>(address), &info)) { |
| 199 return info.dli_sname; |
| 200 } else { |
| 201 return NULL; |
| 202 } |
| 203 } |
| 204 |
| 205 |
| 193 void OS::PrintErr(const char* format, ...) { | 206 void OS::PrintErr(const char* format, ...) { |
| 194 va_list args; | 207 va_list args; |
| 195 va_start(args, format); | 208 va_start(args, format); |
| 196 VFPrint(stderr, format, args); | 209 VFPrint(stderr, format, args); |
| 197 va_end(args); | 210 va_end(args); |
| 198 } | 211 } |
| 199 | 212 |
| 200 | 213 |
| 201 void OS::InitOnce() { | 214 void OS::InitOnce() { |
| 202 // TODO(5411554): For now we check that initonce is called only once, | 215 // TODO(5411554): For now we check that initonce is called only once, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 217 } | 230 } |
| 218 | 231 |
| 219 | 232 |
| 220 void OS::Exit(int code) { | 233 void OS::Exit(int code) { |
| 221 exit(code); | 234 exit(code); |
| 222 } | 235 } |
| 223 | 236 |
| 224 } // namespace dart | 237 } // namespace dart |
| 225 | 238 |
| 226 #endif // defined(TARGET_OS_MACOS) | 239 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |