Commit 7f9eb22a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 137fd7d3
...@@ -131,7 +131,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con ...@@ -131,7 +131,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
DWORD i; DWORD i;
obj_handle_t handle = 0; obj_handle_t handle = 0;
client_ptr_t params[EXCEPTION_MAXIMUM_PARAMETERS]; client_ptr_t params[EXCEPTION_MAXIMUM_PARAMETERS];
context_t server_context; CONTEXT exception_context = *context;
select_op_t select_op; select_op_t select_op;
sigset_t old_set; sigset_t old_set;
...@@ -142,8 +142,6 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con ...@@ -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++) for (i = 0; i < min( rec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS ); i++)
params[i] = rec->ExceptionInformation[i]; params[i] = rec->ExceptionInformation[i];
context_to_server( &server_context, context );
SERVER_START_REQ( queue_exception_event ) SERVER_START_REQ( queue_exception_event )
{ {
req->first = first_chance; req->first = first_chance;
...@@ -153,7 +151,6 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con ...@@ -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->address = wine_server_client_ptr( rec->ExceptionAddress );
req->len = i * sizeof(params[0]); req->len = i * sizeof(params[0]);
wine_server_add_data( req, params, req->len ); 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; if (!(ret = wine_server_call( req ))) handle = reply->handle;
} }
SERVER_END_REQ; SERVER_END_REQ;
...@@ -162,16 +159,15 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con ...@@ -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.op = SELECT_WAIT;
select_op.wait.handles[0] = handle; 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 ) SERVER_START_REQ( get_exception_status )
{ {
req->handle = handle; req->handle = handle;
wine_server_set_reply( req, &server_context, sizeof(server_context) );
ret = wine_server_call( req ); ret = wine_server_call( req );
} }
SERVER_END_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 ); pthread_sigmask( SIG_SETMASK, &old_set, NULL );
......
...@@ -2522,7 +2522,6 @@ struct queue_exception_event_request ...@@ -2522,7 +2522,6 @@ struct queue_exception_event_request
client_ptr_t address; client_ptr_t address;
data_size_t len; data_size_t len;
/* VARARG(params,uints64,len); */ /* VARARG(params,uints64,len); */
/* VARARG(context,context); */
char __pad_44[4]; char __pad_44[4];
}; };
struct queue_exception_event_reply struct queue_exception_event_reply
...@@ -2542,7 +2541,6 @@ struct get_exception_status_request ...@@ -2542,7 +2541,6 @@ struct get_exception_status_request
struct get_exception_status_reply struct get_exception_status_reply
{ {
struct reply_header __header; struct reply_header __header;
/* VARARG(context,context); */
}; };
...@@ -6686,7 +6684,7 @@ union generic_reply ...@@ -6686,7 +6684,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 600 #define SERVER_PROTOCOL_VERSION 601
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -50,7 +50,6 @@ struct debug_event ...@@ -50,7 +50,6 @@ struct debug_event
enum debug_event_state state; /* event state */ enum debug_event_state state; /* event state */
int status; /* continuation status */ int status; /* continuation status */
debug_event_t data; /* event data */ debug_event_t data; /* event data */
context_t context; /* register context */
}; };
/* debug context */ /* debug context */
...@@ -347,11 +346,6 @@ static void debug_event_destroy( struct object *obj ) ...@@ -347,11 +346,6 @@ static void debug_event_destroy( struct object *obj )
break; break;
} }
} }
if (event->sender->context == &event->context)
{
event->sender->context = NULL;
stop_thread_if_suspended( event->sender );
}
release_object( event->sender ); release_object( event->sender );
release_object( event->debugger ); release_object( event->debugger );
} }
...@@ -746,13 +740,6 @@ DECL_HANDLER(queue_exception_event) ...@@ -746,13 +740,6 @@ DECL_HANDLER(queue_exception_event)
if ((event = alloc_debug_event( thread, EXCEPTION_DEBUG_EVENT, &data ))) 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 ))) if ((reply->handle = alloc_handle( thread->process, event, SYNCHRONIZE, 0 )))
{ {
link_event( event ); link_event( event );
...@@ -772,18 +759,7 @@ DECL_HANDLER(get_exception_status) ...@@ -772,18 +759,7 @@ DECL_HANDLER(get_exception_status)
0, &debug_event_ops ))) 0, &debug_event_ops )))
{ {
close_handle( current->process, req->handle ); close_handle( current->process, req->handle );
if (event->state == EVENT_CONTINUED) set_error( event->state == EVENT_CONTINUED ? event->status : STATUS_PENDING );
{
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 );
release_object( event ); release_object( event );
} }
} }
......
...@@ -1934,7 +1934,6 @@ enum char_info_mode ...@@ -1934,7 +1934,6 @@ enum char_info_mode
client_ptr_t address; /* exception address */ client_ptr_t address; /* exception address */
data_size_t len; /* size of parameters */ data_size_t len; /* size of parameters */
VARARG(params,uints64,len);/* exception parameters */ VARARG(params,uints64,len);/* exception parameters */
VARARG(context,context); /* thread context */
@REPLY @REPLY
obj_handle_t handle; /* handle to the queued event */ obj_handle_t handle; /* handle to the queued event */
@END @END
...@@ -1943,8 +1942,6 @@ enum char_info_mode ...@@ -1943,8 +1942,6 @@ enum char_info_mode
/* Retrieve the status of an exception event */ /* Retrieve the status of an exception event */
@REQ(get_exception_status) @REQ(get_exception_status)
obj_handle_t handle; /* handle to the queued event */ obj_handle_t handle; /* handle to the queued event */
@REPLY
VARARG(context,context); /* modified thread context */
@END @END
......
...@@ -1377,7 +1377,6 @@ C_ASSERT( FIELD_OFFSET(struct queue_exception_event_reply, handle) == 8 ); ...@@ -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( sizeof(struct queue_exception_event_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_exception_status_request, handle) == 12 ); 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_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, pid) == 12 );
C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, tid) == 16 ); C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, tid) == 16 );
C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, status) == 20 ); C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, status) == 20 );
......
...@@ -588,12 +588,6 @@ void stop_thread( struct thread *thread ) ...@@ -588,12 +588,6 @@ void stop_thread( struct thread *thread )
if (is_process_init_done(thread->process)) send_thread_signal( thread, SIGUSR1 ); 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 */ /* suspend a thread */
int suspend_thread( struct thread *thread ) int suspend_thread( struct thread *thread )
{ {
......
...@@ -115,7 +115,6 @@ extern enum select_op get_wait_queue_select_op( struct wait_queue_entry *entry ) ...@@ -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 client_ptr_t get_wait_queue_key( struct wait_queue_entry *entry );
extern void make_wait_abandoned( 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( struct thread *thread );
extern void stop_thread_if_suspended( struct thread *thread );
extern int wake_thread( struct thread *thread ); extern int wake_thread( struct thread *thread );
extern int wake_thread_queue_entry( struct wait_queue_entry *entry ); extern int wake_thread_queue_entry( struct wait_queue_entry *entry );
extern int add_queue( struct object *obj, struct wait_queue_entry *entry ); extern int add_queue( struct object *obj, struct wait_queue_entry *entry );
......
...@@ -2435,7 +2435,6 @@ static void dump_queue_exception_event_request( const struct queue_exception_eve ...@@ -2435,7 +2435,6 @@ static void dump_queue_exception_event_request( const struct queue_exception_eve
dump_uint64( ", address=", &req->address ); dump_uint64( ", address=", &req->address );
fprintf( stderr, ", len=%u", req->len ); fprintf( stderr, ", len=%u", req->len );
dump_varargs_uints64( ", params=", min(cur_size,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 ) 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 ...@@ -2448,11 +2447,6 @@ static void dump_get_exception_status_request( const struct get_exception_status
fprintf( stderr, " handle=%04x", req->handle ); 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 ) static void dump_continue_debug_event_request( const struct continue_debug_event_request *req )
{ {
fprintf( stderr, " pid=%04x", req->pid ); fprintf( stderr, " pid=%04x", req->pid );
...@@ -4999,7 +4993,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { ...@@ -4999,7 +4993,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_next_thread_reply, (dump_func)dump_next_thread_reply,
(dump_func)dump_wait_debug_event_reply, (dump_func)dump_wait_debug_event_reply,
(dump_func)dump_queue_exception_event_reply, (dump_func)dump_queue_exception_event_reply,
(dump_func)dump_get_exception_status_reply, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment