[llvm-dev] CodeView and "line 0" ?

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 17 14:25:22 PDT 2016


Fred's patch does some bookkeeping to identify instructions that aren't properly attributed anywhere, and turn that into a line-0 record for DWARF in beginInstruction().  Given that CodeView has a "nothing to see here" line number, which happens to be different from DWARF's, I'm now inclined to put the bookkeeping into the base class and let the DWARF and CodeView subclasses use it as appropriate.
Thanks guys!
--paulr

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of David Majnemer via llvm-dev
Sent: Wednesday, August 17, 2016 1:23 PM
To: Reid Kleckner
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] CodeView and "line 0" ?



On Wed, Aug 17, 2016 at 1:09 PM, Reid Kleckner via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
I mean, we just skip over instructions without a DebugLoc:

void CodeViewDebug::beginInstruction(const MachineInstr *MI) {
  DebugHandlerBase::beginInstruction(MI);

  // Ignore DBG_VALUE locations and function prologue.
  if (!Asm || !CurFn || MI->isDebugValue() ||
      MI->getFlag(MachineInstr::FrameSetup))
    return;
  DebugLoc DL = MI->getDebugLoc();
  if (DL == PrevInstLoc || !DL)
    return;
  maybeRecordLocation(DL, Asm->MF);
}

Seems reasonable to extend the condition with ' || DL->getLine() == 0'. I'm not aware of a good way to say "this instruction is not associated with any line" in CodeView.

Perhaps we could set emit line 0 as line number 0xfeefee (AlwaysStepIntoLineNumber).
https://blogs.msdn.microsoft.com/jmstall/2005/06/19/line-hidden-and-0xfeefee-sequence-points/


On Wed, Aug 17, 2016 at 12:51 PM, Adrian Prantl via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
Note that clang is also assigning line 0 to code that doesn't have a corresponding source location. So CodeView needs to deal with this already, though I don't know how it currently handles this.

-- adrian

> On Aug 17, 2016, at 11:43 AM, Robinson, Paul via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
>
> I've been playing with Fred Riss's "line 0" patch for DWARF
> (https://reviews.llvm.org/D16569) but in adapting it for current trunk,
> I find the DwarfDebug stuff has been refactored to allow either DWARF
> or CodeView.  That's all good, but the question is whether the "line 0"
> patch should be DWARF-specific or common.  The DWARF spec explicitly
> states that code not associated with any particular source location
> should be associated with line number 0.  I don't know what CodeView
> (or debuggers that consume CodeView) would think of seeing "line 0" show
> up in the debug info.
>
> Does anybody know?
> Thanks,
> --paulr
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160817/144ae313/attachment.html>


More information about the llvm-dev mailing list