public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-muller-windows-multi:  rename windows_buf_t to win_buf_t and add comments
@ 2011-03-18 16:57 muller
  0 siblings, 0 replies; only message in thread
From: muller @ 2011-03-18 16:57 UTC (permalink / raw)
  To: archer-commits

The branch, archer-muller-windows-multi has been updated
       via  d8153905001bc0396dfec4cca6a2ac8d39ec5489 (commit)
      from  d62ea4be02174c57e9b31b1df478bae5ea48ac08 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit d8153905001bc0396dfec4cca6a2ac8d39ec5489
Author: Pierre Muller <muller@ics.u-strasbg.fr>
Date:   Fri Mar 18 17:57:36 2011 +0100

     rename windows_buf_t to win_buf_t and add comments

-----------------------------------------------------------------------

Summary of changes:
 gdb/common/windows-hdep.c |   30 ++++++++++++++++++++++++------
 gdb/common/windows-hdep.h |   16 +++++++++++-----
 gdb/windows-nat.c         |   30 +++++++++++++++---------------
 3 files changed, 50 insertions(+), 26 deletions(-)

First 500 lines of diff:
diff --git a/gdb/common/windows-hdep.c b/gdb/common/windows-hdep.c
index 640a099..315a983 100644
--- a/gdb/common/windows-hdep.c
+++ b/gdb/common/windows-hdep.c
@@ -1,4 +1,24 @@
+/* Copyright 2011 Free Software Foundation, Inc.
 
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* The primary purpose of this file is to implement conversion between
+   POSIX style and Windows NATIVE style path and path lists.
+   For this purpose, generic replacement of the two cygwin function
+   cygwin_conv_path and cygwin_conv_path_list are created.  */
 
 #include <winsock2.h>
 #include <windows.h>
@@ -14,9 +34,7 @@
 #include "windows-hdep.h"
 
 int
-gdb_win_conv_path (conv_type oper, const void *from,
-		   void * to, int size)
-
+gdb_win_conv_path (conv_type oper, const void *from, void * to, int size)
 {
 #ifdef USE_MINGW_CONV
   if (size == 0)
@@ -128,9 +146,7 @@ gdb_win_conv_path (conv_type oper, const void *from,
 /* Analogeous function for PATH style lists.  */
 
 int
-gdb_win_conv_path_list (conv_type oper, const void *from,
-			void * to, int size)
-
+gdb_win_conv_path_list (conv_type oper, const void *from, void * to, int size)
 {
 #ifdef USE_MINGW_CONV
 #ifdef USE_WIDE_WINAPI
@@ -207,6 +223,8 @@ gdb_win_conv_path_list (conv_type oper, const void *from,
 #endif /* USE_OLD_CYGWIN_CONV */
 }
 
+/* sleep function does not exist in mingw32 libraries. This is a
+   simple substitute function.  */
 #ifdef NEED_SLEEP_SUBSTITUTE
 int
 sleep (int t)
diff --git a/gdb/common/windows-hdep.h b/gdb/common/windows-hdep.h
index 3564c6a..65b1ce5 100644
--- a/gdb/common/windows-hdep.h
+++ b/gdb/common/windows-hdep.h
@@ -24,12 +24,19 @@
 #ifndef WINDOWS_HDEP_H
 #define WINDOWS_HDEP_H
 
-/* The following macros are redefined below depend on the use of wide
+/* The following macros are redefined below depending on the use of wide
    chars or not.  */
 #undef STARTUPINFO
 #undef CreateProcess
 #undef GetModuleFileNameEx
 #undef GetSystemDirectory
+/* Macro _G(text) either expands to simply text or to L##text depending
+   on use of wide chars or not.
+   Although this is similar to _T macro inside winnt.h header,
+   its value is set according to USE_WIDE_API macro, allowing to compile
+   GDB with wide char use even on systems for which the default is to
+   use ASCII chars.  */
+#undef _G
 
 #ifdef __CYGWIN__
 #ifdef PATH_MAX
@@ -59,14 +66,13 @@
 # define __PMAX	(MAX_PATH + 1)
 # define USE_MINGW_CONV
 # define NEED_SLEEP_SUBSTITUTE
-#endif
+#endif /* not __CYGWIN__ */
 
-#undef _G
 #ifdef USE_WIDE_WINAPI
 # define _G(text) L##text
 # define WINDOWS_POSIX_TO_NATIVE WINDOWS_POSIX_TO_NATIVE_W
 # define WINDOWS_NATIVE_TO_POSIX WINDOWS_NATIVE_W_TO_POSIX
-  typedef wchar_t windows_buf_t;
+  typedef wchar_t win_buf_t;
 # define STARTUPINFO STARTUPINFOW
 # define CreateProcess CreateProcessW
 # define GetSystemDirectory GetSystemDirectoryW
@@ -82,7 +88,7 @@
 # define _G(text) text
 # define WINDOWS_POSIX_TO_NATIVE WINDOWS_POSIX_TO_NATIVE_A
 # define WINDOWS_NATIVE_TO_POSIX WINDOWS_NATIVE_A_TO_POSIX
-  typedef char windows_buf_t;
+  typedef char win_buf_t;
 # define STARTUPINFO STARTUPINFOA
 # define CreateProcess CreateProcessA
 # define GetSystemDirectory GetSystemDirectoryA
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 092e0b7..8bc69fa 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -693,7 +693,7 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
   DWORD cbNeeded;
 /* Temporary storage prior to converting to posix form.  __PMAX is always
    enough as long as SO_NAME_MAX_PATH_SIZE is defined as 512.  */
-  windows_buf_t pathbuf[__PMAX];
+  win_buf_t pathbuf[__PMAX];
 
   cbNeeded = 0;
   /* Find size of buffer needed to handle list of modules loaded in
@@ -871,14 +871,14 @@ windows_make_so (const char *name, LPVOID load_addr)
       strcat (buf, "\\ntdll.dll");
     }
 #else
-  windows_buf_t buf[__PMAX];
+  win_buf_t buf[__PMAX];
 
   buf[0] = 0;
   if (access (name, F_OK) != 0)
     {
       if (strcasecmp (name, "ntdll.dll") == 0)
 	{
-	  GetSystemDirectory (buf, sizeof (buf) / sizeof (windows_buf_t));
+	  GetSystemDirectory (buf, sizeof (buf) / sizeof (win_buf_t));
 	  gdb_windows_strcat (buf, _G("\\ntdll.dll"));
 	}
     }
@@ -2348,14 +2348,14 @@ static win_env conv_envvars[] =
 #endif
 
   STARTUPINFO si;
-  windows_buf_t real_path[__PMAX];
-  windows_buf_t shell[__PMAX]; /* Path to shell */
+  win_buf_t real_path[__PMAX];
+  win_buf_t shell[__PMAX]; /* Path to shell */
   const char *sh;
   char *entry_exec_file = exec_file;
-  windows_buf_t *toexec;
-  windows_buf_t *cygallargs;
-  windows_buf_t *args;
-  windows_buf_t *out_env;
+  win_buf_t *toexec;
+  win_buf_t *cygallargs;
+  win_buf_t *args;
+  win_buf_t *out_env;
   size_t len;
   int env_size, i, j;
 #ifdef __CYGWIN__
@@ -2390,7 +2390,7 @@ static win_env conv_envvars[] =
       else
 	flags |= DEBUG_ONLY_THIS_PROCESS;
       if (gdb_win_conv_path (WINDOWS_POSIX_TO_NATIVE, exec_file, real_path,
-			     __PMAX * sizeof (windows_buf_t)) < 0)
+			     __PMAX * sizeof (win_buf_t)) < 0)
 	error (_("Error starting executable: %d"), errno);
       toexec = real_path;
 #ifdef USE_WIDE_WINAPI
@@ -2509,8 +2509,8 @@ static win_env conv_envvars[] =
 #endif
 
 #ifdef USE_WIDE_WINAPI
-  args = (windows_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
-				  * sizeof (wchar_t));
+  args = (win_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
+			       * sizeof (wchar_t));
   wcscpy (args, toexec);
   wcscat (args, L" ");
   wcscat (args, cygallargs);
@@ -2519,7 +2519,7 @@ static win_env conv_envvars[] =
     {
       env_size += mbstowcs (NULL, in_env[i], 0) + 1;
     }
-  out_env = (windows_buf_t *) alloca (env_size * sizeof (windows_buf_t *));
+  out_env = (win_buf_t *) alloca (env_size * sizeof (win_buf_t *));
   env_size = 0;
   for (i = 0; in_env[i]; i++)
     {
@@ -2530,7 +2530,7 @@ static win_env conv_envvars[] =
   out_env[env_size] = L'\0';
   flags |= CREATE_UNICODE_ENVIRONMENT;
 #else
-  args = (windows_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
+  args = (win_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
   strcpy (args, toexec);
   strcat (args, " ");
   strcat (args, cygallargs);
@@ -2539,7 +2539,7 @@ static win_env conv_envvars[] =
     {
       env_size += strlen(in_env[i]) + 1;
     }
-  out_env = (windows_buf_t *) alloca (env_size * sizeof (windows_buf_t *));
+  out_env = (win_buf_t *) alloca (env_size * sizeof (win_buf_t *));
   env_size = 0;
   for (i = 0; in_env[i]; i++)
     {


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-18 16:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 16:57 [SCM] archer-muller-windows-multi: rename windows_buf_t to win_buf_t and add comments muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).