<div dir="ltr">Ah, no. Debug build fails because of DWARF2 .file directives added by GCC.<div><div><br><div><div class="gmail_extra"><div class="gmail_quote">On Sun, May 28, 2017 at 5:44 AM, Yusuke SUZUKI <span dir="ltr"><<a href="mailto:utatane.tea@gmail.com" target="_blank">utatane.tea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Recently, I've just found that this works fine with my GCC environment (Linux x64 GCC 5.4.0, AS 2.26.1).<div>I think we can enable it when compiling JSC with a newer GCC.</div><div><br></div><div>For WebKitGTK+ folks, can you reproduce it with your GCC versions?</div></div><div class="gmail_extra"><br clear="all"><div><div class="m_-1891653746226414904gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,<br>Yusuke Suzuki</div></div></div></div><div><div class="h5">
<br><div class="gmail_quote">On Wed, Jan 6, 2016 at 6:27 AM, Michael Saboff <span dir="ltr"><<a href="mailto:msaboff@apple.com" target="_blank">msaboff@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Konstantin,<div><br></div><div>Interesting results.</div><div><br></div><div>[More inline]</div><div><br></div><div>- Michael</div><div><br><div><span><blockquote type="cite"><div>On Jan 5, 2016, at 12:55 PM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>> wrote:</div><br class="m_-1891653746226414904m_2692289990041576936Apple-interchange-newline"><div><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">04.01.2016, 23:02, "Michael Saboff" <</span><a href="mailto:msaboff@apple.com" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">msaboff@apple.com</a><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">>:</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Konstantin,<br><br>Provided that gcc & gdb work with Dwarf2 .loc and .file directives and gcc can handle multiple .file directives in one file, it should work with that toolchain.  I just haven’t tested it.<br><br>The single line change I added to the processor specific files, e.g. arm.rb, would need to be added to mips.rb and the other processor backend .rb files.  I also didn’t make those since I can’t test them either.<br><br>If you could try add the single line change to mips.rb and test on gcc / gdb that would be great.<br></blockquote><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I've tried your patch with gcc/gdb on x86_64 and MIPS (both Linux). Here are results:</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">1. GCC itself does not care about .file directives at all, ignoring contents of asm completely</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">2. After this, GNU as bails out because of 2 copies of .file 1 etc. To fix this problem, I've applied attached patch to your code, adding offset to file numbers. This offset unfortunately depends on how many .file directives were emitted by GCC itself, and it cannot be set to large number like 1000 because as does not accept holes.</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote><div><br></div></span><div>If you look at the assembler output of <i>gcc -s … LowLevelInterpreter.cpp</i>, does it show a <i>.file</i> directive for <i>LowLevelInterpreter.cpp</i> itself?  Likely we’ll need <i>$fileIndexOffset</i> initialized differently depending on the platform / compiler.</div><span><br><blockquote type="cite"><div><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">3. After this change, compilation succeeds on both x86_64 and MIPS in debug and release. However, source debug works fine only in release (on both MIPS and x86_64), it looks like in debug mode gdb is confused (setting breakpoints sort of works, but gdb fails to link currently executed instruction with source)</span><br></div></blockquote><div><br></div></span><div>What I tested with lldb is stack traces, single stepping and breakpoints, although breakpoints weren’t the most reliable.  Does single stepping and stack traces work for debug builds?  Does a release build provide reasonable behavior for all aspects of debugging LLInt .asm files?</div><span><br><blockquote type="cite"><div><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I can think of the next possible workarounds:</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">1. Always build LowLevelInterpreter.cpp in Release mode, because all interesting debug info is in asm.</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">2. Make offlineasm produce separate .S (preprocessed asm) source file which won't be touched by C++ compiler at all.</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote><div><br></div></span><div>I don’t like option 1.  Hard coding <i>LowLevelInterpreter.cpp</i><wbr> to be always build release could get messy and is not what we want when compiling for the C-Loop or probably for Windows.  Option 2 is what happens with Windows builds.  That is a possible, although still a problematic option.  The offline assembler would need to be taught about symbol exporting and creating the sections, etc for all platforms.  Much of this could be done with canned header and footer files that are output as part of the offline assembler processing.  There would likely need to be different files for different platforms.  That would create a maintenance overhead when introducing a new compiler or major compiler upgrade.  That is why the current method of passing the inline assembly through the C++ compiler is attractive.</div><div><br></div><div>Let’s try to find a good solution for the duplicate .file problem before we go down an option 2 path.</div><div><br></div><blockquote type="cite"><div><div><div class="m_-1891653746226414904h5"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>- Michael<br><br><blockquote type="cite">On Jan 4, 2016, at 11:47 AM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>> wrote:<br><br>04.01.2016, 22:39, "Michael Saboff" <<a href="mailto:msaboff@apple.com" target="_blank">msaboff@apple.com</a>>:<br><blockquote type="cite">Konstantin,<br><br>Actually, that change hasn’t been landed.  I have been waiting for a fix in the clang toolchain.  I have provided that fix to the clang team, but it hasn’t landed yet.<br><br>I posted my DWARF2 changes to the bug: <<a href="https://bugs.webkit.org/show_bug.cgi?id=152703" target="_blank">https://bugs.webkit.org/show_<wbr>bug.cgi?id=152703</a>> - “offlineasm: Emit Dwarf2 file and location directives to allow for debugging .asm files”.<br><br>I’ll work with the clang team to get that change done.<br><br>If you are willing, it would be good to get gcc/gdb working with the change as well.  I only did changes for the compiler (clang) and CPUs (X86, ARM & ARM64) that I could test.<br></blockquote><br>Michael,<br><br>Problem is that I'm using gcc (and my target is MIPS). Does your change work with GCC, or this is clang-only feature?<br><br>Though I guess it should be feasible to build one assembly file with clang using its MIPS backend, and use gcc for the rest of build.<br><br><blockquote type="cite">- Michael<br><br><blockquote type="cite">On Jan 4, 2016, at 10:47 AM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>> wrote:<br><br>04.01.2016, 21:41, "Geoffrey Garen" <<a href="mailto:ggaren@apple.com" target="_blank">ggaren@apple.com</a>>:<br><blockquote type="cite">Michael Saboff recently added file and line number annotations to offlineasm.<br><br>What other kinds of information would you add using DWARF? How would you update the DWARF information when the .asm file changed?<br></blockquote><br>I thought it would be useful to have files and line numbers as DWARF instead of comments so it would be easier to single-step with gdb.<br><br>Also, macros could be annotated as inline functions.<br><br>However, for now I've fixed crash that I was struggling with.<br><br><blockquote type="cite">Geoff<br><br><blockquote type="cite"> On Jan 3, 2016, at 12:48 PM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>> wrote:<br><br> Hi JSC developers,<br><br> Haven't you ever considered adding DWARF information into assembly produced by offlineasm? I'm trying to fix MIPS backend right now, and I thought it may be useful to debug crashes in LLINT.<br><br> --<br> Regards,<br> Konstantin<br> _____________________________<wbr>__________________<br> jsc-dev mailing list<br> <a href="mailto:jsc-dev@lists.webkit.org" target="_blank">jsc-dev@lists.webkit.org</a><br> <a href="https://lists.webkit.org/mailman/listinfo/jsc-dev" target="_blank">https://lists.webkit.org/mail<wbr>man/listinfo/jsc-dev</a><br></blockquote></blockquote><br>--<br>Regards,<br>Konstantin<br>______________________________<wbr>_________________<br>jsc-dev mailing list<br><a href="mailto:jsc-dev@lists.webkit.org" target="_blank">jsc-dev@lists.webkit.org</a><br><a href="https://lists.webkit.org/mailman/listinfo/jsc-dev" target="_blank">https://lists.webkit.org/mailm<wbr>an/listinfo/jsc-dev</a><br></blockquote></blockquote><br>--<br>Regards,<br>Konstantin<br></blockquote></blockquote><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">--<span class="m_-1891653746226414904m_2692289990041576936Apple-converted-space"> </span></span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Regards,</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Konstantin</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></div><span id="m_-1891653746226414904m_2692289990041576936cid:69F2FF87-92ED-4ECD-88D2-1722DC433C72@apple.com"><parser.patch></span></div></blockquote></div><br></div></div><br>______________________________<wbr>_________________<br>
jsc-dev mailing list<br>
<a href="mailto:jsc-dev@lists.webkit.org" target="_blank">jsc-dev@lists.webkit.org</a><br>
<a href="https://lists.webkit.org/mailman/listinfo/jsc-dev" rel="noreferrer" target="_blank">https://lists.webkit.org/mailm<wbr>an/listinfo/jsc-dev</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div></div>