From patchwork Tue Nov 26 17:11:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36212 Received: (qmail 92462 invoked by alias); 26 Nov 2019 17:11:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 92383 invoked by uid 89); 26 Nov 2019 17:11:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=requesting X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 17:11:41 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 4F58A201F1; Tue, 26 Nov 2019 12:11:38 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id C26FC2030C; Tue, 26 Nov 2019 12:11:30 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 9EB2E28173; Tue, 26 Nov 2019 12:11:30 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Tue, 26 Nov 2019 12:11:28 -0500 From: "Tom Tromey (Code Review)" To: Luis Machado , Simon Marchi , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [review v2] Rename win32_thread_info to windows_thread_info X-Gerrit-Change-Id: Iebd6d4caabf8499f4b6fd3022a085af80959ef87 X-Gerrit-Change-Number: 405 X-Gerrit-ChangeURL: X-Gerrit-Commit: e920d9410b46430c09277ccf1ef7adb3c3a00bae In-Reply-To: References: Reply-To: tromey@sourceware.org, simon.marchi@polymtl.ca, luis.machado@linaro.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191126171130.9EB2E28173@gnutoolchain-gerrit.osci.io> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/405 ...................................................................... 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. gdb/gdbserver/ChangeLog 2019-11-26 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. Change-Id: Iebd6d4caabf8499f4b6fd3022a085af80959ef87 --- M gdb/gdbserver/ChangeLog M gdb/gdbserver/win32-arm-low.c M gdb/gdbserver/win32-i386-low.c M gdb/gdbserver/win32-low.c M gdb/gdbserver/win32-low.h 5 files changed, 58 insertions(+), 37 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0241438..596bedb 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,24 @@ +2019-11-26 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. + 2019-11-22 Tom Tromey * gdb.ada/tasks.exp: Add -ada-task-info regression test. diff --git a/gdb/gdbserver/win32-arm-low.c b/gdb/gdbserver/win32-arm-low.c index 2d7dfde..c465aed 100644 --- a/gdb/gdbserver/win32-arm-low.c +++ b/gdb/gdbserver/win32-arm-low.c @@ -27,7 +27,7 @@ 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 @@ /* 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 @@ /* 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/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c index 399520c..3fc0cf1 100644 --- a/gdb/gdbserver/win32-i386-low.c +++ b/gdb/gdbserver/win32-i386-low.c @@ -40,7 +40,7 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ /* 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 @@ /* 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/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 449ed5f..6a081e2 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -126,7 +126,7 @@ /* 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); @@ -138,7 +138,7 @@ /* 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 @@ -159,7 +159,7 @@ /* 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); @@ -168,7 +168,7 @@ /* See win32-low.h. */ void -win32_require_context (win32_thread_info *th) +win32_require_context (windows_thread_info *th) { if (th->context.ContextFlags == 0) { @@ -190,30 +190,30 @@ /* 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; @@ -230,7 +230,7 @@ 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); @@ -425,7 +425,7 @@ 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) { @@ -474,7 +474,7 @@ 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 @@ -488,7 +488,7 @@ 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 @@ -900,7 +900,7 @@ DWORD tid; enum gdb_signal sig; int step; - win32_thread_info *th; + windows_thread_info *th; DWORD continue_status = DBG_CONTINUE; ptid_t ptid; @@ -1335,7 +1335,7 @@ 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) { @@ -1759,7 +1759,7 @@ static int win32_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/gdb/gdbserver/win32-low.h b/gdb/gdbserver/win32-low.h index 815c1b0..192e177 100644 --- a/gdb/gdbserver/win32-low.h +++ b/gdb/gdbserver/win32-low.h @@ -29,7 +29,7 @@ /* 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 @@ /* 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 @@ 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; @@ -102,7 +102,7 @@ extern struct win32_target_ops the_low_target; /* 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