Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro_alves@portugalmail.pt>
To: gdb-patches@sourceware.org
Subject: [New WinCE support] [patch 2/4] : s/thread_info/win32_thread_info/g
Date: Fri, 16 Mar 2007 02:09:00 -0000	[thread overview]
Message-ID: <45F9FBF2.6010100@portugalmail.pt> (raw)
In-Reply-To: <20070315235008.243411000@portugalmail.pt>

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

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.




[-- Attachment #2: gdbserver_win32_thread_info.diff --]
[-- Type: text/plain, Size: 4911 bytes --]

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:



  parent reply	other threads:[~2007-03-16  2:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070315235008.243411000@portugalmail.pt>
2007-03-16  2:07 ` [New WinCE support] [patch 1/4] : mv win32-i386-low.c win32-low.c Pedro Alves
2007-03-27 19:11   ` Daniel Jacobowitz
2007-03-16  2:09 ` [New WinCE support] [patch 3/4] : bfd config Pedro Alves
2007-03-16  2:09 ` Pedro Alves [this message]
2007-03-27 19:12   ` [New WinCE support] [patch 2/4] : s/thread_info/win32_thread_info/g Daniel Jacobowitz
2007-03-16  2:10 ` [New WinCE support] [patch 4/4] The bulk of the code Pedro Alves
2007-03-16 12:52   ` Eli Zaretskii
2007-03-16 15:03     ` pedro alves
2007-03-17 11:18       ` Eli Zaretskii
2007-03-17 11:35         ` Andreas Schwab
2007-03-19  1:53         ` Pedro Alves
2007-03-19  4:21           ` Eli Zaretskii
2007-03-19 12:34             ` Daniel Jacobowitz
2007-03-27 19:20           ` Daniel Jacobowitz
2007-03-29  3:18             ` Pedro Alves
2007-03-29  3:51             ` Pedro Alves
2007-03-30 11:56               ` Pierre Muller
2007-03-30 12:23                 ` pedro alves
2007-03-30 20:35                   ` pedro alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45F9FBF2.6010100@portugalmail.pt \
    --to=pedro_alves@portugalmail.pt \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox