[Windows] Implement PrintStackTrace(FILE*)
authorZachary Turner <zturner@google.com>
Thu, 5 Mar 2015 17:47:52 +0000 (17:47 +0000)
committerZachary Turner <zturner@google.com>
Thu, 5 Mar 2015 17:47:52 +0000 (17:47 +0000)
commit98638f07f1bd8ea87e0c148ff6b05f61a36a6dec
tree3f8cfaa23e08ac7ddbd938892d923a1445682bfe
parenta744a15e97506ff09a6ac380083a9f0006c695f7
[Windows] Implement PrintStackTrace(FILE*)

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
RtlCaptureContext to get a CONTEXT for the current thread, and
moving the printing and StackWalk64 code to a common method that
printing own stack trace and printing stack trace of an exception
can use.

Differential Revision: http://reviews.llvm.org/D8068
Reviewed by: Reid Kleckner

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231382 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Windows/Signals.inc