about summary refs log tree commit diff
path: root/ldso
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2020-10-24 14:31:14 -0500
committerRich Felker <dalias@aerifal.cx>2020-10-27 01:10:29 -0400
commitccba23459ebacc8bc6e5eeef7454c91ceb61b5b0 (patch)
tree22d818b9be73861ad58da14e12dee611662cd201 /ldso
parent4209a7b1048c2601be0dd91aeb9b9ed0a7447965 (diff)
downloadmusl-ccba23459ebacc8bc6e5eeef7454c91ceb61b5b0.tar.gz
musl-ccba23459ebacc8bc6e5eeef7454c91ceb61b5b0.tar.xz
musl-ccba23459ebacc8bc6e5eeef7454c91ceb61b5b0.zip
ldso: notify the debugger when we're doing a dlopen
Otherwise lldb doesn't notice the new library and stack traces
containing it get cut off unhelpfully.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/dynlink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index af983692..f9ac0100 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1947,7 +1947,7 @@ void __dls3(size_t *sp, size_t *auxv)
 	debug.bp = dl_debug_state;
 	debug.head = head;
 	debug.base = ldso.base;
-	debug.state = 0;
+	debug.state = RT_CONSISTENT;
 	_dl_debug_state();
 
 	if (replace_argv0) argv[0] = replace_argv0;
@@ -1996,6 +1996,9 @@ void *dlopen(const char *file, int mode)
 	pthread_rwlock_wrlock(&lock);
 	__inhibit_ptc();
 
+	debug.state = RT_ADD;
+	_dl_debug_state();
+
 	p = 0;
 	if (shutting_down) {
 		error("Cannot dlopen while program is exiting.");
@@ -2089,9 +2092,10 @@ void *dlopen(const char *file, int mode)
 	update_tls_size();
 	if (tls_cnt != orig_tls_cnt)
 		install_new_tls();
-	_dl_debug_state();
 	orig_tail = tail;
 end:
+	debug.state = RT_CONSISTENT;
+	_dl_debug_state();
 	__release_ptc();
 	if (p) gencnt++;
 	pthread_rwlock_unlock(&lock);