OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 #if 0 | 40 #if 0 |
41 HANDLE hProcess = GetCurrentProcess(); | 41 HANDLE hProcess = GetCurrentProcess(); |
42 if (!SymCleanup(hProcess)) { | 42 if (!SymCleanup(hProcess)) { |
43 DWORD error = GetLastError(); | 43 DWORD error = GetLastError(); |
44 printf("Failed to shutdown NativeSymbolResolver (SymCleanup %d)\n", error); | 44 printf("Failed to shutdown NativeSymbolResolver (SymCleanup %d)\n", error); |
45 } | 45 } |
46 #endif | 46 #endif |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc) { | 50 char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { |
51 static const intptr_t kMaxNameLength = 2048; | 51 static const intptr_t kMaxNameLength = 2048; |
52 static const intptr_t kSymbolInfoSize = sizeof(SYMBOL_INFO); // NOLINT. | 52 static const intptr_t kSymbolInfoSize = sizeof(SYMBOL_INFO); // NOLINT. |
53 static char buffer[kSymbolInfoSize + kMaxNameLength]; | 53 static char buffer[kSymbolInfoSize + kMaxNameLength]; |
54 static char name_buffer[kMaxNameLength]; | 54 static char name_buffer[kMaxNameLength]; |
55 MutexLocker lock(lock_); | 55 MutexLocker lock(lock_); |
56 if (!running_) { | 56 if (!running_) { |
57 return NULL; | 57 return NULL; |
58 } | 58 } |
| 59 if (start != NULL) { |
| 60 *start = NULL; |
| 61 } |
59 #if 0 | 62 #if 0 |
60 memset(&buffer[0], 0, sizeof(buffer)); | 63 memset(&buffer[0], 0, sizeof(buffer)); |
61 HANDLE hProcess = GetCurrentProcess(); | 64 HANDLE hProcess = GetCurrentProcess(); |
62 DWORD64 address = static_cast<DWORD64>(pc); | 65 DWORD64 address = static_cast<DWORD64>(pc); |
63 PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(&buffer[0]); | 66 PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(&buffer[0]); |
64 pSymbol->SizeOfStruct = kSymbolInfoSize; | 67 pSymbol->SizeOfStruct = kSymbolInfoSize; |
65 pSymbol->MaxNameLen = kMaxNameLength; | 68 pSymbol->MaxNameLen = kMaxNameLength; |
66 BOOL r = SymFromAddr(hProcess, address, NULL, pSymbol); | 69 BOOL r = SymFromAddr(hProcess, address, NULL, pSymbol); |
67 if (r == FALSE) { | 70 if (r == FALSE) { |
68 return NULL; | 71 return NULL; |
69 } | 72 } |
70 return strdup(pSymbol->Name); | 73 return strdup(pSymbol->Name); |
71 #endif | 74 #endif |
72 return NULL; | 75 return NULL; |
73 } | 76 } |
74 | 77 |
75 | 78 |
76 void NativeSymbolResolver::FreeSymbolName(char* name) { | 79 void NativeSymbolResolver::FreeSymbolName(char* name) { |
77 free(name); | 80 free(name); |
78 } | 81 } |
79 | 82 |
80 | 83 |
81 } // namespace dart | 84 } // namespace dart |
82 | 85 |
83 #endif // defined(TARGET_OS_WINDOWS) | 86 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |