<html><body bgcolor="#FFFFFF"><div><br></div><div><br>On Oct 10, 2010, at 7:21 PM, Talin <<a href="mailto:viridia@gmail.com">viridia@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>On Sun, Oct 10, 2010 at 9:54 AM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com"><a href="mailto:viridia@gmail.com">viridia@gmail.com</a></a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

BTW, the reason I stopped responding to this thread is not because I solved the problem, but because I simply gave up and decided to work on other things for a while since I was making no progress. Having finished those other things (the stack crawler, for one), I'm hoping that time and a fresh start will yield better results. Unfortunately after about a day spent reviewing old llvm-dev threads and trying different permutations of calls to DIFactory, I have not discovered anything that I didn't already know.<div>


<br></div><div>With respect to the suggestion of building my own copy of dwarfdump (so that I could run it under gdb and see where it breaks), I never did get it to compile and run on OS X, since it requires ELF headers and libs. I thought about doing the same thing under Linux, however dwarfdump doesn't segfault on Linux when I feed it my LLVM-generated binary. (It does report errors, however: "dwarf_srclines: DW_DLE_ATTR_FORM_BAD". The weird part is that it does this even when I completely disable the code that calls IRBuilder.SetCurrentDebugLocation()).</div>

</blockquote><div><br></div><div>Interestingly enough, I just upgraded to the latest Ubuntu (10.10 - Maverick Meercat), and the LLVM-generated code no longer builds: I get the following error in the assembler stage (after the bitcode is converted to assembly):</div>

<div><br></div><div><div>   SwitchStmtTest.s: Assembler messages:</div><div>   SwitchStmtTest.s:294899: Fatal error: duplicate .debug_line sections</div></div><div><br></div></div></div></blockquote><div><br></div>This is a known Linux binutils bug. There is a llvm pr in bugzilla database, I don't remember the no. though.<div>-</div><div>Devang<br><blockquote type="cite"><div><div class="gmail_quote"><div>Note that this is still with calls to IRBuilder.SetCurrentDebugLocation() disabled - My FE is not emitting any debug line information at all at this time.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><br></div><div>As per usual, this is with a recent LLVM head (like about a week old).<br><div><div><div></div><div class="h5"><br><div class="gmail_quote">On Tue, Sep 7, 2010 at 9:21 AM, Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com" target="_blank"><a href="mailto:dpatel@apple.com">dpatel@apple.com</a></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"><div><br><div><div>On Sep 7, 2010, at 9:11 AM, Renato Golin wrote:</div><br>
<blockquote type="cite"><div>On 7 September 2010 16:49, Devang Patel <<a href="mailto:dpatel@apple.com" target="_blank"><a href="mailto:dpatel@apple.com">dpatel@apple.com</a></a>> wrote:<br><blockquote type="cite">Your recent changes mentioned below would change correctness of debug info,<br>


</blockquote><blockquote type="cite">but it would unlikely to impact structure of DWARF generated. And somehow,<br></blockquote><blockquote type="cite">this structure is invalid in your case.<br></blockquote><br>I was hoping for a quick-fix on the assumptions of DwarfDebug about<br>


Subprograms' MDNodes, but it might be anywhere.<br><br>Reducing the test case is the best solution, but it might not be easy.<br><br>Validating the MDNodes in DIFactory (or anywhere before DwarfDebug)<br>would be a good step to ensure IR consistency and isolate problems.<br>


Unfortunately, it is the kind of thing that is not fundamental to get<br>things working, so it always gets left behind... ;)<br><font color="#000000"><font color="#144FAE"><br></font></font></div></blockquote><br></div></div>


<div>I understand your point and certainly acknowledge need for better documentation.</div><div><br></div><div>There are couple of wrinkles to note here</div><div>- While constructing IR using DIFactory you are not seeing entire picture. When you see a declaration you're not sure whether you'll see matching def. or not. When you build a inlined subprogram, you don't know whether you'll see a out of line definition of this function or not. etc...</div>


<div>- DwarfDebug must be able to handle malformed debug info gracefully and make best out of whatever is fed. This is because, optimizer may have chewed on IR mercilessly and optimizer must not be influenced by presence of encoded debug info in IR.</div>


<div><br></div><div>-</div><div>Devang</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br>-- Talin<br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>
</div></blockquote></div></body></html>