| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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(HOST_OS_MACOS) | 6 #if defined(HOST_OS_MACOS) |
| 7 | 7 |
| 8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
| 9 | 9 |
| 10 #include <cxxabi.h> // NOLINT | 10 #include <cxxabi.h> // NOLINT |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 return strdup(info.dli_sname); | 38 return strdup(info.dli_sname); |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 |
| 42 void NativeSymbolResolver::FreeSymbolName(char* name) { | 42 void NativeSymbolResolver::FreeSymbolName(char* name) { |
| 43 free(name); | 43 free(name); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 bool NativeSymbolResolver::LookupSharedObject(uword pc, |
| 48 uword* dso_base, |
| 49 char** dso_name) { |
| 50 Dl_info info; |
| 51 int r = dladdr(reinterpret_cast<void*>(pc), &info); |
| 52 if (r == 0) { |
| 53 return false; |
| 54 } |
| 55 *dso_base = reinterpret_cast<uword>(info.dli_fbase); |
| 56 *dso_name = strdup(info.dli_fname); |
| 57 return true; |
| 58 } |
| 59 |
| 47 } // namespace dart | 60 } // namespace dart |
| 48 | 61 |
| 49 #endif // defined(HOST_OS_MACOS) | 62 #endif // defined(HOST_OS_MACOS) |
| OLD | NEW |