ntdll: Use static debug info before initialization is done.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-04-03 09:50:31 +02:00
parent 890d1b812a
commit b3c8d5d368
2 changed files with 12 additions and 6 deletions

View file

@ -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) );
}

View file

@ -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 */