<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">After the initial success I tried compiling several benchmarks with the -debug-ir enabled, but failed on most of them.<div>In one of the benchmarks I get the following assertion error in llc (after the opt -debug-ir pass) </div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">llc: DwarfUnit.cpp:963: llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*): Assertion `ContextDIE’ failed</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div>and in another benchmark I get this assertion error from opt (when using the -debug-ir) pass</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">opt: DataLayout.cpp:632: unsigned int llvm::DataLayout::getAlignment(llvm::Type*, bool) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"’ failed</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div>The -debug-ir pass does not work seamlessly. It may work for some applications if you’re lucky.</div><div><br></div><div>/Muneeb</div><div><br><div><div>On 15 Oct 2014, at 18:54, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">+Daniel Malea, so he knows this is currently broken.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 15, 2014 at 9:52 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@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">Could I interest you in contributing a patch that fixes this for -debug-ir? Maybe even with the DIBuilder interface David mentioned? :-)<span class="HOEnZb"><font color="#888888"><br></font></span><div><span class="HOEnZb"><font color="#888888">-- adrian</font></span><div><div class="h5"><br><div><blockquote type="cite"><div>On Oct 15, 2014, at 9:51 AM, Muneeb Khan <<a href="mailto:muneeb.khan@it.uu.se" target="_blank">muneeb.khan@it.uu.se</a>> wrote:</div><br><div><div style="word-wrap:break-word">Adding the flags in an opt pass seems to do the trick. I added the flags as follows<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">M.addModuleFlag(llvm::Module::Warning, <span style="color:#d12f1b">"Dwarf Version"</span>, <span style="color:#272ad8">3</span>);</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">M.addModuleFlag(llvm::Module::Error, <span style="color:#d12f1b">"Debug Info Version"</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                             llvm::DEBUG_METADATA_VERSION);</div></div><div><br></div><div>llvm-dwarfdump and addr2line now point at a line in .ll files, not the source files.</div><div><br></div><div>Thanks!</div><div><br></div><div>/Muneeb</div><div><br><div><div>On 15 Oct 2014, at 18:22, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">(similarly for the dwarf version flag)</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 15, 2014 at 9:22 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Oct 15, 2014 at 9:04 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@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">I have no experience with debug-ir, but is it possible that the debug-ir pass never sets the debug info version? There should be a named metadata node <div>  !llvm.module.flags = !{..., !123}</div><div>  !123 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}<br><div>in the .ll output. If it is missing, just have a look at the clang sources for an example how to add a module flag.</div></div></div></blockquote><div><br></div></span><div>Perhaps this should be built into DIBuilder, but I'm not sure.<br><br>Yeah, looking at how it's implemented, this isn't ideal - we've got the string "Debug Info Version" written in Clang and in LLVM, not using a shared constant or common utility functions owned in the same place. This should probably be part of DIBuilder in some way or another so that clients don't have to duplicate this string, etc.<span><font color="#888888"><br><br>- David</font></span></div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span><font color="#888888"><div><br></div><div>-- adrian</div></font></span><div><div><br></div><div><br><blockquote type="cite"><div>On Oct 15, 2014, at 8:20 AM, Muneeb Khan <<a href="mailto:muneeb.khan@it.uu.se" target="_blank">muneeb.khan@it.uu.se</a>> wrote:</div><br><div><div style="word-wrap:break-word">Yes, I am using opt and llc from the same version (3.5).<div>I know that there were issues with debug-ir in 3.4. I have explored the source tree myself for 3.5 and I know that the pass -debug-ir does kick in with opt.</div><div>But I have no clue of what happens with the debug information in (and after) the llc pass.</div><div><br></div><div>/Muneeb</div><div><br></div><div><div>On 15 Oct 2014, at 17:14, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 15, 2014 at 7:08 AM, Muneeb Khan <span dir="ltr"><<a href="mailto:muneeb.khan@it.uu.se" target="_blank">muneeb.khan@it.uu.se</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">Hi,<div>I am using the -debug-ir pass in LLVM-3.5 opt tool to map binary information back to the IR instead of the source files.</div><div>I use the opt tool to  generate a .ll file. But when I run the llc tool on it to generate an assembly (or object) file, it gives me the following warning</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">warning: ignoring debug info with an invalid version (0) in </div></div></div></blockquote><div><br>Are you using opt and llc from the same LLVM version? (mixing and matching could produce this problem)<br><br>Or possibly debug-ir was never updated to produce the dubug info version - Adrian?</div><div> </div><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 style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div>How can I use the debug-ir functionality to achieve a mapping from the binary to the IR?</div><div>Thanks!</div><span><font color="#888888"><br>Muneeb Khan<br>PhD student<br>Department of Information Technology,<br>Uppsala University,<br>Sweden<br>Tel: <a href="tel:%2B46%2018%20-%20471%201049" value="+46184711049" target="_blank">+46 18 - 471 1049</a><br><br><br>


<br></font></span></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br><div>
<span style="border-collapse:separate;border-spacing:0px"><br>Muneeb Khan<br>PhD student<br>Department of Information Technology,<br>Uppsala University,<br>Sweden<br>Tel: <a href="tel:%2B46%2018%20-%20471%201049" value="+46184711049" target="_blank">+46 18 - 471 1049</a><br><br><br></span>

</div>
<br></div></div></blockquote></div><br></div></div></blockquote></div></div><br></div></div>
</blockquote></div><br></div>
</blockquote></div><br><div>
<span style="border-collapse:separate;border-spacing:0px"><br>Muneeb Khan<br>PhD student<br>Department of Information Technology,<br>Uppsala University,<br>Sweden<br>Tel: <a href="tel:%2B46%2018%20-%20471%201049" value="+46184711049" target="_blank">+46 18 - 471 1049</a><br><br><br></span>

</div>
<br></div></div></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><br>Muneeb Khan<br>PhD student<br>Department of Information Technology,<br>Uppsala University,<br>Sweden<br>Tel: +46 18 - 471 1049<br><br><br></span>

</div>
<br></div></body></html>