mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:41:19 +00:00
14ecdbd66a
to allow us to make VM specific changes. R=asiva@google.com Review URL: https://codereview.chromium.org//463993002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// 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"
|
|
#if defined(TARGET_OS_MACOS)
|
|
|
|
#include "vm/native_symbol.h"
|
|
|
|
#include <cxxabi.h> // NOLINT
|
|
#include <dlfcn.h> // NOLINT
|
|
|
|
namespace dart {
|
|
|
|
void NativeSymbolResolver::InitOnce() {
|
|
}
|
|
|
|
|
|
void NativeSymbolResolver::ShutdownOnce() {
|
|
}
|
|
|
|
|
|
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
|
|
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);
|
|
}
|
|
int status;
|
|
char* demangled = abi::__cxa_demangle(info.dli_sname, NULL, NULL, &status);
|
|
if (status == 0) {
|
|
return demangled;
|
|
}
|
|
return strdup(info.dli_sname);
|
|
}
|
|
|
|
|
|
void NativeSymbolResolver::FreeSymbolName(char* name) {
|
|
free(name);
|
|
}
|
|
|
|
|
|
} // namespace dart
|
|
|
|
#endif // defined(TARGET_OS_MACOS)
|