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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/utils_fuchsia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« 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