<div dir="ltr">Sorry, I now understand the phrasing is weird.<div><br></div><div>I've added support for</div><div>a) generating DI for functions without lexical scopes (see the testcase where a function immediately tailcalls)</div>
<div>b) not crashing if it turned out there is in fact no DI for a given function</div><div><br></div><div>Does that make sense now?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-26 19:28 GMT+04:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Wed, Mar 26, 2014 at 2:50 AM, Timur Iskhodzhanov <<a href="mailto:timurrrr@google.com">timurrrr@google.com</a>> wrote:<br>
> Author: timurrrr<br>
> Date: Wed Mar 26 04:50:36 2014<br>
> New Revision: 204790<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204790&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204790&view=rev</a><br>
> Log:<br>
> Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all<br>
<br>
</div>I don't really understand this change from the code involved (perhaps<br>
when I get to the tests it'll make more sense) but what kind of debug<br>
info (since this is in WinCode I assume we're talking about COFF and<br>
we only support line tables there, right?) can you produce for a<br>
function with no debug info? All you have is a function name... which<br>
you'd already have (except inlining?) without emitting any debug<br>
info/line tables.<br>
<br>
So is that what this is - the ability to ascribe non-debug-built<br>
functions inlined into other functions by name, even if you don't have<br>
line/file information for the functions or any of their instructions?<br>
(do we keep track of that through inlining? I would've assumed the<br>
debug intrinsics/per-instruction debug info was the only thing that<br>
told us inlined instructions came from another function)<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Modified:<br>
> llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp<br>
> llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=204790&r1=204789&r2=204790&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=204790&r1=204789&r2=204790&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Wed Mar 26 04:50:36 2014<br>
> @@ -131,9 +131,12 @@ void WinCodeViewLineTables::emitDebugInf<br>
> // For each function there is a separate subsection<br>
> // which holds the PC to file:line table.<br>
> const MCSymbol *Fn = Asm->getSymbol(GV);<br>
> - const FunctionInfo &FI = FnDebugInfo[GV];<br>
> assert(Fn);<br>
> - assert(FI.Instrs.size() > 0);<br>
> +<br>
> + const FunctionInfo &FI = FnDebugInfo[GV];<br>
> + if (FI.Instrs.empty())<br>
> + return;<br>
> + assert(FI.End && "Don't know where the function ends?");<br>
><br>
> // PCs/Instructions are grouped into segments sharing the same filename.<br>
> // Pre-calculate the lengths (in instructions) of these segments and store<br>
> @@ -264,12 +267,6 @@ void WinCodeViewLineTables::beginFunctio<br>
> if (!Asm || !Asm->MMI->hasDebugInfo())<br>
> return;<br>
><br>
> - // Grab the lexical scopes for the function, if we don't have any of those<br>
> - // then we're not going to be able to do anything.<br>
> - LScopes.initialize(*MF);<br>
> - if (LScopes.empty())<br>
> - return;<br>
> -<br>
> const Function *GV = MF->getFunction();<br>
> assert(FnDebugInfo.count(GV) == false);<br>
> VisitedFunctions.push_back(GV);<br>
> @@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(<br>
> if (!Asm || !CurFn) // We haven't created any debug info for this function.<br>
> return;<br>
><br>
> - if (CurFn->Instrs.empty())<br>
> - llvm_unreachable("Can this ever happen?");<br>
> -<br>
> - // Define end label for subprogram.<br>
> - MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();<br>
> - Asm->OutStreamer.EmitLabel(FunctionEndSym);<br>
> - CurFn->End = FunctionEndSym;<br>
> + if (!CurFn->Instrs.empty()) {<br>
> + // Define end label for subprogram.<br>
> + MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();<br>
> + Asm->OutStreamer.EmitLabel(FunctionEndSym);<br>
> + CurFn->End = FunctionEndSym;<br>
> + }<br>
> CurFn = 0;<br>
> }<br>
><br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h?rev=204790&r1=204789&r2=204790&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h?rev=204790&r1=204789&r2=204790&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h Wed Mar 26 04:50:36 2014<br>
> @@ -32,13 +32,13 @@ namespace llvm {<br>
> class WinCodeViewLineTables : public AsmPrinterHandler {<br>
> AsmPrinter *Asm;<br>
> DebugLoc PrevInstLoc;<br>
> - LexicalScopes LScopes;<br>
><br>
> // For each function, store a vector of labels to its instructions, as well as<br>
> // to the end of the function.<br>
> struct FunctionInfo {<br>
> SmallVector<MCSymbol *, 10> Instrs;<br>
> MCSymbol *End;<br>
> + FunctionInfo() : End(0) {}<br>
> } *CurFn;<br>
><br>
> typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy;<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>