Skip to content

lldb step over failed in musl dyn exe (Could not create return address breakpoint) #50279

@rprichard

Description

@rprichard
Bugzilla Link 50935
Version 12.0
OS Linux
CC @JDevlieghere,@jimingham

Extended Description

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.outputs a.outputs:
    -> 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 b978a93)
clang revision b978a93
llvm revision b978a93

$ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillalldb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions