[llvm-bugs] [Bug 51511] New: Wrong line and backtrace information at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 17 08:34:14 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51511

            Bug ID: 51511
           Summary: Wrong line and backtrace information at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: artuso at diag.uniroma1.it
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Comment:
When Stepping on the nop assembly instruction, the source line (line 4) and the
backtrace (main) are wrong.

Steps to reproduce bug:

root at cbf0f3763b8d:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
957334382cd12ec07b46c0ddfdcc220731f6d80f)
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

root at cbf0f3763b8d:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
  clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
  llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f

root at cbf0f3763b8d:/home/stepping/output# cat -n a.c
     1       volatile int a,  g_5108          ;
     2                     int b;
     3  short c()               {
     4                                 return g_5108;
     5                             }
     6         int main () {
     7                         c();
     8                         b = 0;
     9                         for (;
    10                     b < 4;
    11                     b++)                   a ;
    12                     }

root at cbf0f3763b8d:/home/stepping/output# cat a.c
     volatile int a,  g_5108          ;
                   int b;
short c()               {
                               return g_5108;
                           }
       int main () {
                       c();
                       b = 0;
                       for (;
                   b < 4;
                   b++)                   a ;
                   }
root at cbf0f3763b8d:/home/stepping/output# clang -Og -g -Wno-everything -o optg
a.c

root at cbf0f3763b8d:/home/stepping/output# lldb optg
(lldb) target create "optg"
Current executable set to '/home/stepping/output/optg' (x86_64).
(lldb) b 0x40049b
Breakpoint 1: address = 0x000000000040049b
(lldb) r
Process 48 launched: '/home/stepping/output/optg' (x86_64)
Process 48 exited with status = 0 (0x00000000)
(lldb) b 0x40049b
Breakpoint 2: where = optg`main + 11 at a.c:4:39, address = 0x000000000040049b
(lldb) r
Process 56 launched: '/home/stepping/output/optg' (x86_64)
Process 56 stopped
* thread #1, name = 'optg', stop reason = breakpoint 2.1
    frame #0: 0x000000000040049b optg`main at a.c:4:39
   1         volatile int a,  g_5108          ;
   2                       int b;
   3    short c()               {
-> 4                                   return g_5108;
   5                               }
   6           int main () {
   7                           c();
(lldb) di -l
optg`main:
    0x400490 <+0>:  movl   0x200b96(%rip), %eax      ; g_5108
    0x400496 <+6>:  movl   $0x4, %eax
->  0x40049b <+11>: nopl   (%rax,%rax)
(lldb) bt
* thread #1, name = 'optg', stop reason = breakpoint 2.1
  * frame #0: 0x000000000040049b optg`main at a.c:4:39
    frame #1: 0x00007ffff7a03bf7 libc.so.6`__libc_start_main + 231
    frame #2: 0x00000000004003ba optg`_start + 42

-- 
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/20210817/2da93dc6/attachment.html>


More information about the llvm-bugs mailing list