From 3ee38261bbee0e06dd4be0be2356e4e0287969ba Mon Sep 17 00:00:00 2001 From: hhj Date: Thu, 1 Sep 2022 09:31:51 +0800 Subject: [PATCH] Sync 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. Signed-off-by: hhj --- porting/linux/user/ldso/dynlink.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/porting/linux/user/ldso/dynlink.c b/porting/linux/user/ldso/dynlink.c index a92c96cb..53fdc12a 100644 --- a/porting/linux/user/ldso/dynlink.c +++ b/porting/linux/user/ldso/dynlink.c @@ -2547,7 +2547,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; @@ -2638,6 +2638,8 @@ static void *dlopen_impl( pthread_rwlock_wrlock(&lock); __inhibit_ptc(); + debug.state = RT_ADD; + _dl_debug_state(); /* When namespace does not exist, use caller's namespce * and when caller does not exist, use default namespce. */ caller = (struct dso *)addr2dso((size_t)caller_addr); @@ -2798,7 +2800,6 @@ static void *dlopen_impl( update_tls_size(); if (tls_cnt != orig_tls_cnt) install_new_tls(); - _dl_debug_state(); orig_tail = tail; #ifdef HANDLE_RANDOMIZATION @@ -2810,6 +2811,8 @@ static void *dlopen_impl( } #endif end: + debug.state = RT_CONSISTENT; + _dl_debug_state(); #ifdef LOAD_ORDER_RANDOMIZATION if (!is_task_appended) { free_task(task); -- GitLab