[lldb-dev] [Bug 45603] New: lldb wrongly stopped at a return statement within a for loop

via lldb-dev lldb-dev at lists.llvm.org
Sat Apr 18 19:50:14 PDT 2020


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

            Bug ID: 45603
           Summary: lldb wrongly stopped at a return statement within a
                    for loop
           Product: lldb
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: yangyibiao at hust.edu.cn
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

$ lldb -v
lldb version 9.0.1


$ cat small.c
int main()
{
  int j = 0, d = 0;
  if (j>=0)
    for (; d; d++)
      return 0;
  return 0;
}


$ clang -g small.c; lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) b small.c:5
Breakpoint 1: where = a.out`main + 35 at small.c:5:5, address =
0x0000000000001143
(lldb) run
Process 877280 launched: '/home/yibiao/cv-gcov/a.out' (x86_64)
Process 877280 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555555143 a.out`main at small.c:5:5
   2    {
   3      int j = 0, d = 0;
   4      if (j>=0)
-> 5        for (; d; d++)
   6          return 0;
   7      return 0;
   8    }
(lldb) fr v
(int) j = 0
(int) d = 0
(lldb) step
Process 877280 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x000055555555515e a.out`main at small.c:6:14
   3      int j = 0, d = 0;
   4      if (j>=0)
   5        for (; d; d++)
-> 6          return 0;
   7      return 0;
   8    }
(lldb) step
Process 877280 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x0000555555555163 a.out`main at small.c:7:3
   4      if (j>=0)
   5        for (; d; d++)
   6          return 0;
-> 7      return 0;
   8    }


*****
lldb is wrongly stopped at line 6. Before that, d is 0. Thus, the 6th statement
 should be not executed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200419/5a9f5f99/attachment.html>


More information about the lldb-dev mailing list