From 6f5e34ad14986cb7a299bacf01f1da0297e0dd7f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 18 Nov 2024 21:33:42 +0100 Subject: [PATCH] server: Use an explicit union instead of a typedef for debug event data. --- dlls/ntdll/unix/sync.c | 4 ++-- include/wine/server_protocol.h | 4 ++-- server/debugger.c | 6 +++--- server/protocol.def | 4 ++-- server/request_handlers.h | 2 +- server/trace.c | 2 +- tools/make_requests | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index a2d587ac197..26a4b1a9a04 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -993,7 +993,7 @@ NTSTATUS WINAPI NtSetInformationDebugObject( HANDLE handle, DEBUGOBJECTINFOCLASS /* convert the server event data to an NT state change; helper for NtWaitForDebugEvent */ -static NTSTATUS event_data_to_state_change( const debug_event_t *data, DBGUI_WAIT_STATE_CHANGE *state ) +static NTSTATUS event_data_to_state_change( const union debug_event_data *data, DBGUI_WAIT_STATE_CHANGE *state ) { int i; @@ -1098,7 +1098,7 @@ static NTSTATUS get_image_machine( HANDLE handle, USHORT *machine ) NTSTATUS WINAPI NtWaitForDebugEvent( HANDLE handle, BOOLEAN alertable, LARGE_INTEGER *timeout, DBGUI_WAIT_STATE_CHANGE *state ) { - debug_event_t data; + union debug_event_data data; unsigned int ret; BOOL wait = TRUE; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index db96db10268..51188a9c126 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -57,7 +57,7 @@ struct request_max_size -typedef union +union debug_event_data { int code; struct @@ -109,7 +109,7 @@ typedef union int __pad; mod_handle_t base; } unload_dll; -} debug_event_t; +}; enum context_exec_space diff --git a/server/debugger.c b/server/debugger.c index c59a0abea77..ceeaea99ece 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -48,7 +48,7 @@ struct debug_event struct file *file; /* file object for events that need one */ enum debug_event_state state; /* event state */ int status; /* continuation status */ - debug_event_t data; /* event data */ + union debug_event_data data; /* event data */ }; static const WCHAR debug_obj_name[] = {'D','e','b','u','g','O','b','j','e','c','t'}; @@ -142,7 +142,7 @@ static client_ptr_t get_teb_user_ptr( struct thread *thread ) static void fill_exception_event( struct debug_event *event, const void *arg ) { - const debug_event_t *data = arg; + const union debug_event_data *data = arg; event->data.exception = data->exception; event->data.exception.nb_params = min( event->data.exception.nb_params, EXCEPTION_MAXIMUM_PARAMETERS ); } @@ -641,7 +641,7 @@ DECL_HANDLER(queue_exception_event) reply->handle = 0; if (debug_obj) { - debug_event_t data; + union debug_event_data data; struct debug_event *event; struct thread *thread = current; diff --git a/server/protocol.def b/server/protocol.def index c8d59efe084..7b14b5e92eb 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -73,7 +73,7 @@ struct request_max_size /* debug event data */ -typedef union +union debug_event_data { int code; /* event code */ struct @@ -125,7 +125,7 @@ typedef union int __pad; mod_handle_t base; /* base address of the dll */ } unload_dll; -} debug_event_t; +}; enum context_exec_space diff --git a/server/request_handlers.h b/server/request_handlers.h index 3b74497db9f..6611cb57153 100644 --- a/server/request_handlers.h +++ b/server/request_handlers.h @@ -604,7 +604,6 @@ C_ASSERT( sizeof(client_ptr_t) == 8 ); C_ASSERT( sizeof(context_t) == 1728 ); C_ASSERT( sizeof(cursor_pos_t) == 24 ); C_ASSERT( sizeof(data_size_t) == 4 ); -C_ASSERT( sizeof(debug_event_t) == 160 ); C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(generic_map_t) == 16 ); C_ASSERT( sizeof(int) == 4 ); @@ -640,6 +639,7 @@ C_ASSERT( sizeof(timeout_t) == 8 ); C_ASSERT( sizeof(udp_endpoint) == 32 ); C_ASSERT( sizeof(union apc_call) == 64 ); C_ASSERT( sizeof(union apc_result) == 40 ); +C_ASSERT( sizeof(union debug_event_data) == 160 ); C_ASSERT( sizeof(union hw_input) == 40 ); C_ASSERT( sizeof(union message_data) == 48 ); C_ASSERT( sizeof(unsigned __int64) == 8 ); diff --git a/server/trace.c b/server/trace.c index 56576339eb8..c3d4763c055 100644 --- a/server/trace.c +++ b/server/trace.c @@ -887,7 +887,7 @@ static void dump_varargs_contexts( const char *prefix, data_size_t size ) static void dump_varargs_debug_event( const char *prefix, data_size_t size ) { - debug_event_t event; + union debug_event_data event; if (!size) { diff --git a/tools/make_requests b/tools/make_requests index 7a700372b2d..f028bd42dde 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -45,7 +45,6 @@ my %formats = # varargs-only structures "context_t" => [ 1728, 8 ], "cursor_pos_t" => [ 24, 8 ], - "debug_event_t" => [ 160, 8 ], "pe_image_info_t" => [ 88, 8 ], "property_data_t" => [ 16, 8 ], "select_op_t" => [ 264, 8 ], @@ -55,6 +54,7 @@ my %formats = "union apc_call" => [ 64, 8 ], "union apc_result" => [ 40, 8 ], "struct async_data" => [ 40, 8 ], + "union debug_event_data" => [ 160, 8 ], "struct filesystem_event" => [ 12, 4 ], "struct handle_info" => [ 20, 4 ], "union hw_input" => [ 40, 8 ],