<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 - An address belongs to different source code lines when debugging at source-level and instruction-level"
href="https://bugs.llvm.org/show_bug.cgi?id=48468">48468</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>An address belongs to different source code lines when debugging at source-level and instruction-level
</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@nju.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24260" name="attach_24260" title="binary">attachment 24260</a> <a href="attachment.cgi?id=24260&action=edit" title="binary">[details]</a></span>
binary
$ clang -v
Ubuntu clang version
12.0.0-++20201202063839+f0193623297-1~exp1~20201202174527.2077
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ lldb -v
lldb version 12.0.0
$ cat small.c
int a[2];
int foo(int n)
{
switch(n) {
case 0:
for(n = 7, a[0]++; 0;) {
case 2:
a[1] = a[0] + 1;
}
}
return n;
}
void main()
{
foo(0);
foo(2);
}
$ clang -O2 -g small.c
$ lldb a.out
(lldb) b main
Breakpoint 1: where = a.out`main [inlined] foo at small.c:17, address =
0x00000000004004d0
(lldb) r
frame #0: 0x00000000004004d0 a.out`main [inlined] foo(n=7) at small.c:7:22
-> 7 for(n = 7, a[0]++; 0;) {
(lldb) s
frame #0: 0x00000000004004df a.out`main at small.c:18
-> 18 foo(2);
(lldb) s
frame #0: 0x00000000004004df a.out`main [inlined] foo(n=2) at small.c:9:21
-> 9 a[1] = a[0] + 1;
(lldb)
###############################################
when step line by line, 0x00000000004004df belongs to Line 18 and Line 9.
However, when step instruction by instruction, 0x00000000004004df only belongs
to Line 18 as follow.
###############################################
$ lldb a.out
(lldb) b main
Breakpoint 1: where = a.out`main [inlined] foo at small.c:17, address =
0x00000000004004d0
(lldb) r
frame #0: 0x00000000004004d0 a.out`main [inlined] foo(n=7) at small.c:7:22
-> 7 for(n = 7, a[0]++; 0;) {
(lldb) si
frame #0: 0x00000000004004d6 a.out`main [inlined] foo(n=7) at small.c:7:22
-> 7 for(n = 7, a[0]++; 0;) {
(lldb) si
frame #0: 0x00000000004004d9 a.out`main [inlined] foo(n=7) at small.c:7:22
-> 7 for(n = 7, a[0]++; 0;) {
(lldb) si
frame #0: 0x00000000004004df a.out`main at small.c:18
-> 18 foo(2);
(lldb) si
frame #0: 0x00000000004004e2 a.out`main [inlined] foo(n=2) at small.c:9:14
-> 9 a[1] = a[0] + 1;
(lldb)</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>