[PATCH] D39310: [CGBlocks] Improve line info in backtraces containing *_helper_block

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 14:09:26 PDT 2017


vsk added a comment.

Thanks!



================
Comment at: test/CodeGenObjC/debug-info-blocks.m:20
 // CHECK: call {{.*}}, !dbg ![[DBG_LINE:[0-9]+]]
 // CHECK-NOT: ret
 // CHECK: load {{.*}}, !dbg ![[COPY_LINE:[0-9]+]]
----------------
aprantl wrote:
> vsk wrote:
> > aprantl wrote:
> > > aprantl wrote:
> > > > vsk wrote:
> > > > > aprantl wrote:
> > > > > > What's the location used for the ret? I think it should also be` ![[DBG_LINE]]` since we are not actually executing the block.
> > > > > We're using COPY_LINE, which is the same location used for the load instruction below.
> > > > > 
> > > > > What's the semantic difference between DBG_LINE (line 0) and COPY_LINE (line 68) anyway? Why do we have two different locations for the arguments to this function?
> > > > The debugger will skip over line 0 locations when single-stepping or when setting breakpoints. I can't tell without reading the code why we decide to put a line 0 on the call.
> > > The important thing is that the testcase should check that the ret has either COPY_LINE or line 0 on it and not line 71.
> > I'll fix up the test case.
> > 
> > It looks like the zero location is an artifact of CodeGenFunction::StartFunction:
> > ```
> > 1128   // Emit a location at the end of the prologue.                                                                                                                                                            
> > 1129   if (CGDebugInfo *DI = getDebugInfo())                                                                                                                                                                     
> > 1130     DI->EmitLocation(Builder, StartLoc);
> > ```
> > 
> > I think it's unnecessary, but maybe we can look into that separately?
> ... and StartLoc is empty for this function? (which would make sense)
> I think I'm fine with leaving this as is unless you feel strongly about it.
Yes, StartLoc is empty for the function, but I misunderstood the source of the zero location. I think it actually comes from CGDebugInfo::EmitFunctionStart, in the same logic that sets the artificial flag on parameters. It looks like this is intentional so I won't touch it. I'll go ahead and land this fix.


https://reviews.llvm.org/D39310





More information about the cfe-commits mailing list