Index: runtime/vm/native_symbol_fuchsia.cc |
diff --git a/runtime/vm/native_symbol_fuchsia.cc b/runtime/vm/native_symbol_fuchsia.cc |
index cb0f02a77300a1595b7617a530557d9bd1109c22..084c00b54eefda1b08e1294fe9fe5af35ea5b5b5 100644 |
--- a/runtime/vm/native_symbol_fuchsia.cc |
+++ b/runtime/vm/native_symbol_fuchsia.cc |
@@ -2,33 +2,41 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-#include "vm/globals.h" |
+#include "platform/globals.h" |
#if defined(TARGET_OS_FUCHSIA) |
#include "vm/native_symbol.h" |
-#include "platform/assert.h" |
+#include <dlfcn.h> // NOLINT |
namespace dart { |
void NativeSymbolResolver::InitOnce() { |
- UNIMPLEMENTED(); |
} |
void NativeSymbolResolver::ShutdownOnce() { |
- UNIMPLEMENTED(); |
} |
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { |
- UNIMPLEMENTED(); |
- return NULL; |
+ Dl_info info; |
+ int r = dladdr(reinterpret_cast<void*>(pc), &info); |
+ if (r == 0) { |
+ return NULL; |
+ } |
+ if (info.dli_sname == NULL) { |
+ return NULL; |
+ } |
+ if (start != NULL) { |
+ *start = reinterpret_cast<uintptr_t>(info.dli_saddr); |
+ } |
+ return strdup(info.dli_sname); |
} |
void NativeSymbolResolver::FreeSymbolName(char* name) { |
- UNIMPLEMENTED(); |
+ free(name); |
} |
} // namespace dart |