diff --git a/runtime/bin/log_fuchsia.cc b/runtime/bin/log_fuchsia.cc index 0c1f7af934b..b3f9d1dadc1 100644 --- a/runtime/bin/log_fuchsia.cc +++ b/runtime/bin/log_fuchsia.cc @@ -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 diff --git a/runtime/bin/run_vm_tests_fuchsia.cc b/runtime/bin/run_vm_tests_fuchsia.cc index a974860eaae..db8baf2675b 100644 --- a/runtime/bin/run_vm_tests_fuchsia.cc +++ b/runtime/bin/run_vm_tests_fuchsia.cc @@ -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(malloc(num_cpus * sizeof(pthread_t))); + reinterpret_cast(malloc(num_cpus * sizeof(pthread_t))); for (int i = 0; i < num_cpus; i++) { pthread_create(&threads[i], NULL, test_runner_thread, args); } diff --git a/runtime/platform/utils_fuchsia.h b/runtime/platform/utils_fuchsia.h index 4e8c4e97796..575c3dbf587 100644 --- a/runtime/platform/utils_fuchsia.h +++ b/runtime/platform/utils_fuchsia.h @@ -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; } diff --git a/runtime/vm/native_symbol_fuchsia.cc b/runtime/vm/native_symbol_fuchsia.cc index cb0f02a7730..084c00b54ee 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 // 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(pc), &info); + if (r == 0) { + return NULL; + } + if (info.dli_sname == NULL) { + return NULL; + } + if (start != NULL) { + *start = reinterpret_cast(info.dli_saddr); + } + return strdup(info.dli_sname); } void NativeSymbolResolver::FreeSymbolName(char* name) { - UNIMPLEMENTED(); + free(name); } } // namespace dart