Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: runtime/vm/native_symbol_fuchsia.cc

Issue 2438843002: Fuchsia: Add native symbol resolver. Small fixes. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/platform/utils_fuchsia.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 "platform/globals.h"
6 #if defined(TARGET_OS_FUCHSIA) 6 #if defined(TARGET_OS_FUCHSIA)
7 7
8 #include "vm/native_symbol.h" 8 #include "vm/native_symbol.h"
9 9
10 #include "platform/assert.h" 10 #include <dlfcn.h> // NOLINT
11 11
12 namespace dart { 12 namespace dart {
13 13
14 void NativeSymbolResolver::InitOnce() { 14 void NativeSymbolResolver::InitOnce() {
15 UNIMPLEMENTED();
16 } 15 }
17 16
18 17
19 void NativeSymbolResolver::ShutdownOnce() { 18 void NativeSymbolResolver::ShutdownOnce() {
20 UNIMPLEMENTED();
21 } 19 }
22 20
23 21
24 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { 22 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
25 UNIMPLEMENTED(); 23 Dl_info info;
26 return NULL; 24 int r = dladdr(reinterpret_cast<void*>(pc), &info);
25 if (r == 0) {
26 return NULL;
27 }
28 if (info.dli_sname == NULL) {
29 return NULL;
30 }
31 if (start != NULL) {
32 *start = reinterpret_cast<uintptr_t>(info.dli_saddr);
33 }
34 return strdup(info.dli_sname);
27 } 35 }
28 36
29 37
30 void NativeSymbolResolver::FreeSymbolName(char* name) { 38 void NativeSymbolResolver::FreeSymbolName(char* name) {
31 UNIMPLEMENTED(); 39 free(name);
32 } 40 }
33 41
34 } // namespace dart 42 } // namespace dart
35 43
36 #endif // defined(TARGET_OS_FUCHSIA) 44 #endif // defined(TARGET_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/platform/utils_fuchsia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698