Fuchsia: Add native symbol resolver. Small fixes.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2438843002 .
This commit is contained in:
Zachary Anderson 2016-10-20 13:39:35 -07:00
parent 8e37e083fd
commit 8200955ed0
4 changed files with 22 additions and 17 deletions

View file

@ -19,7 +19,7 @@ void Log::VPrint(const char* format, va_list args) {
void Log::VPrintErr(const char* format, va_list args) {
vfprintf(stderr, format, args);
fflush(stdout);
fflush(stderr);
}
} // namespace bin

View file

@ -98,17 +98,12 @@ const char* kExpectFail[] = {
"Fail2",
"AllocGeneric_Overflow",
"CodeImmutability",
// Assumes initial thread's stack is the same size as spawned thread stacks.
"StackOverflowStacktraceInfo",
};
// Bugs to fix, or things that are not yet implemented.
const char* kBugs[] = {
// Needs NativeSymbolResolver
"Service_PersistentHandles",
// Needs lstat
"DirectoryCreateTemp",
"DirectoryCreateDelete",
// Needs rename
"DirectoryRename",
// Needs read of RSS.
"InitialRSS",
};
@ -346,7 +341,7 @@ static void* test_runner_thread(void* arg) {
static void run_all_tests(runner_args_t* args) {
const intptr_t num_cpus = sysconf(_SC_NPROCESSORS_CONF);
pthread_t* threads =
reinterpret_cast<pthread_t*>(malloc(num_cpus * sizeof(pthread_t)));
reinterpret_cast<pthread_t*>(malloc(num_cpus * sizeof(pthread_t)));
for (int i = 0; i < num_cpus; i++) {
pthread_create(&threads[i], NULL, test_runner_thread, args);
}

View file

@ -62,7 +62,9 @@ inline uint64_t Utils::HostToLittleEndian64(uint64_t value) {
inline char* Utils::StrError(int err, char* buffer, size_t bufsize) {
snprintf(buffer, bufsize, "errno = %d", err);
if (strerror_r(err, buffer, bufsize) != 0) {
snprintf(buffer, bufsize, "%s", "strerror_r failed");
}
return buffer;
}

View file

@ -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