[LLVMbugs] [Bug 23076] New: line number info causes erratic stepping in gdb

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 30 15:36:03 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23076

            Bug ID: 23076
           Summary: line number info causes erratic stepping in gdb
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Wolfgang_Pieb at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

int a = 1, b;

int main(void)
{
    if (a
        &&
        b)
        return 1;

    return 0;
}
//*****************

When compiled with -g, the branch instructions that are generated at the end of
the basic blocks that evaluate the conditions get line number entries that
differ from those of the conditions, causing the debugger to skip back to the
if statement's line during single stepping. Some partial IR:

define i32 @main() #0 {
entry:
  %retval = alloca i32, align 4
  store i32 0, i32* %retval
  %0 = load i32, i32* @a, align 4, !dbg !14
  %tobool = icmp ne i32 %0, 0, !dbg !14
  br i1 %tobool, label %land.lhs.true, label %if.end, !dbg !16

land.lhs.true:                                    ; preds = %entry
  %1 = load i32, i32* @b, align 4, !dbg !17
  %tobool1 = icmp ne i32 %1, 0, !dbg !17
  br i1 %tobool1, label %if.then, label %if.end, !dbg !18  <====

...

!4 = !MDSubprogram(name: "main", scope: !1, file: !1, line: 3, type: !5,
isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped,
isOptimized: false, function: i32 ()* @main, variables: !2)

...

!14 = !MDLocation(line: 5, column: 9, scope: !15)
!15 = distinct !MDLexicalBlock(scope: !4, file: !1, line: 5, column: 9)
!16 = !MDLocation(line: 6, column: 9, scope: !15)
!17 = !MDLocation(line: 7, column: 9, scope: !15)
!18 = !MDLocation(line: 5, column: 9, scope: !4) <====


This started happening with r225956.

It seems that the branch instruction should be associated with the same line
and scope as the instructions that evaluate the condition. This is especially
visible with the second branch, as it currently makes the debugger bounce back
to the if when stepping through the condition.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150330/bc676944/attachment.html>


More information about the llvm-bugs mailing list