[llvm] r204790 - Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all
Timur Iskhodzhanov
timurrrr at google.com
Thu Mar 27 01:53:17 PDT 2014
Good point -- see r204902.
2014-03-27 0:18 GMT+04:00 David Blaikie <dblaikie at gmail.com>:
> On Wed, Mar 26, 2014 at 12:59 PM, Timur Iskhodzhanov
> <timurrrr at google.com> wrote:
> > Sorry, I now understand the phrasing is weird.
> >
> > I've added support for
> > a) generating DI for functions without lexical scopes (see the testcase
> > where a function immediately tailcalls)
> > b) not crashing if it turned out there is in fact no DI for a given
> function
> >
> > Does that make sense now?
>
> Ah, OK.
>
> It might've been nice to have this as two separate patches.
>
> The test case for (a) could use some explanatory comments (and
> possibly an explanatory name - you can mention the PR somewhere in
> there, but it's sort of difficult to work with if that's the /only/
> explanation given so you have to consult the PR to understand what's
> being tested)
>
> >
> >
> > 2014-03-26 19:28 GMT+04:00 David Blaikie <dblaikie at gmail.com>:
> >
> >> On Wed, Mar 26, 2014 at 2:50 AM, Timur Iskhodzhanov <
> timurrrr at google.com>
> >> wrote:
> >> > Author: timurrrr
> >> > Date: Wed Mar 26 04:50:36 2014
> >> > New Revision: 204790
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=204790&view=rev
> >> > Log:
> >> > Fix PR19239 - Add support for generating debug info for functions
> >> > without lexical scopes and/or debug info at all
> >>
> >> I don't really understand this change from the code involved (perhaps
> >> when I get to the tests it'll make more sense) but what kind of debug
> >> info (since this is in WinCode I assume we're talking about COFF and
> >> we only support line tables there, right?) can you produce for a
> >> function with no debug info? All you have is a function name... which
> >> you'd already have (except inlining?) without emitting any debug
> >> info/line tables.
> >>
> >> So is that what this is - the ability to ascribe non-debug-built
> >> functions inlined into other functions by name, even if you don't have
> >> line/file information for the functions or any of their instructions?
> >> (do we keep track of that through inlining? I would've assumed the
> >> debug intrinsics/per-instruction debug info was the only thing that
> >> told us inlined instructions came from another function)
> >>
> >> >
> >> > Modified:
> >> > llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
> >> > llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h
> >> >
> >> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=204790&r1=204789&r2=204790&view=diff
> >> >
> >> >
> ==============================================================================
> >> > --- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
> >> > (original)
> >> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Wed
> Mar
> >> > 26 04:50:36 2014
> >> > @@ -131,9 +131,12 @@ void WinCodeViewLineTables::emitDebugInf
> >> > // For each function there is a separate subsection
> >> > // which holds the PC to file:line table.
> >> > const MCSymbol *Fn = Asm->getSymbol(GV);
> >> > - const FunctionInfo &FI = FnDebugInfo[GV];
> >> > assert(Fn);
> >> > - assert(FI.Instrs.size() > 0);
> >> > +
> >> > + const FunctionInfo &FI = FnDebugInfo[GV];
> >> > + if (FI.Instrs.empty())
> >> > + return;
> >> > + assert(FI.End && "Don't know where the function ends?");
> >> >
> >> > // PCs/Instructions are grouped into segments sharing the same
> >> > filename.
> >> > // Pre-calculate the lengths (in instructions) of these segments
> and
> >> > store
> >> > @@ -264,12 +267,6 @@ void WinCodeViewLineTables::beginFunctio
> >> > if (!Asm || !Asm->MMI->hasDebugInfo())
> >> > return;
> >> >
> >> > - // Grab the lexical scopes for the function, if we don't have any
> of
> >> > those
> >> > - // then we're not going to be able to do anything.
> >> > - LScopes.initialize(*MF);
> >> > - if (LScopes.empty())
> >> > - return;
> >> > -
> >> > const Function *GV = MF->getFunction();
> >> > assert(FnDebugInfo.count(GV) == false);
> >> > VisitedFunctions.push_back(GV);
> >> > @@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(
> >> > if (!Asm || !CurFn) // We haven't created any debug info for this
> >> > function.
> >> > return;
> >> >
> >> > - if (CurFn->Instrs.empty())
> >> > - llvm_unreachable("Can this ever happen?");
> >> > -
> >> > - // Define end label for subprogram.
> >> > - MCSymbol *FunctionEndSym =
> >> > Asm->OutStreamer.getContext().CreateTempSymbol();
> >> > - Asm->OutStreamer.EmitLabel(FunctionEndSym);
> >> > - CurFn->End = FunctionEndSym;
> >> > + if (!CurFn->Instrs.empty()) {
> >> > + // Define end label for subprogram.
> >> > + MCSymbol *FunctionEndSym =
> >> > Asm->OutStreamer.getContext().CreateTempSymbol();
> >> > + Asm->OutStreamer.EmitLabel(FunctionEndSym);
> >> > + CurFn->End = FunctionEndSym;
> >> > + }
> >> > CurFn = 0;
> >> > }
> >> >
> >> >
> >> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h?rev=204790&r1=204789&r2=204790&view=diff
> >> >
> >> >
> ==============================================================================
> >> > --- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h
> (original)
> >> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h Wed Mar
> 26
> >> > 04:50:36 2014
> >> > @@ -32,13 +32,13 @@ namespace llvm {
> >> > class WinCodeViewLineTables : public AsmPrinterHandler {
> >> > AsmPrinter *Asm;
> >> > DebugLoc PrevInstLoc;
> >> > - LexicalScopes LScopes;
> >> >
> >> > // For each function, store a vector of labels to its instructions,
> >> > as well as
> >> > // to the end of the function.
> >> > struct FunctionInfo {
> >> > SmallVector<MCSymbol *, 10> Instrs;
> >> > MCSymbol *End;
> >> > + FunctionInfo() : End(0) {}
> >> > } *CurFn;
> >> >
> >> > typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy;
> >> >
> >> >
> >> > _______________________________________________
> >> > llvm-commits mailing list
> >> > llvm-commits at cs.uiuc.edu
> >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140327/edecaa10/attachment.html>
More information about the llvm-commits
mailing list