Patch to set is_stmt a little better for prologue lines in a function.
authorEric Christopher <echristo@apple.com>
Thu, 5 Apr 2012 20:39:05 +0000 (20:39 +0000)
committerEric Christopher <echristo@apple.com>
Thu, 5 Apr 2012 20:39:05 +0000 (20:39 +0000)
This enables debuggers to see what are interesting lines for a
breakpoint rather than any line that starts a function.

rdar://9852092

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/X86/ending-run.ll

index b3a9a14a1b6396dc4a1e55df21f09ee810ca40a4..cb7887890cdac9c3640c659cba210cf55ac4ec80 100644 (file)
@@ -1093,12 +1093,15 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
   if (!MI->isDebugValue()) {
     DebugLoc DL = MI->getDebugLoc();
     if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
-      unsigned Flags = DWARF2_FLAG_IS_STMT;
+      unsigned Flags = 0;
       PrevInstLoc = DL;
       if (DL == PrologEndLoc) {
         Flags |= DWARF2_FLAG_PROLOGUE_END;
         PrologEndLoc = DebugLoc();
       }
+      if (PrologEndLoc.isUnknown())
+        Flags |= DWARF2_FLAG_IS_STMT;
+
       if (!DL.isUnknown()) {
         const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
         recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
@@ -1378,7 +1381,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
                                        MF->getFunction()->getContext());
     recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(),
                      FnStartDL.getScope(MF->getFunction()->getContext()),
-                     DWARF2_FLAG_IS_STMT);
+                     0);
   }
 }
 
index 0cd3de1da9526c2536acb3b0c98f4deb2cd5f069..6935c47d0cf6ccd18933f7daed4932be0652455e 100644 (file)
@@ -1,9 +1,11 @@
 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump %t | FileCheck %s
 
-; Check that the line table starts at 7, not 4.
+; Check that the line table starts at 7, not 4, but that the first
+; statement isn't until line 8.
 
-; CHECK: 0x0000000000000000      7      0      1   0  is_stmt
+; CHECK-NOT: 0x0000000000000000      7      0      1   0  is_stmt
+; CHECK: 0x0000000000000000      7      0      1   0
 ; CHECK: 0x0000000000000004      8     18      1   0  is_stmt prologue_end
 
 define i32 @callee(i32 %x) nounwind uwtable ssp {