<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 - volatile lead to inconsistent behaviors between step-by-step and stepi-by-stepi in lldb"
href="https://bugs.llvm.org/show_bug.cgi?id=45998">45998</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>volatile lead to inconsistent behaviors between step-by-step and stepi-by-stepi in lldb
</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 --version
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
$ lldb --version
lldb version 11.0.0
clang revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af
llvm revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af
$ clang -g -O3 small.c;
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 5 at small.c:8:6, address =
0x0000000000401125
(lldb) r
Process 2172958 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 2172958 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401125 a.out`main at small.c:8:6
5
6 int main() {
7 char a;
-> 8 pa = &a;
9
10 foo(pa);
11
(lldb) s
Process 2172958 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x000000000040112c a.out`main at small.c:10
7 char a;
8 pa = &a;
9
-> 10 foo(pa);
11
12 return 0;
13 }
(lldb) s
Process 2172958 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x000000000040112c a.out`main [inlined] foo(ptr="") at
small.c:3:8
1 char *pa;
2 void foo(volatile char *ptr) {
-> 3 *ptr = 'x';
4 }
5
6 int main() {
7 char a;
(lldb) s
Process 2172958 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x0000000000401131 a.out`main at small.c:12:3
9
10 foo(pa);
11
-> 12 return 0;
13 }
(lldb)
/*************************************
We can find that Line #3 is hit by lldb when step-by-step.
However, Line #3 will be not hit by lldb when stepi-by-stepi
***************************************/
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 5 at small.c:8:6, address =
0x0000000000401125
(lldb) r
Process 2173507 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 2173507 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401125 a.out`main at small.c:8:6
5
6 int main() {
7 char a;
-> 8 pa = &a;
9
10 foo(pa);
11
(lldb) si
Process 2173507 stopped
* thread #1, name = 'a.out', stop reason = instruction step into
frame #0: 0x000000000040112c a.out`main at small.c:10
7 char a;
8 pa = &a;
9
-> 10 foo(pa);
11
12 return 0;
13 }
(lldb) si
Process 2173507 stopped
* thread #1, name = 'a.out', stop reason = instruction step into
frame #0: 0x0000000000401131 a.out`main at small.c:12:3
9
10 foo(pa);
11
-> 12 return 0;
13 }
(lldb)
$ cat small.c
char *pa;
void foo(volatile char *ptr) {
*ptr = 'x';
}
int main() {
char a;
pa = &a;
foo(pa);
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>