[llvm-bugs] [Bug 48467] New: inconsistent behaviors: the source code lines an address belongs to is inconsistent at source-level debugging and instruction-level debugging
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 9 23:38:53 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48467
Bug ID: 48467
Summary: inconsistent behaviors: the source code lines an
address belongs to is inconsistent at source-level
debugging and instruction-level debugging
Product: lldb
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: lldb-dev at lists.llvm.org
Reporter: yangyibiao at nju.edu.cn
CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org
Created attachment 24259
--> https://bugs.llvm.org/attachment.cgi?id=24259&action=edit
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
/* { dg-options "-O2" } */
/* { dg-do run } */
static const long long int TagTypeNumber = 0xffff000000000000ll;
long long int x;
void foo(void)
{
x = TagTypeNumber + 1; // Line 10
}
int main(int argc, char **argv)
{
if (argc > 0)
foo (); // Line 16
if ((x & TagTypeNumber) == TagTypeNumber)
{
unsigned y = (unsigned)x;
__builtin_printf ("v: %u\n", y);
if (y != 1)
__builtin_abort ();
}
return 0;
}
$ clang -O2 -g small.c
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/root/DeVIL/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 11 at small.c:15:12, address =
0x000000000040056b
(lldb) r
Process 42468 stopped
frame #0: 0x000000000040056b a.out`main(argc=1, argv=0x00007fffffffe038) at
small.c:15:12
-> 15 if (argc > 0)
(lldb) s
Process 42468 stopped
frame #0: 0x000000000040056f a.out`main(argc=1, argv=0x00007fffffffe038) at
small.c:16
-> 16 foo (); // Line 16
(lldb) s
frame #0: 0x000000000040056f a.out`main [inlined] foo at small.c:10:5
-> 10 x = TagTypeNumber + 1; // Line 10
(lldb)
############################################################
We can found that when step line by line, 0x000000000040056f belongs to Line 16
and Line 10.
However, when step instruction by instruction, 0x000000000040056f only belongs
to Line 16 as follows:
############################################################
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/root/DeVIL/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 11 at small.c:15:12, address =
0x000000000040056b
(lldb) r
Process 42608 stopped
frame #0: 0x000000000040056b a.out`main(argc=1, argv=0x00007fffffffe038) at
small.c:15:12
-> 15 if (argc > 0)
(lldb) si
Process 42608 stopped
frame #0: 0x000000000040056d a.out`main(argc=1, argv=0x00007fffffffe038) at
small.c:15:7
-> 15 if (argc > 0)
(lldb) si
Process 42608 stopped
frame #0: 0x000000000040056f a.out`main(argc=1, argv=0x00007fffffffe038) at
small.c:16
-> 16 foo (); // Line 16
(lldb) si
Process 42608 stopped
frame #0: 0x0000000000400573 a.out`main [inlined] foo at small.c:10:5
-> 10 x = TagTypeNumber + 1; // Line 10
(lldb)
--
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/20201210/77e4de4b/attachment-0001.html>
More information about the llvm-bugs
mailing list