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

Side by Side Diff: runtime/vm/native_symbol_fuchsia.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/native_symbol_android.cc ('k') | runtime/vm/native_symbol_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(HOST_OS_FUCHSIA) 6 #if defined(HOST_OS_FUCHSIA)
7 7
8 #include "platform/memory_sanitizer.h" 8 #include "platform/memory_sanitizer.h"
9 #include "vm/native_symbol.h" 9 #include "vm/native_symbol.h"
10 10
11 #include <cxxabi.h> // NOLINT 11 #include <cxxabi.h> // NOLINT
12 #include <dlfcn.h> // NOLINT 12 #include <dlfcn.h> // NOLINT
13 13
14 namespace dart { 14 namespace dart {
15 15
16 void NativeSymbolResolver::InitOnce() {} 16 void NativeSymbolResolver::InitOnce() {}
17 17
18
19 void NativeSymbolResolver::ShutdownOnce() {} 18 void NativeSymbolResolver::ShutdownOnce() {}
20 19
21
22 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { 20 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
23 Dl_info info; 21 Dl_info info;
24 int r = dladdr(reinterpret_cast<void*>(pc), &info); 22 int r = dladdr(reinterpret_cast<void*>(pc), &info);
25 if (r == 0) { 23 if (r == 0) {
26 return NULL; 24 return NULL;
27 } 25 }
28 if (info.dli_sname == NULL) { 26 if (info.dli_sname == NULL) {
29 return NULL; 27 return NULL;
30 } 28 }
31 if (start != NULL) { 29 if (start != NULL) {
32 *start = reinterpret_cast<uintptr_t>(info.dli_saddr); 30 *start = reinterpret_cast<uintptr_t>(info.dli_saddr);
33 } 31 }
34 int status = 0; 32 int status = 0;
35 size_t len = 0; 33 size_t len = 0;
36 char* demangled = abi::__cxa_demangle(info.dli_sname, NULL, &len, &status); 34 char* demangled = abi::__cxa_demangle(info.dli_sname, NULL, &len, &status);
37 MSAN_UNPOISON(demangled, len); 35 MSAN_UNPOISON(demangled, len);
38 if (status == 0) { 36 if (status == 0) {
39 return demangled; 37 return demangled;
40 } 38 }
41 return strdup(info.dli_sname); 39 return strdup(info.dli_sname);
42 } 40 }
43 41
44
45 void NativeSymbolResolver::FreeSymbolName(char* name) { 42 void NativeSymbolResolver::FreeSymbolName(char* name) {
46 free(name); 43 free(name);
47 } 44 }
48 45
49
50 bool NativeSymbolResolver::LookupSharedObject(uword pc, 46 bool NativeSymbolResolver::LookupSharedObject(uword pc,
51 uword* dso_base, 47 uword* dso_base,
52 char** dso_name) { 48 char** dso_name) {
53 Dl_info info; 49 Dl_info info;
54 int r = dladdr(reinterpret_cast<void*>(pc), &info); 50 int r = dladdr(reinterpret_cast<void*>(pc), &info);
55 if (r == 0) { 51 if (r == 0) {
56 return false; 52 return false;
57 } 53 }
58 *dso_base = reinterpret_cast<uword>(info.dli_fbase); 54 *dso_base = reinterpret_cast<uword>(info.dli_fbase);
59 *dso_name = strdup(info.dli_fname); 55 *dso_name = strdup(info.dli_fname);
60 return true; 56 return true;
61 } 57 }
62 58
63 } // namespace dart 59 } // namespace dart
64 60
65 #endif // defined(HOST_OS_FUCHSIA) 61 #endif // defined(HOST_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/vm/native_symbol_android.cc ('k') | runtime/vm/native_symbol_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698