Patch to set is_stmt a little better for prologue lines in a function.

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
This commit is contained in:
Eric Christopher 2012-04-05 20:39:05 +00:00
parent 740cd657f3
commit 60b35f408b
2 changed files with 9 additions and 4 deletions

View 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);
}
}

View 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 {