[OBV] Fix Build gdbtk-cmds.c get error

"Pierre Muller" <[email protected]>
Newsgroups gmane.comp.debugging.insight
Message-ID <[email protected]>

> -----Message d'origine-----
> De : [email protected] [mailto:[email protected]]
> De la part de Hui Zhu
> Envoyé : Thursday, June 17, 2010 4:18 AM
> À : [email protected]
> Objet : Re: Build gdbtk-cmds.c get error
> 
> Ping.

I checked the following in:
  Note that it fixes the val_print problem
and also cygwin specific problems to 
allow compilation with both 1.5 and 1.7 cygwin...

  For the cygwin_conv_path function,
I used the same macros as in gdb/windows-nat.c source.

  Please feel free to suggest better
fixes.
  I didn't dare to change
GDB_val_print function, as this could have implications
for tcl/tk scripts... Am I right on this?

  
Pierre

PS: I only fixed compilation and I am still unable to 
really test cygwin insight :(


2010-06-18  Pierre Muller  <[email protected]>

	* generic/gdbtk-cmds.c: Add cygwin macros to allow compilation 
	with old or recent cygwin version.
	(gdb_path_conv): Use cygwin_conv_path function.
	(gdb_eval): Adapt to new field in val_print.
	* generic/gdbtk-register.c (get_register): Likewise.
	* generic/gdbtk-wrapper.c (wrap_val_print): Likewise.
	* generic/gdbtk.c (_initialize_gdbtk): Use
cygwin_attach_handle_to_fd
	call to allow compilation with old and new cygwin version.

Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.117
diff -u -p -r1.117 gdbtk-cmds.c
--- generic/gdbtk-cmds.c	12 Mar 2010 18:34:12 -0000	1.117
+++ generic/gdbtk-cmds.c	18 Jun 2010 22:13:12 -0000
@@ -74,6 +74,20 @@
 
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>		/* for
cygwin_conv_to_full_win32_path */
+#include <cygwin/version.h>
+# if
CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API
_MINOR) >= 181
+#   define __USEWIDE
+# else
+#   define CCP_POSIX_TO_WIN_A 0 
+#   define CCP_POSIX_TO_WIN_W 1
+#   define CCP_WIN_A_TO_POSIX 2 
+#   define CCP_WIN_W_TO_POSIX 3
+#   define cygwin_conv_path(op, from, to, size)  \
+         (op == CCP_WIN_A_TO_POSIX) ? \
+         cygwin_conv_to_full_posix_path (from, to) : \
+         cygwin_conv_to_win32_path (from, to)
+#   define CW_SET_DOS_FILE_WARNING -1	/* no-op this for older Cygwin */
+# endif
 #endif
 
 #ifdef HAVE_CTYPE_H
@@ -640,7 +654,7 @@ gdb_eval (ClientData clientData, Tcl_Int
   make_cleanup_ui_file_delete (stb);
   val_print (value_type (val), value_contents (val),
 	     value_embedded_offset (val), value_address (val),
-	     stb, 0, &opts, current_language);
+	     stb, 0, val, &opts, current_language);
   result = ui_file_xstrdup (stb, &dummy);
   Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));
   xfree (result);
@@ -2874,8 +2888,8 @@ gdb_path_conv (ClientData clientData, Tc
   {
     char pathname[256], *ptr;
 
-    cygwin_conv_to_full_win32_path (Tcl_GetStringFromObj (objv[1], NULL),
-				      pathname);
+    cygwin_conv_path (CCP_POSIX_TO_WIN_A, Tcl_GetStringFromObj (objv[1],
NULL),
+		      pathname, 256);
     for (ptr = pathname; *ptr; ptr++)
       {
 	if (*ptr == '\\')
Index: generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.38
diff -u -p -r1.38 gdbtk-register.c
--- generic/gdbtk-register.c	7 Jul 2009 12:38:56 -0000	1.38
+++ generic/gdbtk-register.c	18 Jun 2010 22:13:12 -0000
@@ -343,11 +343,11 @@ get_register (int regnum, map_arg arg)
 		      gdbarch_register_name (get_current_arch (), regnum))
== 0))
 	{
 	  val_print (FIELD_TYPE (TYPE_FIELD (reg_vtype, 0)), buffer, 0, 0,
-		     stb, 0, &opts, current_language);
+		     stb, 0, NULL, &opts, current_language);
 	}
       else
 	val_print (reg_vtype, buffer, 0, 0,
-		   stb, 0, &opts, current_language);
+		   stb, 0, NULL, &opts, current_language);
     }
   
   res = ui_file_xstrdup (stb, &dummy);
Index: generic/gdbtk-wrapper.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-wrapper.c,v
retrieving revision 1.18
diff -u -p -r1.18 gdbtk-wrapper.c
--- generic/gdbtk-wrapper.c	15 Dec 2008 18:06:12 -0000	1.18
+++ generic/gdbtk-wrapper.c	18 Jun 2010 22:13:12 -0000
@@ -218,7 +218,7 @@ wrap_val_print (char *a)
   recurse = (*args)->args[6].integer;
   opts.pretty = (enum val_prettyprint) (*args)->args[7].integer;
 
-  val_print (type, valaddr, 0, address, stream, recurse, &opts,
+  val_print (type, valaddr, 0, address, stream, recurse, NULL, &opts,
              current_language);
   return 1;
 }
Index: generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.50
diff -u -p -r1.50 gdbtk.c
--- generic/gdbtk.c	6 Apr 2009 23:33:32 -0000	1.50
+++ generic/gdbtk.c	18 Jun 2010 22:13:13 -0000
@@ -709,15 +709,15 @@ _initialize_gdbtk ()
 	  break;
 	default:
 	  AllocConsole ();
-	  cygwin32_attach_handle_to_fd ("/dev/conin", 0,
-					GetStdHandle (STD_INPUT_HANDLE),
-					1, GENERIC_READ);
-	  cygwin32_attach_handle_to_fd ("/dev/conout", 1,
-					GetStdHandle (STD_OUTPUT_HANDLE),
-					0, GENERIC_WRITE);
-	  cygwin32_attach_handle_to_fd ("/dev/conout", 2,
-					GetStdHandle (STD_ERROR_HANDLE),
-					0, GENERIC_WRITE);
+	  cygwin_attach_handle_to_fd ("/dev/conin", 0,
+				      GetStdHandle (STD_INPUT_HANDLE),
+				      1, GENERIC_READ);
+	  cygwin_attach_handle_to_fd ("/dev/conout", 1,
+				      GetStdHandle (STD_OUTPUT_HANDLE),
+				      0, GENERIC_WRITE);
+	  cygwin_attach_handle_to_fd ("/dev/conout", 2,
+				      GetStdHandle (STD_ERROR_HANDLE),
+				      0, GENERIC_WRITE);
 	  break;
 	}
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.