Alexandre Julliard : ntdll: Use static debug info before initialization is done.
Alexandre Julliard
julliard at winehq.org
Wed Apr 3 15:26:18 CDT 2019
Module: wine
Branch: master
Commit: b3c8d5d36850e484b5cc84ab818a75db567a06a3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b3c8d5d36850e484b5cc84ab818a75db567a06a3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Apr 3 09:50:31 2019 +0200
ntdll: Use static debug info before initialization is done.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/debugtools.c | 13 ++++++++++++-
dlls/ntdll/thread.c | 5 -----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c
index 254673b..4e2fd78 100644
--- a/dlls/ntdll/debugtools.c
+++ b/dlls/ntdll/debugtools.c
@@ -43,11 +43,18 @@ WINE_DECLARE_DEBUG_CHANNEL(timestamp);
static struct __wine_debug_functions default_funcs;
-/* ---------------------------------------------------------------------- */
+static BOOL init_done;
+static struct debug_info initial_info; /* debug info for initial thread */
/* get the debug info pointer for the current thread */
static inline struct debug_info *get_info(void)
{
+ if (!init_done)
+ {
+ if (!initial_info.str_pos) initial_info.str_pos = initial_info.strings;
+ if (!initial_info.out_pos) initial_info.out_pos = initial_info.output;
+ return &initial_info;
+ }
return ntdll_get_thread_data()->debug_info;
}
@@ -199,5 +206,9 @@ static const struct __wine_debug_functions funcs =
*/
void debug_init(void)
{
+ if (!initial_info.str_pos) initial_info.str_pos = initial_info.strings;
+ if (!initial_info.out_pos) initial_info.out_pos = initial_info.output;
+ ntdll_get_thread_data()->debug_info = &initial_info;
+ init_done = TRUE;
__wine_dbg_set_functions( &funcs, &default_funcs, sizeof(funcs) );
}
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 9f4a08f..6445ec6 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -163,7 +163,6 @@ void thread_init(void)
LARGE_INTEGER now;
NTSTATUS status;
struct ntdll_thread_data *thread_data;
- static struct debug_info debug_info; /* debug info for initial thread */
virtual_init();
@@ -231,13 +230,9 @@ void thread_init(void)
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
- thread_data->debug_info = &debug_info;
signal_init_thread( teb );
virtual_init_threading();
-
- debug_info.str_pos = debug_info.strings;
- debug_info.out_pos = debug_info.output;
debug_init();
/* setup the server connection */
More information about the wine-cvs
mailing list