[lldb-dev] [Bug 45676] New: lldb wrongly stopped at a break statement when using step-by-step

via lldb-dev lldb-dev at lists.llvm.org
Sun Apr 26 00:42:39 PDT 2020


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

            Bug ID: 45676
           Summary: lldb wrongly stopped at a break statement when using
                    step-by-step
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          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

$ clang -v
clang version 11.0.0 (/home/yibiao/.cache/yay/llvm-git/llvm-project
871beba234a83a2a02da9dedbd59b91a1bfbd7af)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

$ lldb -v
lldb version 11.0.0
  clang revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af
  llvm revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af



$ clang -g small.c; lldb ./a.out
(lldb) target create "./a.out"
Current executable set to '/home/yibiao/a.out' (x86_64).
(lldb) b small.c:14
Breakpoint 1: where = a.out`main + 57 at small.c:14:16, address =
0x0000000000401149
(lldb) run
Process 237374 launched: '/home/yibiao/a.out' (x86_64)
Process 237374 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000401149 a.out`main at small.c:14:16
   11       for (; g <= 32; ++g)
   12       {
   13         i = 0;
-> 14         for (; i < 1; i++)
   15           while (1 > d)
   16             if (c[b])
   17               break;
(lldb) step
Process 237374 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x0000000000401153 a.out`main at small.c:15:9
   12       {
   13         i = 0;
   14         for (; i < 1; i++)
-> 15           while (1 > d)
   16             if (c[b])
   17               break;
   18       L:
(lldb) step
Process 237374 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x0000000000401193 a.out`main at small.c:14:22
   11       for (; g <= 32; ++g)
   12       {
   13         i = 0;
-> 14         for (; i < 1; i++)
   15           while (1 > d)
   16             if (c[b])
   17               break;
(lldb) step
Process 237374 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000401149 a.out`main at small.c:14:16
   11       for (; g <= 32; ++g)
   12       {
   13         i = 0;
-> 14         for (; i < 1; i++)
   15           while (1 > d)
   16             if (c[b])
   17               break;
(lldb) step
Process 237374 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x00000000004011a1 a.out`main at small.c:17:13
   14         for (; i < 1; i++)
   15           while (1 > d)
   16             if (c[b])
-> 17               break;
   18       L:
   19         if (j)
   20           break;


##################
We can found that, lldb is wrongly stopped at Line:17 when using step command.
However, it behaves as expected when we set breakpoint at line:17 as follows:

$ clang -g small.c; lldb ./a.out
(lldb) target create "./a.out"
Current executable set to '/home/yibiao/a.out' (x86_64).
(lldb) b small.c:17
Breakpoint 1: where = a.out`main + 116 at small.c:17:13, address =
0x0000000000401184
(lldb) run
Process 236754 launched: '/home/yibiao/a.out' (x86_64)
Process 236754 exited with status = 0 (0x00000000) 


$ cat small.c
char a;
short b, d = 5, h;
char c[1];
int e, f = 4, g, j;
int main()
{
  int i;
  for (; f; f = a)
  {
    g = 0;
    for (; g <= 32; ++g)
    {
      i = 0;
      for (; i < 1; i++)
        while (1 > d)
          if (c[b])
            break;
    L:
      if (j)
        break;
    }
  }
  return 0;
}

-- 
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/20200426/e173ab1b/attachment.html>


More information about the lldb-dev mailing list