[PATCH] [Windows] Implementing backtracing of self

Zachary Turner zturner at google.com
Wed Mar 4 16:37:37 PST 2015


Hi majnemer, Bigcheese, rnk,

    llvm::sys::PrintBacktrace(FILE*) is supposed to print a backtrace
    of the current thread given the current PC.  This function was
    unimplemented on Windows, and instead the only time we could
    print a backtrace was as the result of an exception through
    LLVMUnhandledExceptionFilter.

    This patch implements backtracing of self by using setjmp() to
    get the current values of the instruction pointer, frame pointer,
    and stack pointer, and then calling the same function already
    used by LLVM to print backtraces given the same information.

    The one difference is that with an exception, we have a full
    CONTEXT structure that we can pass to StackWalk64.  MSDN documents
    that this is an optional field to StackWalk64, which only provides
    the function the ability to handle more situations.  Testing shows
    that even without this function, the results are still good.

http://reviews.llvm.org/D8068

Files:
  lib/Support/Windows/Signals.inc

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8068.21242.patch
Type: text/x-patch
Size: 7842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150305/c4e725b7/attachment.bin>


More information about the llvm-commits mailing list