wine debugger fix

Eric Pouech eric.pouech at wanadoo.fr
Tue Jan 15 16:01:59 CST 2002


this patch fixes the dumping of arrays of chars in a structure

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: wdbg
ChangeLog: fixes char array in structure dumping
GenDate: 2002/01/15 22:00:33 UTC
ModifiedFiles: debugger/types.c
AddedFiles: 
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/types.c,v
retrieving revision 1.26
diff -u -u -r1.26 types.c
--- debugger/types.c	21 Dec 2001 20:29:59 -0000	1.26
+++ debugger/types.c	15 Jan 2002 21:58:48 -0000
@@ -861,24 +861,41 @@
       size = DEBUG_GetObjectSize(value->type->un.array.basictype);
       if( size == 1 )
 	{
+          char  ach[16];
+          int   len, clen;
+
 	  /*
 	   * Special handling for character arrays.
 	   */
 	  pnt = (char *) value->addr.off;
-	  DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\"");
-	  for( i=value->type->un.array.start; i < value->type->un.array.end; i++ )
-	    {
-	      DEBUG_Output(DBG_CHN_MESG, pnt++, 1);
-	      DEBUG_nchar++;
-	      if( DEBUG_nchar > DEBUG_maxchar )
-		{
-		  DEBUG_Printf(DBG_CHN_MESG, "...\"");
-		  goto leave;
-		}
-	    }
-	  DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\"");
-	  break;
-	}
+          len = value->type->un.array.end - value->type->un.array.start + 1;
+          clen = (DEBUG_nchar + len < DEBUG_maxchar) 
+              ? len : (DEBUG_maxchar - DEBUG_nchar);
+
+          DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\"");
+          switch (value->cookie)
+          {
+          case DV_TARGET:
+              for (i = clen; i > 0; i -= sizeof(ach))
+              {
+                  DEBUG_READ_MEM(pnt, ach, min(sizeof(ach), i));
+                  DEBUG_Output(DBG_CHN_MESG, ach, min(sizeof(ach), i));
+              }
+              break;
+          case DV_HOST:
+              DEBUG_Output(DBG_CHN_MESG, pnt, clen);
+              break;
+          default: assert(0);
+          }
+          DEBUG_nchar += clen;
+          if (clen != len) 
+          {
+              DEBUG_Printf(DBG_CHN_MESG, "...\"");
+              goto leave;
+          }
+          DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\"");
+          break;
+        }
       val1 = *value;
       val1.type = value->type->un.array.basictype;
       DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "{");


More information about the wine-patches mailing list