[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [llvm-bugs] [Bug 50935] New: lldb step over failed in musl dyn exe (Could not create return address 
From:       via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date:       2021-06-29 23:24:59
Message-ID: bug-50935-206 () http ! bugs ! llvm ! org/
[Download RAW message or body]

--1625009099.F8ECB2E0.20675
Date: Tue, 29 Jun 2021 16:24:59 -0700
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.llvm.org/
Auto-Submitted: auto-generated

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@lists.llvm.org
          Reporter: rprichard@google.com
                CC: jdevlieghere@apple.com, llvm-bugs@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 on the CC list for the bug.
--1625009099.F8ECB2E0.20675
Date: Tue, 29 Jun 2021 16:24:59 -0700
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.llvm.org/
Auto-Submitted: auto-generated

<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - lldb step over failed in musl dyn exe (Could not create return \
address breakpoint)"  href="https://bugs.llvm.org/show_bug.cgi?id=50935">50935</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb step over failed in musl dyn exe (Could not create return address \
breakpoint)  </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev&#64;lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rprichard&#64;google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere&#64;apple.com, llvm-bugs&#64;lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With a dynamically-linked musl executable (on x86_64 gLinux aka Debian), \
LLDB is unable to step over a &quot;printf&quot; 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 &gt;test.c &lt;&lt;EOF
#include &lt;stdio.h&gt;
int main(void) {
  printf(&quot;hello!\n&quot;);
  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 &quot;a.out&quot;
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 &lt;stdio.h&gt;
   2    int main(void) {
-&gt; 3      printf(&quot;hello!\n&quot;);
   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:
-&gt;  0x555555555020 &lt;+0&gt;:  jmpq   *0x2ff2(%rip)             ;
_GLOBAL_OFFSET_TABLE_ + 24
    0x555555555026 &lt;+6&gt;:  pushq  $0x0
    0x55555555502b &lt;+11&gt;: jmp    0x555555555010

a.out`__libc_start_main:
    0x555555555030 &lt;+0&gt;:  jmpq   *0x2fea(%rip)             ;
_GLOBAL_OFFSET_TABLE_ + 32

$ /x/clang12/bin/lldb --version
lldb version 12.0.0 (<a \
href="https://github.com/llvm/llvm-project/">https://github.com/llvm/llvm-project/</a> \
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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>
--1625009099.F8ECB2E0.20675--


[Attachment #3 (text/plain)]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic