<div dir="ltr">I can say a bit about them. We inherited these directives from the gnu assembler, and a similar question was asked about GCC here:<div><a href="https://stackoverflow.com/questions/20819927/what-are-seh-assembly-commands-that-gcc-outputs/38181874">https://stackoverflow.com/questions/20819927/what-are-seh-assembly-commands-that-gcc-outputs/38181874</a> </div><div><br></div><div>Basically, these directives do not emit instructions, they record metadata about the prologue. Later, the .seh_handlerdata directive emits that metadata into an .xdata section, encoded according to these rules:</div><div><a href="https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64?view=vs-2019">https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64?view=vs-2019</a> </div><div><br></div><div>So, truly, these directives describe how to unwind the stack. They do not describe how __try / __except work. That is controlled by the data after .seh_handlerdata. Those bytes are typically known as the LSDA, "language-specific data area".  The personality function __C_specific_handler interprets the LSDA to handle exceptions.<br></div><div><br></div><div>Hope that helps.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 20, 2020 at 12:53 AM Gaier, Bjoern via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="DE">
<div class="gmail-m_-1136800259897934761WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello Clang-Developers,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">I have a question about the assembly output Clang-Cl generated for me, when passing /Fa. The code was using a __try and __except statement and I wanted to see how the __try statement is represented in the target assembly.
 To my surprise there was no ".cv_loc" for that specific line - so I scrolled up a bit.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">There I found:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">push      rbp<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_pushreg 5<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">sub        rsp, 48<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_stackalloc 48<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">lea          rbp, [rsp + 48]<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_setframe 5, 48<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_endprologue<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">I looked up those words and only could find out that those are pseudo code. I wonder, why am I not allowed to see the content behind those pseudo code? Is there a way to find out what will be written there later?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">I also found the following lines in a different code which really confused me:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">push      rax<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_stackalloc 8<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">.seh_endprologue<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Even though there is written "stackalloc" the rsp is not changed, but in the code I posted above it was changed.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kind greetings<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Björn<u></u><u></u></span></p>
</div>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
</div>

_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>