[llvm-bugs] [Bug 46041] New: Inconsistent debug info between break and stepi at -O1
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 22 09:12:47 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46041
Bug ID: 46041
Summary: Inconsistent debug info between break and stepi at -O1
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: yangyibiao at hust.edu.cn
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
Created attachment 23523
--> https://bugs.llvm.org/attachment.cgi?id=23523&action=edit
the binary
$ 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 -O1 -g small.c
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b 5
Breakpoint 1: where = a.out`f + 21 at small.c:5:1, address = 0x0000000000401125
(lldb) r
Process 46982 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 46982 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401125 a.out`f(x=-216) at small.c:5:1
2 if (x==-216 || x==-132)
3 return 1;
4 return 0;
-> 5 }
6
7 int main () {
8 volatile int i;
(lldb) fr var x
(int) x = -216
(lldb)
/************************************
As showed, when setting breakpoint on Line 5 (first hit), the value of "x" is
-216.
However, when step-i to Line 5, the value of "x" is -230 which is as expected:
************************************/
$ clang -O1 -g 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:9:10, address =
0x0000000000401135
(lldb) r
Process 45549 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 45549 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401135 a.out`main at small.c:9:10
6
7 int main () {
8 volatile int i;
-> 9 for (i = -230; i < -120; i++)
10 if (f(i) != (i==-216 || i==-132))
11 return 1;
12 return 0;
(lldb) si -c 14
Process 45549 stopped
* thread #1, name = 'a.out', stop reason = instruction step into
frame #0: 0x0000000000401128 a.out`f(x=-230) at small.c:5:1
2 if (x==-216 || x==-132)
3 return 1;
4 return 0;
-> 5 }
6
7 int main () {
8 volatile int i;
(lldb) fr var x
(int) x = -230
(lldb)
/******************* the small.c *************/
$ cat small.c
int f(int x) {
if (x==-216 || x==-132)
return 1;
return 0;
}
int main () {
volatile int i;
for (i = -230; i < -120; i++)
if (f(i) != (i==-216 || i==-132))
return 1;
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200522/b23fe819/attachment-0001.html>
More information about the llvm-bugs
mailing list