<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - lldb wrongly stopped at a break statement when using step-by-step"
href="https://bugs.llvm.org/show_bug.cgi?id=45676">45676</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lldb wrongly stopped at a break statement when using step-by-step
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yangyibiao@hust.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ 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;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>