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(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 | 10 |
11 #include <dlfcn.h> // NOLINT | 11 #include <dlfcn.h> // NOLINT |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 void NativeSymbolResolver::InitOnce() { | 15 void NativeSymbolResolver::InitOnce() { |
16 } | 16 } |
17 | 17 |
18 | 18 |
19 void NativeSymbolResolver::ShutdownOnce() { | 19 void NativeSymbolResolver::ShutdownOnce() { |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc) { | 23 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { |
24 Dl_info info; | 24 Dl_info info; |
25 int r = dladdr(reinterpret_cast<void*>(pc), &info); | 25 int r = dladdr(reinterpret_cast<void*>(pc), &info); |
26 if (r == 0) { | 26 if (r == 0) { |
27 return NULL; | 27 return NULL; |
28 } | 28 } |
29 if (info.dli_sname == NULL) { | 29 if (info.dli_sname == NULL) { |
30 return NULL; | 30 return NULL; |
31 } | 31 } |
32 *start = reinterpret_cast<uintptr_t>(info.dli_saddr); | |
Ivan Posva
2014/01/03 19:24:54
if (start != NULL) {
*start = ...
}
Cutch
2014/01/03 19:42:30
Done.
| |
32 return strdup(info.dli_sname); | 33 return strdup(info.dli_sname); |
33 } | 34 } |
34 | 35 |
35 | 36 |
36 void NativeSymbolResolver::FreeSymbolName(char* name) { | 37 void NativeSymbolResolver::FreeSymbolName(char* name) { |
37 free(name); | 38 free(name); |
38 } | 39 } |
39 | 40 |
40 | 41 |
41 } // namespace dart | 42 } // namespace dart |
42 | 43 |
43 #endif // defined(TARGET_OS_ANDROID) | 44 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |