<div dir="ltr">I think Paweł identified the problem. The frames on the stack between the setjmp and longjmp must have valid unwind information, which is described here:<div><a href="https://msdn.microsoft.com/en-us/library/ft9x1kdx.aspx?f=255&MSPPError=-2147217396">https://msdn.microsoft.com/en-us/library/ft9x1kdx.aspx?f=255&MSPPError=-2147217396</a></div><div><br></div><div>In particular, it has this line about JITed code:</div><div>  "For dynamically generated functions [JIT compilers], the runtime to support these functions must either use RtlInstallFunctionTableCallback or RtlAddFunctionTable to provide this information to the operating system. Failure to do so will result in unreliable exception handling and debugging of processes."</div><div><br></div><div>LLVM does not contain any references to these functions, so I must conclude that unwinding through LLVM JITed frames on Win64 is not supported. Sorry. :-(</div><div><br></div><div>You can try implementing your own setjmp / longjmp pair that bypasses the libc versions. That might work.<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 27, 2015 at 4:23 PM, Dibyendu Majumdar <span dir="ltr"><<a href="mailto:mobile@majumdar.org.uk" target="_blank">mobile@majumdar.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 27 April 2015 at 19:04, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>
> Are you using split stacks of some kind? Are you sure these actually work as<br>
> intended on Win64? Based on the source code, it looks like you are<br>
> allocating stack manually, but I could be wrong.<br>
<br>
</span>Hi,<br>
Lua uses its own stack (which is just an array of value objects), and<br>
Lua functions basically manipulate this data structure.<br>
<span class=""><br>
><br>
> What triple are you using with LLVM to generate code?<br>
<br>
</span>x86_64-pc-windows-msvc-elf<br>
<span class=""><br>
><br>
> There isn't much else information here, but you can try to zero in on the<br>
> problem by checking the stack alignment manually with a helper like:<br>
> void CheckAlignment() {<br>
>   assert((((uintptr_t)_AddressOfReturnAddress() + 8) & 15) == 0);<br>
> }<br>
><br>
> Run this near where LLVM calls back into C code. If it fails, disassemble<br>
> the calling LLVM function and look at that to see if there's something wrong<br>
> with the prologue. Sending that along with any followups would be helpful.<br>
><br>
<br>
</span>Thank you - I will try this, although Pawel's reply on this issue<br>
seems like a plausible explanation.<br>
I am trying to figure out how to dump the disassembly from the<br>
compiled code - it seems not so easy as dumping IR.<br>
I will also try compiling the using clang or gcc to see if that makes<br>
the problem go away.<br>
<br>
Thanks and Regards<br>
<span class=""><font color="#888888">Dibyendu<br>
</font></span></blockquote></div><br></div></div></div>