| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_ANDROID) | 6 #if defined(HOST_OS_ANDROID) |
| 7 | 7 |
| 8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
| 9 | 9 |
| 10 #include <dlfcn.h> // NOLINT | 10 #include <dlfcn.h> // NOLINT |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 return strdup(info.dli_sname); | 32 return strdup(info.dli_sname); |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 void NativeSymbolResolver::FreeSymbolName(char* name) { | 36 void NativeSymbolResolver::FreeSymbolName(char* name) { |
| 37 free(name); | 37 free(name); |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 bool NativeSymbolResolver::LookupSharedObject(uword pc, |
| 42 uword* dso_base, |
| 43 char** dso_name) { |
| 44 Dl_info info; |
| 45 int r = dladdr(reinterpret_cast<void*>(pc), &info); |
| 46 if (r == 0) { |
| 47 return false; |
| 48 } |
| 49 *dso_base = reinterpret_cast<uword>(info.dli_fbase); |
| 50 *dso_name = strdup(info.dli_fname); |
| 51 return true; |
| 52 } |
| 53 |
| 41 } // namespace dart | 54 } // namespace dart |
| 42 | 55 |
| 43 #endif // defined(HOST_OS_ANDROID) | 56 #endif // defined(HOST_OS_ANDROID) |
| OLD | NEW |