[PATCH] Compliancy to windows 64bit

Roland Schwingel <[email protected]> Mon, 19 Mar 2012 13:08:14 +0100
Newsgroups gmane.comp.debugging.insight
Message-ID <[email protected]>
Hi...

On windows 64bit datatype long remains to be 32bit (as opposed to eg. 
linux/mac where it is extended to also be 64bit). This yields to some 
(easy to fix) problems for insight. The attached patch fixes this.

Changelog:

2012-03-19  Roland Schwingel <[email protected]>

         * generic/gdbtk-register.c (get_register_types): Cast result of
         TYPE_FIELD_TYPE to size_t instead of long.
         (gdb_regformat): on windows 64bit use strtoll instead of strtol.
         * generic/gdbtk-stack.c (gdb_get_vars_command): Don't cast
         clientData to long. Here checking of non NULL clientData is enough.

Any comments? Is this ok?

Roland
win64_gdbtk-register.c.patch (text/plain, 1.3 KB)
--- gdbtk_orig/generic/gdbtk-register.c	2012-01-03 13:26:56.000000000 +0100
+++ gdbtk/generic/gdbtk-register.c	2012-03-05 12:04:17.458812300 +0100
@@ -240,7 +240,7 @@
 	{
 	  Tcl_Obj *ar[3], *list;
 	  char *buff;
-	  buff = xstrprintf ("%lx", (long)TYPE_FIELD_TYPE (reg_vtype, i));
+	  buff = xstrprintf ("%lx", (size_t)TYPE_FIELD_TYPE (reg_vtype, i));
 	  ar[0] = Tcl_NewStringObj (TYPE_FIELD_NAME (reg_vtype, i), -1);
 	  ar[1] = Tcl_NewStringObj (buff, -1);
 	  if (TYPE_CODE (TYPE_FIELD_TYPE (reg_vtype, i)) == TYPE_CODE_FLT)
@@ -256,7 +256,7 @@
     {
       Tcl_Obj *ar[3], *list;
       char *buff;
-      buff = xstrprintf ("%lx", (long)reg_vtype);
+      buff = xstrprintf ("%lx", (size_t)reg_vtype);
       ar[0] = Tcl_NewStringObj (TYPE_NAME(reg_vtype), -1);
       ar[1] = Tcl_NewStringObj (buff, -1);
       if (TYPE_CODE (reg_vtype) == TYPE_CODE_FLT)
@@ -497,7 +497,11 @@
   if (Tcl_GetIntFromObj (interp, objv[0], &regno) != TCL_OK)
     return TCL_ERROR;
 
+  #ifdef _WIN64
+  type = (struct type *)strtoll (Tcl_GetStringFromObj (objv[1], NULL), NULL, 16);  
+  #else
   type = (struct type *)strtol (Tcl_GetStringFromObj (objv[1], NULL), NULL, 16);  
+  #endif
   fm = (int)*(Tcl_GetStringFromObj (objv[2], NULL));
 
   numregs = (gdbarch_num_regs (get_current_arch ())
win64_gdbtk-stack.c.patch (text/plain, 327 B)
--- gdbtk_orig/generic/gdbtk-stack.c	2012-03-05 09:19:01.000000000 +0100
+++ gdbtk/generic/gdbtk-stack.c	2012-03-14 11:56:31.851248200 +0100
@@ -289,7 +289,7 @@
       return TCL_ERROR;
     }
 
-  arguments = (long) clientData;
+  arguments = clientData!=NULL?1:0;
 
   /* Initialize the result pointer to an empty list. */