[PATCH] [Windows] Implementing backtracing of self

Zachary Turner zturner at google.com
Wed Mar 4 21:07:44 PST 2015

Thanks for noticing that.  the actual type is declared typedef struct
{ ... } _JUMP_BUFFER.  So I will just stick with the single underscore
version in both places.

On Wed, Mar 4, 2015 at 8:54 PM Sean Silva <chisophugis at gmail.com> wrote:

> Random thing I noticed:
>  _JUMP_BUFFER *JumpBuf = reinterpret_cast<__JUMP_BUFFER *>(Buffer);
> The cast type has two underscores, but the variable type has one
> underscore (__JUMP_BUFFER and _JUMP_BUFFER respectively). A comment would
> be nice.
> -- Sean Silva
> On Wed, Mar 4, 2015 at 4:37 PM, Zachary Turner <zturner at google.com> wrote:
>> 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
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150305/6650ed45/attachment.html>

More information about the llvm-commits mailing list