Fixes char array in structure dumping.

This commit is contained in:
Eric Pouech 2002-01-18 18:08:21 +00:00 committed by Alexandre Julliard
parent 964109dec4
commit 911d42427f
1 changed files with 31 additions and 14 deletions

View File

@ -861,21 +861,38 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
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;
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, "\"");
for( i=value->type->un.array.start; i < value->type->un.array.end; i++ )
switch (value->cookie)
{
DEBUG_Output(DBG_CHN_MESG, pnt++, 1);
DEBUG_nchar++;
if( DEBUG_nchar > DEBUG_maxchar )
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;
}