From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24743 invoked by alias); 16 Mar 2007 02:09:17 -0000 Received: (qmail 24734 invoked by uid 22791); 16 Mar 2007 02:09:16 -0000 X-Spam-Check-By: sourceware.org Received: from elrond.portugalmail.pt (HELO elrond.portugalmail.pt) (195.245.179.181) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 16 Mar 2007 02:09:11 +0000 Received: from localhost (localhost [127.0.0.1]) by elrond.portugalmail.pt (Postfix) with ESMTP id F064B3CB58 for ; Fri, 16 Mar 2007 02:04:53 +0000 (WET) Received: from elrond.portugalmail.pt ([127.0.0.1]) by localhost (elrond.portugalmail.pt [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PX0dfGGyohUJ for ; Fri, 16 Mar 2007 02:04:53 +0000 (WET) Received: from [127.0.0.1] (62.169.93.152.rev.optimus.pt [62.169.93.152]) (Authenticated sender: pedro_alves@portugalmail.pt) by elrond.portugalmail.pt (Postfix) with ESMTP id 4F82D3CB4F for ; Fri, 16 Mar 2007 02:04:51 +0000 (WET) Message-ID: <45F9FBF2.6010100@portugalmail.pt> Date: Fri, 16 Mar 2007 02:09:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [New WinCE support] [patch 2/4] : s/thread_info/win32_thread_info/g References: <20070315235008.243411000@portugalmail.pt> In-Reply-To: <20070315235008.243411000@portugalmail.pt> Content-Type: multipart/mixed; boundary="------------050505050808060104070205" X-Antivirus: avast! (VPS 000724-0, 15-03-2007), Outbound message X-Antivirus-Status: Clean X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00148.txt.bz2 This is a multi-part message in MIME format. --------------050505050808060104070205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 566 This is a pretty mechanical patch, that fixes one annoyance I had when I started reading the gdbserver win32 support code. There is an opaque struct thread_info declared in server.h, and the win32-low.c file implements a 'typedef struct win32_thread_info thread_info'. I find it confusing to have code like: thread_rec (DWORD id, int get_context) { struct thread_info *thread; thread_info *th; I only noticed the types where unrelated after my first working gdbserver/WinCE prototype was working :) The attached patch should make the code clearer. --------------050505050808060104070205 Content-Type: text/plain; name="gdbserver_win32_thread_info.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbserver_win32_thread_info.diff" Content-length: 4911 gdbserver/ChangeLog * win32-low.c: Rename typedef thread_info to win32_thread_info throughout. --- gdb/gdbserver/win32-low.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) Index: src/gdb/gdbserver/win32-low.c =================================================================== --- src.orig/gdb/gdbserver/win32-low.c 2007-03-15 00:38:04.000000000 +0000 +++ src/gdb/gdbserver/win32-low.c 2007-03-15 02:25:20.000000000 +0000 @@ -68,13 +68,13 @@ typedef BOOL winapi_DebugSetProcessKillO /* Thread information structure used to track extra information about each thread. */ -typedef struct thread_info_struct +typedef struct win32_thread_info { DWORD tid; HANDLE h; int suspend_count; CONTEXT context; -} thread_info; +} win32_thread_info; static DWORD main_thread_id = 0; /* Get the thread ID from the current selected inferior (the current @@ -82,17 +82,17 @@ static DWORD main_thread_id = 0; static DWORD current_inferior_tid (void) { - thread_info *th = inferior_target_data (current_inferior); + win32_thread_info *th = inferior_target_data (current_inferior); return th->tid; } /* Find a thread record given a thread id. If GET_CONTEXT is set then also retrieve the context for this thread. */ -static thread_info * +static win32_thread_info * thread_rec (DWORD id, int get_context) { struct thread_info *thread; - thread_info *th; + win32_thread_info *th; thread = (struct thread_info *) find_inferior_id (&all_threads, id); if (thread == NULL) @@ -126,15 +126,15 @@ thread_rec (DWORD id, int get_context) } /* Add a thread to the thread list. */ -static thread_info * +static win32_thread_info * child_add_thread (DWORD tid, HANDLE h) { - thread_info *th; + win32_thread_info *th; if ((th = thread_rec (tid, FALSE))) return th; - th = (thread_info *) malloc (sizeof (*th)); + th = (win32_thread_info *) malloc (sizeof (*th)); memset (th, 0, sizeof (*th)); th->tid = tid; th->h = h; @@ -170,7 +170,7 @@ child_add_thread (DWORD tid, HANDLE h) static void delete_thread_info (struct inferior_list_entry *thread) { - thread_info *th = inferior_target_data ((struct thread_info *) thread); + win32_thread_info *th = inferior_target_data ((struct thread_info *) thread); remove_thread ((struct thread_info *) thread); CloseHandle (th->h); @@ -341,7 +341,7 @@ continue_one_thread (struct inferior_lis { struct thread_info *thread = (struct thread_info *) this_thread; int thread_id = * (int *) id_ptr; - thread_info *th = inferior_target_data (thread); + win32_thread_info *th = inferior_target_data (thread); int i; if ((thread_id == -1 || thread_id == th->tid) @@ -386,7 +386,7 @@ child_continue (DWORD continue_status, i /* Fetch register(s) from gdbserver regcache data. */ static void -do_child_fetch_inferior_registers (thread_info *th, int r) +do_child_fetch_inferior_registers (win32_thread_info *th, int r) { char *context_offset = ((char *) &th->context) + mappings[r]; long l; @@ -409,7 +409,7 @@ static void child_fetch_inferior_registers (int r) { int regno; - thread_info *th = thread_rec (current_inferior_tid (), TRUE); + win32_thread_info *th = thread_rec (current_inferior_tid (), TRUE); if (r == -1 || r == 0 || r > NUM_REGS) child_fetch_inferior_registers (NUM_REGS); else @@ -419,7 +419,7 @@ child_fetch_inferior_registers (int r) /* Get register from gdbserver regcache data. */ static void -do_child_store_inferior_registers (thread_info *th, int r) +do_child_store_inferior_registers (win32_thread_info *th, int r) { collect_register (r, ((char *) &th->context) + mappings[r]); } @@ -430,7 +430,7 @@ static void child_store_inferior_registers (int r) { int regno; - thread_info *th = thread_rec (current_inferior_tid (), TRUE); + win32_thread_info *th = thread_rec (current_inferior_tid (), TRUE); if (r == -1 || r == 0 || r > NUM_REGS) child_store_inferior_registers (NUM_REGS); else @@ -644,7 +644,7 @@ win32_resume (struct thread_resume *resu DWORD tid; enum target_signal sig; int step; - thread_info *th; + win32_thread_info *th; DWORD continue_status = DBG_CONTINUE; /* This handles the very limited set of resume packets that GDB can @@ -722,7 +722,7 @@ win32_resume (struct thread_resume *resu static int handle_exception (struct target_waitstatus *ourstatus) { - thread_info *th; + win32_thread_info *th; DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode; ourstatus->kind = TARGET_WAITKIND_STOPPED; @@ -830,8 +830,8 @@ get_child_debug_event (struct target_wai { BOOL debug_event; DWORD continue_status, event_code; - thread_info *th = NULL; - static thread_info dummy_thread_info; + win32_thread_info *th = NULL; + static win32_thread_info dummy_thread_info; int retval = 0; in: --------------050505050808060104070205--