[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [llvm-bugs] [Bug 50936] New: lldb step over glibc dlopen fails (__GI__dl_catch_exception or runs awa
From: via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date: 2021-06-29 23:44:21
Message-ID: bug-50936-206 () http ! bugs ! llvm ! org/
[Download RAW message or body]
--1625010261.cc062fF62.22343
Date: Tue, 29 Jun 2021 16:44:21 -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=50936
Bug ID: 50936
Summary: lldb step over glibc dlopen fails
(__GI__dl_catch_exception or runs away)
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
Using glibc (specifically gLinux aka Debian), LLDB is unable to step over
certain dlopen calls.
In one situation, the library was part of the initial set of needed DSOs, and
LLDB fails with a __GI__dl_catch_exception error. In another situation, the
library isn't loaded already, and when dlopen loads it, LLDB fails to stop
after the dlopen call (and runs to process exit).
Both problems reproduce with either LLVM 12.0.0
(clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04) or with an upstream Clang and
LLDB that I built today from origin/main.
Test case:
$ cat >test.c <<EOF
#include <dlfcn.h>
int main(void) {
void* ptr;
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
return 0;
}
EOF
## Situation 1: __GI__dl_catch_exception (link with -lm)
$ /x/clang12/bin/clang -g test.c -ldl -lm
$ /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 + 15 at test.c:4:3, address =
0x000000000040113f
(lldb) run
Process 282393 launched: '/x/mess/a.out' (x86_64)
Process 282393 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x000000000040113f a.out`main at test.c:4:3
1 #include <dlfcn.h>
2 int main(void) {
3 void* ptr;
-> 4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 282393 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x00007ffff7dca260
libc.so.6`__GI__dl_catch_exception(exception=0x00007fffffffda40,
operate=0x00007ffff7fe5ca0, args=0x00007fffffffda60) at
dl-error-skeleton.c:209:18
## Situation 2: process runs away when dlopen loads libm.so.6 (don't link with
-lm)
$ /x/clang12/bin/clang -g test.c -ldl
$ /x/clang12/bin/lldb a.out
(lldb) target create "a.out"
Current executable set to '/x/mess/a.out' (x86_64).
(lldb) b test.c:5
Breakpoint 1: where = a.out`main + 35 at test.c:5:3, address =
0x0000000000401153
(lldb) run
Process 283170 launched: '/x/mess/a.out' (x86_64)
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401153 a.out`main at test.c:5:3
2 int main(void) {
3 void* ptr;
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x0000000000401167 a.out`main at test.c:6:3
3 void* ptr;
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
9 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x000000000040117b a.out`main at test.c:7:3
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
9 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
10 return 0;
(lldb) n
Process 283170 exited with status = 0 (0x00000000)
--
You are receiving this mail because:
You are on the CC list for the bug.
--1625010261.cc062fF62.22343
Date: Tue, 29 Jun 2021 16:44:21 -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 glibc dlopen fails (__GI__dl_catch_exception or runs away)"
href="https://bugs.llvm.org/show_bug.cgi?id=50936">50936</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lldb step over glibc dlopen fails (__GI__dl_catch_exception or runs away)
</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@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rprichard@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Using glibc (specifically gLinux aka Debian), LLDB is unable to step over
certain dlopen calls.
In one situation, the library was part of the initial set of needed DSOs, and
LLDB fails with a __GI__dl_catch_exception error. In another situation, the
library isn't loaded already, and when dlopen loads it, LLDB fails to stop
after the dlopen call (and runs to process exit).
Both problems reproduce with either LLVM 12.0.0
(clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04) or with an upstream Clang and
LLDB that I built today from origin/main.
Test case:
$ cat >test.c <<EOF
#include <dlfcn.h>
int main(void) {
void* ptr;
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
return 0;
}
EOF
## Situation 1: __GI__dl_catch_exception (link with -lm)
$ /x/clang12/bin/clang -g test.c -ldl -lm
$ /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 + 15 at test.c:4:3, address =
0x000000000040113f
(lldb) run
Process 282393 launched: '/x/mess/a.out' (x86_64)
Process 282393 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x000000000040113f a.out`main at test.c:4:3
1 #include <dlfcn.h>
2 int main(void) {
3 void* ptr;
-> 4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 282393 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x00007ffff7dca260
libc.so.6`__GI__dl_catch_exception(exception=0x00007fffffffda40,
operate=0x00007ffff7fe5ca0, args=0x00007fffffffda60) at
dl-error-skeleton.c:209:18
## Situation 2: process runs away when dlopen loads libm.so.6 (don't link with
-lm)
$ /x/clang12/bin/clang -g test.c -ldl
$ /x/clang12/bin/lldb a.out
(lldb) target create "a.out"
Current executable set to '/x/mess/a.out' (x86_64).
(lldb) b test.c:5
Breakpoint 1: where = a.out`main + 35 at test.c:5:3, address =
0x0000000000401153
(lldb) run
Process 283170 launched: '/x/mess/a.out' (x86_64)
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401153 a.out`main at test.c:5:3
2 int main(void) {
3 void* ptr;
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x0000000000401167 a.out`main at test.c:6:3
3 void* ptr;
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
9 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
(lldb) n
Process 283170 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x000000000040117b a.out`main at test.c:7:3
4 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
5 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
6 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
-> 7 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
8 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
9 dlopen("libm.so.6", RTLD_NOW | RTLD_LOCAL);
10 return 0;
(lldb) n
Process 283170 exited with status = 0 (0x00000000)</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>
--1625010261.cc062fF62.22343--
[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