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

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 4 08:47:04 PDT 2021


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

            Bug ID: 51750
           Summary: Wrong backtrace and source line information at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            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 "pushq %rax" assembly instruction the backtrace indicates
that we are inside the main function and the associated source line is wrong
(line 17, which is in function w). The "pushq %rax" instruction should point to
line 0.

Steps to reproduce bug:
root at b04800b37146:/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 b04800b37146:/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 b04800b37146:/home/stepping/output# cat a.c
volatile int a, c, e;
short d;
int f;
char g, h, k;
int j;
unsigned l;
static short m[] = {3, 3, 3, 3, 3, 3, 3};
int n;
int(o)() {
  f = o();
  if (f)
    m[2] = e;
}
void p() {
  int b[6];
  int i;
  for (i = 0; i < 6; i++)
    b[i] = 10;
  d = 0;
  for (; d <= 5; d++) {
    j |= 6;
    h = g++;
    b[2] | m[6] || (l = k);
  }
}
int main() {
  p();
  for (; n;)
    c = a * 7;
  a = j;
  a = h;
  a = m[g];
  printf("%X\n");
}
root at b04800b37146:/home/stepping/output# cat -n a.c
     1  volatile int a, c, e;
     2  short d;
     3  int f;
     4  char g, h, k;
     5  int j;
     6  unsigned l;
     7  static short m[] = {3, 3, 3, 3, 3, 3, 3};
     8  int n;
     9  int(o)() {
    10    f = o();
    11    if (f)
    12      m[2] = e;
    13  }
    14  void p() {
    15    int b[6];
    16    int i;
    17    for (i = 0; i < 6; i++)
    18      b[i] = 10;
    19    d = 0;
    20    for (; d <= 5; d++) {
    21      j |= 6;
    22      h = g++;
    23      b[2] | m[6] || (l = k);
    24    }
    25  }
    26  int main() {
    27    p();
    28    for (; n;)
    29      c = a * 7;
    30    a = j;
    31    a = h;
    32    a = m[g];
    33    printf("%X\n");
    34  }
root at b04800b37146:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 0x400556
Breakpoint 1: address = 0x0000000000400556
(lldb) r
Process 50577 launched: '/home/stepping/output/opt' (x86_64)
FFFFE5F8
Process 50577 exited with status = 0 (0x00000000)
(lldb) b 0x400556
Breakpoint 2: where = opt`main + 22 [inlined] p + 6 at a.c:17:3, address =
0x0000000000400556
(lldb) r
Process 50585 launched: '/home/stepping/output/opt' (x86_64)
Process 50585 stopped
* thread #1, name = 'opt', stop reason = breakpoint 2.1
    frame #0: 0x0000000000400556 opt`main [inlined] p at a.c:17:3
   14   void p() {
   15     int b[6];
   16     int i;
-> 17     for (i = 0; i < 6; i++)
   18       b[i] = 10;
   19     d = 0;
   20     for (; d <= 5; d++) {
(lldb) di -l
opt`main:
    0x400554 <+20>: jne    0x400550                  ; <+16> [inlined] p at
a.c:17:17
->  0x400556 <+22>: pushq  %rax
    0x400557 <+23>: movl   0x200ae2(%rip), %r9d      ; j
    0x40055e <+30>: movw   $0x6, %dx
    0x400562 <+34>: movb   0x200adc(%rip), %al       ; g
    0x400568 <+40>: nopl   (%rax,%rax)
(lldb) bt
* thread #1, name = 'opt', stop reason = breakpoint 2.1
  * frame #0: 0x0000000000400556 opt`main [inlined] p at a.c:17:3
    frame #1: 0x0000000000400550 opt`main at a.c:27:3
    frame #2: 0x00007ffff7a03bf7 libc.so.6`__libc_start_main + 231
    frame #3: 0x000000000040040a opt`_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/20210904/17f364e0/attachment.html>


More information about the llvm-bugs mailing list