server: Report only one debug event per process at the time.
Instead of one per thread. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6b46a4d24a
commit
c1a32a080f
|
@ -287,6 +287,9 @@ static void next_event_(unsigned line, struct debugger_context *ctx, unsigned ti
|
|||
|
||||
static void process_attach_events(struct debugger_context *ctx)
|
||||
{
|
||||
DEBUG_EVENT ev;
|
||||
BOOL ret;
|
||||
|
||||
ctx->ev.dwDebugEventCode = -1;
|
||||
next_event(ctx, 0);
|
||||
ok(ctx->ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
|
||||
|
@ -304,6 +307,10 @@ static void process_attach_events(struct debugger_context *ctx)
|
|||
|
||||
do
|
||||
{
|
||||
/* even when there are more pending events, they are not reported until current event is continued */
|
||||
ret = WaitForDebugEvent(&ev, 10);
|
||||
ok(GetLastError() == ERROR_SEM_TIMEOUT, "WaitForDebugEvent returned %x(%u)\n", ret, GetLastError());
|
||||
|
||||
next_event(ctx, WAIT_EVENT_TIMEOUT);
|
||||
if (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT)
|
||||
ok(ctx->ev.u.LoadDll.lpBaseOfDll != ntdll, "ntdll.dll reported out of order\n");
|
||||
|
|
|
@ -244,7 +244,7 @@ static const fill_event_func fill_debug_event[NB_DEBUG_EVENTS] =
|
|||
static void unlink_event( struct debug_ctx *debug_ctx, struct debug_event *event )
|
||||
{
|
||||
list_remove( &event->entry );
|
||||
if (event->sender->debug_event == event) event->sender->debug_event = NULL;
|
||||
if (event->sender->process->debug_event == event) event->sender->process->debug_event = NULL;
|
||||
release_object( event );
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ static void link_event( struct debug_event *event )
|
|||
assert( debug_ctx );
|
||||
grab_object( event );
|
||||
list_add_tail( &debug_ctx->event_queue, &event->entry );
|
||||
if (!event->sender->debug_event)
|
||||
if (!event->sender->process->debug_event)
|
||||
{
|
||||
/* grab reference since debugger could be killed while trying to wake up */
|
||||
grab_object( debug_ctx );
|
||||
|
@ -273,7 +273,7 @@ static struct debug_event *find_event_to_send( struct debug_ctx *debug_ctx )
|
|||
LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
|
||||
{
|
||||
if (event->state == EVENT_SENT) continue; /* already sent */
|
||||
if (event->sender->debug_event) continue; /* thread busy with another one */
|
||||
if (event->sender->process->debug_event) continue; /* process busy with another one */
|
||||
return event;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -371,7 +371,7 @@ static int continue_debug_event( struct process *process, struct thread *thread,
|
|||
if (event->state != EVENT_SENT) continue;
|
||||
if (event->sender == thread)
|
||||
{
|
||||
assert( event->sender->debug_event == event );
|
||||
assert( event->sender->process->debug_event == event );
|
||||
|
||||
event->status = status;
|
||||
event->state = EVENT_CONTINUED;
|
||||
|
@ -594,7 +594,7 @@ DECL_HANDLER(wait_debug_event)
|
|||
{
|
||||
data_size_t size = get_reply_max_size();
|
||||
event->state = EVENT_SENT;
|
||||
event->sender->debug_event = event;
|
||||
event->sender->process->debug_event = event;
|
||||
reply->pid = get_process_id( event->sender->process );
|
||||
reply->tid = get_thread_id( event->sender );
|
||||
if (size > sizeof(debug_event_t)) size = sizeof(debug_event_t);
|
||||
|
|
|
@ -502,6 +502,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
|
|||
}
|
||||
process->parent_id = 0;
|
||||
process->debugger = NULL;
|
||||
process->debug_event = NULL;
|
||||
process->handles = NULL;
|
||||
process->msg_fd = NULL;
|
||||
process->sigkill_timeout = NULL;
|
||||
|
|
|
@ -57,6 +57,7 @@ struct process
|
|||
process_id_t parent_id; /* parent process id (at the time of creation) */
|
||||
struct list thread_list; /* thread list */
|
||||
struct thread *debugger; /* thread debugging this process */
|
||||
struct debug_event *debug_event; /* debug event being sent to debugger */
|
||||
struct handle_table *handles; /* handle entries */
|
||||
struct fd *msg_fd; /* fd for sendmsg/recvmsg */
|
||||
process_id_t id; /* id of the process */
|
||||
|
|
|
@ -184,7 +184,6 @@ static inline void init_thread_structure( struct thread *thread )
|
|||
thread->teb = 0;
|
||||
thread->entry_point = 0;
|
||||
thread->debug_ctx = NULL;
|
||||
thread->debug_event = NULL;
|
||||
thread->system_regs = 0;
|
||||
thread->queue = NULL;
|
||||
thread->wait = NULL;
|
||||
|
|
|
@ -55,7 +55,6 @@ struct thread
|
|||
thread_id_t id; /* thread id */
|
||||
struct list mutex_list; /* list of currently owned mutexes */
|
||||
struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */
|
||||
struct debug_event *debug_event; /* debug event being sent to debugger */
|
||||
unsigned int system_regs; /* which system regs have been set */
|
||||
struct msg_queue *queue; /* message queue */
|
||||
struct thread_wait *wait; /* current wait condition if sleeping */
|
||||
|
|
Loading…
Reference in New Issue