[lldb-dev] [Bug 50935] New: lldb step over failed in musl dyn exe (Could not create return address breakpoint)

via lldb-dev lldb-dev at lists.llvm.org
Tue Jun 29 16:24:59 PDT 2021


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

            Bug ID: 50935
           Summary: lldb step over failed in musl dyn exe (Could not
                    create return address breakpoint)
           Product: lldb
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: rprichard at google.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

With a dynamically-linked musl executable (on x86_64 gLinux aka Debian), LLDB
is unable to step over a "printf" call. The problem happens with either PIE or
non-PIE executables, but not with statically-linked musl executables. LLDB is
able to step over this call if I use glibc instead (with either the Debian gcc
or clang compiler).

I tested with both LLDB 12.0.0 and with a current LLDB build from origin/main.

$ cat >test.c <<EOF
#include <stdio.h>
int main(void) {
  printf("hello!\n");
  return 0;
}
EOF

$ musl-gcc test.c -g
$ file a.out
a.out: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib/ld-musl-x86_64.so.1, with debug_info, not stripped

$ /x/clang12/bin/lldb a.out
(lldb) target create "a.out"
Current executable set to '/x/mess/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 4 at test.c:3:3, address =
0x0000000000001159
(lldb) run
Process 235162 launched: '/x/mess/a.out' (x86_64)
Process 235162 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555555159 a.out`main at test.c:3:3
   1    #include <stdio.h>
   2    int main(void) {
-> 3      printf("hello!\n");
   4      return 0;
   5    }
(lldb) n
Process 235162 stopped
* thread #1, name = 'a.out', stop reason = step over failed (Could not create
return address breakpoint.)
    frame #0: 0x0000555555555020 a.out`puts
a.out`puts:
->  0x555555555020 <+0>:  jmpq   *0x2ff2(%rip)             ;
_GLOBAL_OFFSET_TABLE_ + 24
    0x555555555026 <+6>:  pushq  $0x0
    0x55555555502b <+11>: jmp    0x555555555010

a.out`__libc_start_main:
    0x555555555030 <+0>:  jmpq   *0x2fea(%rip)             ;
_GLOBAL_OFFSET_TABLE_ + 32

$ /x/clang12/bin/lldb --version
lldb version 12.0.0 (https://github.com/llvm/llvm-project/ revision
b978a93635b584db380274d7c8963c73989944a1)
  clang revision b978a93635b584db380274d7c8963c73989944a1
  llvm revision b978a93635b584db380274d7c8963c73989944a1

$ musl-gcc --version
cc (Debian 10.2.1-6+build2) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ dpkg -l musl
...
ii  musl:amd64     1.2.2-1      amd64        standard C library

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20210629/b3ca856c/attachment.html>


More information about the lldb-dev mailing list