[llvm-bugs] [Bug 46397] New: Wrong backtrace infromation at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 19 06:09:50 PDT 2020


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

            Bug ID: 46397
           Summary: Wrong backtrace infromation at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: massarelli 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

At line 11 backtrace information is wrong.

$ cat -n a.c
     1  int a, b;
     2  static int *c = &a;
     3  int *d = &c;
     4  int e = 1;
     5  char(f)(g) { return g; }
     6  void h(int *g) {
     7    g || b;
     8    if (a)
     9      ;
    10    else
    11      d = f(1);
    12  }
    13  int *i() { return c; }
    14  int main() {
    15    int *j = i();
    16    h(j);
    17  }

$ cat a.c
int a, b;
static int *c = &a;
int *d = &c;
int e = 1;
char(f)(g) { return g; }
void h(int *g) {
  g || b;
  if (a)
    ;
  else
    d = f(1);
}
int *i() { return c; }
int main() {
  int *j = i();
  h(j);
}

$  clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
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 h
Breakpoint 1: where = out`h + 1 at a.c:8:7, address = 0x0000000000400491
(lldb) r
Process 330 launched: 'out' (x86_64)
Process 330 stopped
* thread #1, name = 'out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400491 out`h(g=0x0000000000601044) at a.c:8:7
   5    char(f)(g) { return g; }
   6    void h(int *g) {
   7      g || b;
-> 8      if (a)
   9        ;
   10     else
   11       d = f(1);
(lldb) bt
* thread #1, name = 'out', stop reason = breakpoint 1.1
  * frame #0: 0x0000000000400491 out`h(g=0x0000000000601044) at a.c:8:7
    frame #1: 0x00000000004004de out`main at a.c:16:3
    frame #2: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
    frame #3: 0x00000000004003ba out`_start + 42
(lldb) s
Process 330 stopped
* thread #1, name = 'out', stop reason = step in
    frame #0: 0x000000000040049c out`h(g=0x0000000000601044) at a.c:11:9
   8      if (a)
   9        ;
   10     else
-> 11       d = f(1);
   12   }
   13   int *i() { return c; }
   14   int main() {
(lldb) bt
* thread #1, name = 'out', stop reason = step in
  * frame #0: 0x000000000040049c out`h(g=0x0000000000601044) at a.c:11:9
    frame #1: 0x0000000000601044 out`__TMC_END__ + 4
    frame #2: 0x00000000004004de out`main at a.c:16:3
    frame #3: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
    frame #4: 0x00000000004003ba out`_start + 42
(lldb) 

$ gdb out
(gdb) b h  
Breakpoint 1 at 0x400491: file a.c, line 8.
(gdb) r
Starting program: /home/stepping/output/opt 
Breakpoint 1, h (g=0x601044 <a>) at a.c:8
8         if (a)
(gdb) bt
#0  h (g=0x601044 <a>) at a.c:8
#1  0x00000000004004de in main () at a.c:16
(gdb) s
11          d = f(1);
(gdb) bt
#0  h (g=0x601044 <a>) at a.c:11
#1  0x00000000004004de in main () at a.c:16

-- 
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/20200619/c7212e2f/attachment.html>


More information about the llvm-bugs mailing list