From: Tom Tromey Date: Wed, 8 Apr 2020 20:33:35 +0000 (-0600) Subject: Rename win32_thread_info to windows_thread_info X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=e56f8ccb07890fc2c0413c530d27d105c74f622c;p=deliverable%2Fbinutils-gdb.git Rename win32_thread_info to windows_thread_info This renames win32_thread_info to windows_thread_info in gdbserver. This renaming helps make it possible to share some code between gdb and gdbserver. gdbserver/ChangeLog 2020-04-08 Tom Tromey * win32-low.h (struct windows_thread_info): Rename from win32_thread_info. Remove typedef. (struct win32_target_ops, win32_require_context): Update. * win32-low.c (win32_get_thread_context) (win32_set_thread_context, win32_prepare_to_resume) (win32_require_context, thread_rec, child_add_thread) (delete_thread_info, continue_one_thread) (child_fetch_inferior_registers, child_store_inferior_registers) (win32_resume, suspend_one_thread, win32_get_tib_address): Update. * win32-i386-low.c (update_debug_registers) (win32_get_current_dr, i386_get_thread_context) (i386_prepare_to_resume, i386_thread_added, i386_single_step) (i386_fetch_inferior_register, i386_store_inferior_register): Update. * win32-arm-low.c (arm_get_thread_context) (arm_fetch_inferior_register, arm_store_inferior_register): Update. --- diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 7ceebf0391..234d842ae1 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,24 @@ +2020-04-08 Tom Tromey + + * win32-low.h (struct windows_thread_info): Rename from + win32_thread_info. Remove typedef. + (struct win32_target_ops, win32_require_context): Update. + * win32-low.c (win32_get_thread_context) + (win32_set_thread_context, win32_prepare_to_resume) + (win32_require_context, thread_rec, child_add_thread) + (delete_thread_info, continue_one_thread) + (child_fetch_inferior_registers, child_store_inferior_registers) + (win32_resume, suspend_one_thread, win32_get_tib_address): + Update. + * win32-i386-low.c (update_debug_registers) + (win32_get_current_dr, i386_get_thread_context) + (i386_prepare_to_resume, i386_thread_added, i386_single_step) + (i386_fetch_inferior_register, i386_store_inferior_register): + Update. + * win32-arm-low.c (arm_get_thread_context) + (arm_fetch_inferior_register, arm_store_inferior_register): + Update. + 2020-04-02 Tankut Baris Aktemur * linux-low.h (struct linux_target_ops): Remove. diff --git a/gdbserver/win32-arm-low.cc b/gdbserver/win32-arm-low.cc index 619847d10f..c50c5dfdbf 100644 --- a/gdbserver/win32-arm-low.cc +++ b/gdbserver/win32-arm-low.cc @@ -27,7 +27,7 @@ void init_registers_arm (void); extern const struct target_desc *tdesc_arm; static void -arm_get_thread_context (win32_thread_info *th) +arm_get_thread_context (windows_thread_info *th) { th->context.ContextFlags = \ CONTEXT_FULL | \ @@ -88,7 +88,7 @@ regptr (CONTEXT* c, int r) /* Fetch register from gdbserver regcache data. */ static void arm_fetch_inferior_register (struct regcache *regcache, - win32_thread_info *th, int r) + windows_thread_info *th, int r) { char *context_offset = regptr (&th->context, r); supply_register (regcache, r, context_offset); @@ -97,7 +97,7 @@ arm_fetch_inferior_register (struct regcache *regcache, /* Store a new register value into the thread context of TH. */ static void arm_store_inferior_register (struct regcache *regcache, - win32_thread_info *th, int r) + windows_thread_info *th, int r) { collect_register (regcache, r, regptr (&th->context, r)); } diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc index f5f09e96a5..29ee49fcd0 100644 --- a/gdbserver/win32-i386-low.cc +++ b/gdbserver/win32-i386-low.cc @@ -40,7 +40,7 @@ static struct x86_debug_reg_state debug_reg_state; static void update_debug_registers (thread_info *thread) { - win32_thread_info *th = (win32_thread_info *) thread_target_data (thread); + windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); /* The actual update is done later just before resuming the lwp, we just mark that the registers need updating. */ @@ -73,8 +73,8 @@ x86_dr_low_set_control (unsigned long control) static DWORD64 win32_get_current_dr (int dr) { - win32_thread_info *th - = (win32_thread_info *) thread_target_data (current_thread); + windows_thread_info *th + = (windows_thread_info *) thread_target_data (current_thread); win32_require_context (th); @@ -210,7 +210,7 @@ i386_initial_stuff (void) } static void -i386_get_thread_context (win32_thread_info *th) +i386_get_thread_context (windows_thread_info *th) { /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if the system doesn't support extended registers. */ @@ -237,7 +237,7 @@ i386_get_thread_context (win32_thread_info *th) } static void -i386_prepare_to_resume (win32_thread_info *th) +i386_prepare_to_resume (windows_thread_info *th) { if (th->debug_registers_changed) { @@ -258,13 +258,13 @@ i386_prepare_to_resume (win32_thread_info *th) } static void -i386_thread_added (win32_thread_info *th) +i386_thread_added (windows_thread_info *th) { th->debug_registers_changed = 1; } static void -i386_single_step (win32_thread_info *th) +i386_single_step (windows_thread_info *th) { th->context.EFlags |= FLAG_TRACE_BIT; } @@ -398,7 +398,7 @@ static const int mappings[] = /* Fetch register from gdbserver regcache data. */ static void i386_fetch_inferior_register (struct regcache *regcache, - win32_thread_info *th, int r) + windows_thread_info *th, int r) { char *context_offset = (char *) &th->context + mappings[r]; @@ -420,7 +420,7 @@ i386_fetch_inferior_register (struct regcache *regcache, /* Store a new register value into the thread context of TH. */ static void i386_store_inferior_register (struct regcache *regcache, - win32_thread_info *th, int r) + windows_thread_info *th, int r) { char *context_offset = (char *) &th->context + mappings[r]; collect_register (regcache, r, context_offset); diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 8b2a16e86d..55e8322ceb 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -125,7 +125,7 @@ debug_event_ptid (DEBUG_EVENT *event) /* Get the thread context of the thread associated with TH. */ static void -win32_get_thread_context (win32_thread_info *th) +win32_get_thread_context (windows_thread_info *th) { memset (&th->context, 0, sizeof (CONTEXT)); (*the_low_target.get_thread_context) (th); @@ -137,7 +137,7 @@ win32_get_thread_context (win32_thread_info *th) /* Set the thread context of the thread associated with TH. */ static void -win32_set_thread_context (win32_thread_info *th) +win32_set_thread_context (windows_thread_info *th) { #ifdef _WIN32_WCE /* Calling SuspendThread on a thread that is running kernel code @@ -158,7 +158,7 @@ win32_set_thread_context (win32_thread_info *th) /* Set the thread context of the thread associated with TH. */ static void -win32_prepare_to_resume (win32_thread_info *th) +win32_prepare_to_resume (windows_thread_info *th) { if (the_low_target.prepare_to_resume != NULL) (*the_low_target.prepare_to_resume) (th); @@ -167,7 +167,7 @@ win32_prepare_to_resume (win32_thread_info *th) /* See win32-low.h. */ void -win32_require_context (win32_thread_info *th) +win32_require_context (windows_thread_info *th) { if (th->context.ContextFlags == 0) { @@ -189,30 +189,30 @@ win32_require_context (win32_thread_info *th) /* Find a thread record given a thread id. If GET_CONTEXT is set then also retrieve the context for this thread. */ -static win32_thread_info * +static windows_thread_info * thread_rec (ptid_t ptid, int get_context) { thread_info *thread = find_thread_ptid (ptid); if (thread == NULL) return NULL; - win32_thread_info *th = (win32_thread_info *) thread_target_data (thread); + windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); if (get_context) win32_require_context (th); return th; } /* Add a thread to the thread list. */ -static win32_thread_info * +static windows_thread_info * child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb) { - win32_thread_info *th; + windows_thread_info *th; ptid_t ptid = ptid_t (pid, tid, 0); if ((th = thread_rec (ptid, FALSE))) return th; - th = XCNEW (win32_thread_info); + th = XCNEW (windows_thread_info); th->tid = tid; th->h = h; th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb; @@ -229,7 +229,7 @@ child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb) static void delete_thread_info (thread_info *thread) { - win32_thread_info *th = (win32_thread_info *) thread_target_data (thread); + windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); remove_thread (thread); CloseHandle (th->h); @@ -424,7 +424,7 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached) static void continue_one_thread (thread_info *thread, int thread_id) { - win32_thread_info *th = (win32_thread_info *) thread_target_data (thread); + windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); if (thread_id == -1 || thread_id == th->tid) { @@ -473,7 +473,7 @@ static void child_fetch_inferior_registers (struct regcache *regcache, int r) { int regno; - win32_thread_info *th = thread_rec (current_thread_ptid (), TRUE); + windows_thread_info *th = thread_rec (current_thread_ptid (), TRUE); if (r == -1 || r > NUM_REGS) child_fetch_inferior_registers (regcache, NUM_REGS); else @@ -487,7 +487,7 @@ static void child_store_inferior_registers (struct regcache *regcache, int r) { int regno; - win32_thread_info *th = thread_rec (current_thread_ptid (), TRUE); + windows_thread_info *th = thread_rec (current_thread_ptid (), TRUE); if (r == -1 || r == 0 || r > NUM_REGS) child_store_inferior_registers (regcache, NUM_REGS); else @@ -911,7 +911,7 @@ win32_process_target::resume (thread_resume *resume_info, size_t n) DWORD tid; enum gdb_signal sig; int step; - win32_thread_info *th; + windows_thread_info *th; DWORD continue_status = DBG_CONTINUE; ptid_t ptid; @@ -1349,7 +1349,7 @@ handle_exception (struct target_waitstatus *ourstatus) static void suspend_one_thread (thread_info *thread) { - win32_thread_info *th = (win32_thread_info *) thread_target_data (thread); + windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); if (!th->suspended) { @@ -1835,7 +1835,7 @@ win32_process_target::supports_get_tib_address () int win32_process_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) { - win32_thread_info *th; + windows_thread_info *th; th = thread_rec (ptid, 0); if (th == NULL) return 0; diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index 9d2f0b4fbe..2bd94e8528 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -29,7 +29,7 @@ extern const struct target_desc *win32_tdesc; /* Thread information structure used to track extra information about each thread. */ -typedef struct win32_thread_info +struct windows_thread_info { /* The Win32 thread identifier. */ DWORD tid; @@ -54,7 +54,7 @@ typedef struct win32_thread_info /* Whether debug registers changed since we last set CONTEXT back to the thread. */ int debug_registers_changed; -} win32_thread_info; +}; struct win32_target_ops { @@ -68,23 +68,23 @@ struct win32_target_ops void (*initial_stuff) (void); /* Fetch the context from the inferior. */ - void (*get_thread_context) (win32_thread_info *th); + void (*get_thread_context) (windows_thread_info *th); /* Called just before resuming the thread. */ - void (*prepare_to_resume) (win32_thread_info *th); + void (*prepare_to_resume) (windows_thread_info *th); /* Called when a thread was added. */ - void (*thread_added) (win32_thread_info *th); + void (*thread_added) (windows_thread_info *th); /* Fetch register from gdbserver regcache data. */ void (*fetch_inferior_register) (struct regcache *regcache, - win32_thread_info *th, int r); + windows_thread_info *th, int r); /* Store a new register value into the thread context of TH. */ void (*store_inferior_register) (struct regcache *regcache, - win32_thread_info *th, int r); + windows_thread_info *th, int r); - void (*single_step) (win32_thread_info *th); + void (*single_step) (windows_thread_info *th); const unsigned char *breakpoint; int breakpoint_len; @@ -171,7 +171,7 @@ public: }; /* Retrieve the context for this thread, if not already retrieved. */ -extern void win32_require_context (win32_thread_info *th); +extern void win32_require_context (windows_thread_info *th); /* Map the Windows error number in ERROR to a locale-dependent error message string and return a pointer to it. Typically, the values