server: Fix debug event order in generate_startup_debug_events.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-07-04 13:37:38 +02:00 committed by Alexandre Julliard
parent 6aaa2b23a3
commit 3fded30a10
2 changed files with 18 additions and 14 deletions

View File

@ -290,7 +290,6 @@ static void process_attach_events(struct debugger_context *ctx)
if (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT) /* Vista+ reports ntdll.dll before reporting threads */
{
ok(ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
todo_wine
ok(ctx->ev.u.LoadDll.lpBaseOfDll == ntdll, "The first reported DLL is not ntdll.dll\n");
next_event(ctx, 0);
}
@ -302,7 +301,6 @@ static void process_attach_events(struct debugger_context *ctx)
{
next_event(ctx, 2000);
if (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT)
todo_wine_if(ctx->ev.u.LoadDll.lpBaseOfDll == ntdll)
ok(ctx->ev.u.LoadDll.lpBaseOfDll != ntdll, "ntdll.dll reported out of order\n");
} while (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT || ctx->ev.dwDebugEventCode == UNLOAD_DLL_DEBUG_EVENT);
ok(ctx->dll_cnt > 2, "dll_cnt = %d\n", ctx->dll_cnt);

View File

@ -516,22 +516,28 @@ void generate_startup_debug_events( struct process *process, client_ptr_t entry
struct list *ptr;
struct thread *thread, *first_thread = get_process_first_thread( process );
/* generate creation events */
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
{
if (thread == first_thread)
generate_debug_event( thread, CREATE_PROCESS_DEBUG_EVENT, &entry );
else
generate_debug_event( thread, CREATE_THREAD_DEBUG_EVENT, NULL );
}
generate_debug_event( first_thread, CREATE_PROCESS_DEBUG_EVENT, &entry );
ptr = list_head( &process->dlls ); /* skip main module reported in create process event */
/* generate dll events (in loading order, i.e. reverse list order) */
ptr = list_tail( &process->dlls );
while (ptr != list_head( &process->dlls ))
/* generate ntdll.dll load event */
if (ptr && (ptr = list_next( &process->dlls, ptr )))
{
struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
}
/* generate creation events */
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
{
if (thread != first_thread)
generate_debug_event( thread, CREATE_THREAD_DEBUG_EVENT, NULL );
}
/* generate dll events (in loading order) */
while (ptr && (ptr = list_next( &process->dlls, ptr )))
{
struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
generate_debug_event( first_thread, LOAD_DLL_DEBUG_EVENT, dll );
ptr = list_prev( &process->dlls, ptr );
}
}