From: Hannes Domani Date: Mon, 26 Jan 2026 18:34:16 +0000 (+0100) Subject: gdbserver: Move setting of process_info::tdesc into win32-i386-low.cc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b6401cdd4085acb24b9652f25189e91089dbcae;p=thirdparty%2Fbinutils-gdb.git gdbserver: Move setting of process_info::tdesc into win32-i386-low.cc It's arch-specific, and since now win32_tdesc and wow64_win32_tdesc are only used in this file, they are made static. Approved-By: Tom Tromey --- diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc index dfdbbf872dd..7e88d16fdd9 100644 --- a/gdbserver/win32-i386-low.cc +++ b/gdbserver/win32-i386-low.cc @@ -47,6 +47,13 @@ using namespace windows_nat; static struct x86_debug_reg_state debug_reg_state; +/* The inferior's target description. This is a global because the + Windows ports support neither bi-arch nor multi-process. */ +static const_target_desc_up win32_tdesc; +#ifdef __x86_64__ +static const_target_desc_up wow64_win32_tdesc; +#endif + static void update_debug_registers (thread_info *thread) { @@ -219,8 +226,15 @@ x86_stopped_data_addresses () } static void -i386_initial_stuff (void) +i386_initial_stuff (process_info *proc) { +#ifdef __x86_64__ + if (windows_process.wow64_process) + proc->tdesc = wow64_win32_tdesc.get (); + else +#endif + proc->tdesc = win32_tdesc.get (); + x86_low_init_dregs (&debug_reg_state); } diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index fb4da6488db..6c0a7e16ac9 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -62,11 +62,6 @@ gdbserver_windows_process windows_process; int using_threads = 1; -const_target_desc_up win32_tdesc; -#ifdef __x86_64__ -const_target_desc_up wow64_win32_tdesc; -#endif - #define NUM_REGS (the_low_target.num_regs ()) /* The current debug event from WaitForDebugEvent. */ @@ -324,17 +319,11 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached) #endif proc = add_process (pid, attached); -#ifdef __x86_64__ - if (windows_process.wow64_process) - proc->tdesc = wow64_win32_tdesc.get (); - else -#endif - proc->tdesc = win32_tdesc.get (); child_init_thread_list (); windows_process.child_initialization_done = 0; if (the_low_target.initial_stuff != NULL) - (*the_low_target.initial_stuff) (); + (*the_low_target.initial_stuff) (proc); windows_process.cached_status.set_ignore (); diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index 2196376fccb..a8109b7caf0 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -26,13 +26,6 @@ struct target_desc; -/* The inferior's target description. This is a global because the - Windows ports support neither bi-arch nor multi-process. */ -extern const_target_desc_up win32_tdesc; -#ifdef __x86_64__ -extern const_target_desc_up wow64_win32_tdesc; -#endif - #ifdef __CYGWIN__ constexpr enum gdb_osabi WINDOWS_OSABI = GDB_OSABI_CYGWIN; #else @@ -48,7 +41,7 @@ struct win32_target_ops int (*num_regs) (void); /* Perform initializations on startup. */ - void (*initial_stuff) (void); + void (*initial_stuff) (process_info *proc); /* Fetch the context from the inferior. */ void (*get_thread_context) (windows_nat::windows_thread_info *th);