Changeset 237382 in webkit


Ignore:
Timestamp:
Oct 24, 2018 7:27:13 AM (6 years ago)
Author:
chris.reid@sony.com
Message:

[Win] Add function call name information to stack traces
https://bugs.webkit.org/show_bug.cgi?id=190761

Reviewed by Fujii Hironori.

Add symbol information to stack traces using dbghelp.dll
This library will use symbols files from these sources:

  • The current working directory
  • The directory containing the application's executable
  • _NT_SYMBOL_PATH environment variable
  • _NT_ALTERNATE_SYMBOL_PATH environment variable

This functionality is currently only enabled in debug mode since dbghelp is not threadsafe.
The DbgHelper class attempts to synchronize calls to dbghelp.dll but external code
can still attempt to call the library at the same time as WebKit.

  • wtf/CMakeLists.txt:
  • wtf/PlatformWin.cmake:
  • wtf/StackTrace.cpp:
  • wtf/win/DbgHelperWin.cpp: Added.
  • wtf/win/DbgHelperWin.h: Added.
Location:
trunk/Source/WTF
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r237361 r237382  
     12018-10-24  Christopher Reid  <chris.reid@sony.com>
     2
     3        [Win] Add function call name information to stack traces
     4        https://bugs.webkit.org/show_bug.cgi?id=190761
     5
     6        Reviewed by Fujii Hironori.
     7
     8        Add symbol information to stack traces using dbghelp.dll
     9        This library will use symbols files from these sources:
     10            - The current working directory
     11            - The directory containing the application's executable
     12            - _NT_SYMBOL_PATH environment variable
     13            - _NT_ALTERNATE_SYMBOL_PATH environment variable
     14
     15        This functionality is currently only enabled in debug mode since dbghelp is not threadsafe.
     16        The DbgHelper class attempts to synchronize calls to dbghelp.dll but external code
     17        can still attempt to call the library at the same time as WebKit.
     18
     19        * wtf/CMakeLists.txt:
     20        * wtf/PlatformWin.cmake:
     21        * wtf/StackTrace.cpp:
     22        * wtf/win/DbgHelperWin.cpp: Added.
     23        * wtf/win/DbgHelperWin.h: Added.
     24
    1252018-10-22  Alexey Proskuryakov  <ap@apple.com>
    226
  • trunk/Source/WTF/wtf/CMakeLists.txt

    r237052 r237382  
    500500    )
    501501    list(APPEND WTF_LIBRARIES
     502        DbgHelp
    502503        winmm
    503504    )
  • trunk/Source/WTF/wtf/PlatformWin.cmake

    r232888 r237382  
    22    text/win/WCharStringExtras.h
    33
     4    win/DbgHelperWin.h
    45    win/GDIObject.h
    56    win/SoftLinking.h
     
    1112
    1213    win/CPUTimeWin.cpp
     14    win/DbgHelperWin.cpp
    1315    win/LanguageWin.cpp
    1416    win/MainThreadWin.cpp
  • trunk/Source/WTF/wtf/StackTrace.cpp

    r237099 r237382  
    4242#if OS(WINDOWS)
    4343#include <windows.h>
     44#include <wtf/win/DbgHelperWin.h>
    4445#endif
    4546
     
    111112    if (!symbols)
    112113        return;
     114#elif OS(WINDOWS)
     115    HANDLE hProc = GetCurrentProcess();
     116    uint8_t symbolData[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)] = { 0 };
     117    auto symbolInfo = reinterpret_cast<SYMBOL_INFO*>(symbolData);
     118
     119    symbolInfo->SizeOfStruct = sizeof(SYMBOL_INFO);
     120    symbolInfo->MaxNameLen = MAX_SYM_NAME;
    113121#endif
    114122
     
    126134            cxaDemangled = demangled->demangledName();
    127135        }
     136#elif OS(WINDOWS)
     137        if (DbgHelper::SymFromAddress(hProc, reinterpret_cast<DWORD64>(stack[i]), 0, symbolInfo))
     138            mangledName = symbolInfo->Name;
    128139#endif
    129140        const int frameNumber = i + 1;
Note: See TracChangeset for help on using the changeset viewer.