<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 - Wrong backtrace infromation at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=46398">46398</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong backtrace infromation at Og
</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>enhancement
</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>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>At line 10 backtrace information is wrong.
$ cat a.c
int k = 0, a;
int *b = &a;
int c = 2;
short d = 2;
void e() { --d; }
int *f() {
if (a)
e();
else
return b;
}
int main() {
f();
f();
}
$ cat -n a.c
1 int k = 0, a;
2 int *b = &a;
3 int c = 2;
4 short d = 2;
5 void e() { --d; }
6 int *f() {
7 if (a)
8 e();
9 else
10 return b;
11 }
12 int main() {
13 f();
14 f();
15 }
$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
c143db3b1032042193c152790bcefe34365e6d6c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ lldb -v
lldb version 11.0.0
clang revision c143db3b1032042193c152790bcefe34365e6d6c
llvm revision c143db3b1032042193c152790bcefe34365e6d6c
$ gdb -v
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
$ clang -Og -g -o out a.c
$ lldb out
(lldb) target create "out"
Current executable set to 'out' (x86_64).
(lldb) b main
Breakpoint 1: where = out`main + 1 at a.c:13:3, address = 0x00000000004004b1
(lldb) r
Process 123 launched: 'out' (x86_64)
Process 123 stopped
* thread #1, name = 'out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004b1 out`main at a.c:13:3
10 return b;
11 }
12 int main() {
-> 13 f();
14 f();
15 }
(lldb) n
Process 123 stopped
* thread #1, name = 'out', stop reason = step over
frame #0: 0x00000000004004b6 out`main at a.c:14:3
11 }
12 int main() {
13 f();
-> 14 f();
15 }
(lldb) s
Process 123 stopped
* thread #1, name = 'out', stop reason = step in
frame #0: 0x0000000000400491 out`f at a.c:7:7
4 short d = 2;
5 void e() { --d; }
6 int *f() {
-> 7 if (a)
8 e();
9 else
10 return b;
(lldb) bt
* thread #1, name = 'out', stop reason = step in
* frame #0: 0x0000000000400491 out`f at a.c:7:7
frame #1: 0x00000000004004bb out`main at a.c:14:3
frame #2: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
frame #3: 0x00000000004003ba out`_start + 42
(lldb) s
Process 123 stopped
* thread #1, name = 'out', stop reason = step in
frame #0: 0x00000000004004a1 out`f at a.c:10:12
7 if (a)
8 e();
9 else
-> 10 return b;
11 }
12 int main() {
13 f();
(lldb) bt
* thread #1, name = 'out', stop reason = step in
* frame #0: 0x00000000004004a1 out`f at a.c:10:12
frame #1: 0x0000000000601040 out`k + 4
frame #2: 0x00000000004004bb out`main at a.c:14:3
frame #3: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
frame #4: 0x00000000004003ba out`_start + 42
(lldb) exit
$ gdb out
(gdb) b main
Breakpoint 1 at 0x4004b1: file a.c, line 13.
(gdb) r
Starting program: out
Breakpoint 1, main () at a.c:13
13 f();
(gdb) s
f () at a.c:7
7 if (a)
(gdb) s
10 return b;
(gdb) s
11 }
(gdb) s
main () at a.c:14
14 f();
(gdb) s
f () at a.c:7
7 if (a)
(gdb) bt
#0 f () at a.c:7
#1 0x00000000004004bb in main () at a.c:14
(gdb) s
10 return b;
(gdb) bt
#0 f () at a.c:10
#1 0x00000000004004bb in main () at a.c:14
(gdb)</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>