ntdll: Use server_select to pass context to server in send_debug_event.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-04-15 14:55:56 +02:00 committed by Alexandre Julliard
parent 137fd7d3a0
commit 7f9eb22af8
8 changed files with 6 additions and 53 deletions

View File

@ -131,7 +131,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
DWORD i;
obj_handle_t handle = 0;
client_ptr_t params[EXCEPTION_MAXIMUM_PARAMETERS];
context_t server_context;
CONTEXT exception_context = *context;
select_op_t select_op;
sigset_t old_set;
@ -142,8 +142,6 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
for (i = 0; i < min( rec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS ); i++)
params[i] = rec->ExceptionInformation[i];
context_to_server( &server_context, context );
SERVER_START_REQ( queue_exception_event )
{
req->first = first_chance;
@ -153,7 +151,6 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
req->address = wine_server_client_ptr( rec->ExceptionAddress );
req->len = i * sizeof(params[0]);
wine_server_add_data( req, params, req->len );
wine_server_add_data( req, &server_context, sizeof(server_context) );
if (!(ret = wine_server_call( req ))) handle = reply->handle;
}
SERVER_END_REQ;
@ -162,16 +159,15 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
{
select_op.wait.op = SELECT_WAIT;
select_op.wait.handles[0] = handle;
server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, NULL, NULL );
server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, &exception_context, NULL );
SERVER_START_REQ( get_exception_status )
{
req->handle = handle;
wine_server_set_reply( req, &server_context, sizeof(server_context) );
ret = wine_server_call( req );
}
SERVER_END_REQ;
if (ret >= 0) context_from_server( context, &server_context );
if (ret >= 0) *context = exception_context;
}
pthread_sigmask( SIG_SETMASK, &old_set, NULL );

View File

@ -2522,7 +2522,6 @@ struct queue_exception_event_request
client_ptr_t address;
data_size_t len;
/* VARARG(params,uints64,len); */
/* VARARG(context,context); */
char __pad_44[4];
};
struct queue_exception_event_reply
@ -2542,7 +2541,6 @@ struct get_exception_status_request
struct get_exception_status_reply
{
struct reply_header __header;
/* VARARG(context,context); */
};
@ -6686,7 +6684,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 600
#define SERVER_PROTOCOL_VERSION 601
/* ### protocol_version end ### */

View File

@ -50,7 +50,6 @@ struct debug_event
enum debug_event_state state; /* event state */
int status; /* continuation status */
debug_event_t data; /* event data */
context_t context; /* register context */
};
/* debug context */
@ -347,11 +346,6 @@ static void debug_event_destroy( struct object *obj )
break;
}
}
if (event->sender->context == &event->context)
{
event->sender->context = NULL;
stop_thread_if_suspended( event->sender );
}
release_object( event->sender );
release_object( event->debugger );
}
@ -746,13 +740,6 @@ DECL_HANDLER(queue_exception_event)
if ((event = alloc_debug_event( thread, EXCEPTION_DEBUG_EVENT, &data )))
{
const context_t *context = (const context_t *)((const char *)get_req_data() + req->len);
data_size_t size = get_req_data_size() - req->len;
memset( &event->context, 0, sizeof(event->context) );
memcpy( &event->context, context, min( sizeof(event->context), size ) );
thread->context = &event->context;
if ((reply->handle = alloc_handle( thread->process, event, SYNCHRONIZE, 0 )))
{
link_event( event );
@ -772,18 +759,7 @@ DECL_HANDLER(get_exception_status)
0, &debug_event_ops )))
{
close_handle( current->process, req->handle );
if (event->state == EVENT_CONTINUED)
{
if (current->context == &event->context)
{
data_size_t size = min( sizeof(context_t), get_reply_max_size() );
set_reply_data( &event->context, size );
current->context = NULL;
stop_thread_if_suspended( current );
}
set_error( event->status );
}
else set_error( STATUS_PENDING );
set_error( event->state == EVENT_CONTINUED ? event->status : STATUS_PENDING );
release_object( event );
}
}

View File

@ -1934,7 +1934,6 @@ enum char_info_mode
client_ptr_t address; /* exception address */
data_size_t len; /* size of parameters */
VARARG(params,uints64,len);/* exception parameters */
VARARG(context,context); /* thread context */
@REPLY
obj_handle_t handle; /* handle to the queued event */
@END
@ -1943,8 +1942,6 @@ enum char_info_mode
/* Retrieve the status of an exception event */
@REQ(get_exception_status)
obj_handle_t handle; /* handle to the queued event */
@REPLY
VARARG(context,context); /* modified thread context */
@END

View File

@ -1377,7 +1377,6 @@ C_ASSERT( FIELD_OFFSET(struct queue_exception_event_reply, handle) == 8 );
C_ASSERT( sizeof(struct queue_exception_event_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_exception_status_request, handle) == 12 );
C_ASSERT( sizeof(struct get_exception_status_request) == 16 );
C_ASSERT( sizeof(struct get_exception_status_reply) == 8 );
C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, pid) == 12 );
C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, tid) == 16 );
C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, status) == 20 );

View File

@ -588,12 +588,6 @@ void stop_thread( struct thread *thread )
if (is_process_init_done(thread->process)) send_thread_signal( thread, SIGUSR1 );
}
/* stop a thread if it's supposed to be suspended */
void stop_thread_if_suspended( struct thread *thread )
{
if (thread->suspend + thread->process->suspend > 0) stop_thread( thread );
}
/* suspend a thread */
int suspend_thread( struct thread *thread )
{

View File

@ -115,7 +115,6 @@ extern enum select_op get_wait_queue_select_op( struct wait_queue_entry *entry )
extern client_ptr_t get_wait_queue_key( struct wait_queue_entry *entry );
extern void make_wait_abandoned( struct wait_queue_entry *entry );
extern void stop_thread( struct thread *thread );
extern void stop_thread_if_suspended( struct thread *thread );
extern int wake_thread( struct thread *thread );
extern int wake_thread_queue_entry( struct wait_queue_entry *entry );
extern int add_queue( struct object *obj, struct wait_queue_entry *entry );

View File

@ -2435,7 +2435,6 @@ static void dump_queue_exception_event_request( const struct queue_exception_eve
dump_uint64( ", address=", &req->address );
fprintf( stderr, ", len=%u", req->len );
dump_varargs_uints64( ", params=", min(cur_size,req->len) );
dump_varargs_context( ", context=", cur_size );
}
static void dump_queue_exception_event_reply( const struct queue_exception_event_reply *req )
@ -2448,11 +2447,6 @@ static void dump_get_exception_status_request( const struct get_exception_status
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_get_exception_status_reply( const struct get_exception_status_reply *req )
{
dump_varargs_context( " context=", cur_size );
}
static void dump_continue_debug_event_request( const struct continue_debug_event_request *req )
{
fprintf( stderr, " pid=%04x", req->pid );
@ -4999,7 +4993,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_next_thread_reply,
(dump_func)dump_wait_debug_event_reply,
(dump_func)dump_queue_exception_event_reply,
(dump_func)dump_get_exception_status_reply,
NULL,
NULL,
NULL,
NULL,