[llvm-bugs] [Bug 45832] New: Wrong backtrace in lldb with optimized code [-Og]

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 7 11:02:39 PDT 2020


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

            Bug ID: 45832
           Summary: Wrong backtrace in lldb with optimized code [-Og]
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: ditaliano at apple.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

$ ./lldb trace.o
(lldb) target create "trace.o"
Current executable set to '/home/g_a_diluna/lldb-build/bin/trace.o' (x86_64).
(lldb) b main
Breakpoint 1: where = trace.o`main + 1 at trace.c:5:3, address =
0x00000000004004a1
(lldb) r
Process 5436 launched: '/home/Dave/lldb-build/bin/trace.o' (x86_64)
Process 5436 stopped
* thread #1, name = 'trace.o', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004a1 trace.o`main at trace.c:5:3
   2    static int b(int *c) { *c = 0; }
   3    int main() {
   4      int *d = &a;
-> 5      b(d);
   6    }
(lldb) s
Process 5436 stopped
* thread #1, name = 'trace.o', stop reason = step in
    frame #0: 0x00000000004004b0 trace.o`b at trace.c:6:1
   3    int main() {
   4      int *d = &a;
   5      b(d);
-> 6    }
(lldb) bt
* thread #1, name = 'trace.o', stop reason = step in
  * frame #0: 0x00000000004004b0 trace.o`b at trace.c:6:1
    frame #1: 0x00000000004004a6 trace.o`main at trace.c:5:3
    frame #2: 0x00007ffff7a5a2e1 libc.so.6`__libc_start_main + 241
    frame #3: 0x00000000004003ca trace.o`_start + 42
(lldb) s
Process 5436 stopped
* thread #1, name = 'trace.o', stop reason = step in
    frame #0: 0x00000000004004a6 trace.o`main at trace.c:6:1
   3    int main() {
   4      int *d = &a;
   5      b(d);
-> 6    }
(lldb) bt
* thread #1, name = 'trace.o', stop reason = step in
  * frame #0: 0x00000000004004a6 trace.o`main at trace.c:6:1
    frame #1: 0x00007ffff7a5a2e1 libc.so.6`__libc_start_main + 241
    frame #2: 0x00000000004003ca trace.o`_start + 42
(lldb) q

$ ./lldb -v
lldb version 11.0.0
  clang revision 237d0e3c0416abf9919406bcc92874cfd15f5e0c
  llvm revision 237d0e3c0416abf9919406bcc92874cfd15f5e0c

$ ./clang-11 -g -Og trace.c -o trace.o
trace.c:2:32: warning: non-void function does not return a value
[-Wreturn-type]
static int b(int *c) { *c = 0; }
                               ^

$ cat trace.c

static int a;
static int b(int *c) { *c = 0; }
int main() {
  int *d = &a;
  b(d);
}

Only reproduces on Linux (x86_64)

-- 
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/20200507/72c8c8b9/attachment.html>


More information about the llvm-bugs mailing list