mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
- Print short ASCII strings without the "..."
- Make printing for Unicode strings more similar to ASCII.
This commit is contained in:
parent
ad302ff7dd
commit
387ca9ba89
@ -336,6 +336,8 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format )
|
||||
}
|
||||
}
|
||||
|
||||
#define CHARBUFSIZE 16
|
||||
|
||||
/******************************************************************
|
||||
* DEBUG_PrintStringA
|
||||
*
|
||||
@ -346,38 +348,43 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format )
|
||||
int DEBUG_PrintStringA(int chnl, const DBG_ADDR* address, int len)
|
||||
{
|
||||
char* lin = (void*)DEBUG_ToLinear(address);
|
||||
char ach[16+1];
|
||||
int i, l;
|
||||
char ch[CHARBUFSIZE+1];
|
||||
int written = 0;
|
||||
|
||||
if (len == -1) len = 32767; /* should be big enough */
|
||||
|
||||
for (i = len; i > 0; i -= l)
|
||||
while (written < len)
|
||||
{
|
||||
l = min(sizeof(ach) - 1, i);
|
||||
DEBUG_READ_MEM_VERBOSE(lin, ach, l);
|
||||
ach[l] = '\0'; /* protect from displaying junk */
|
||||
l = strlen(ach);
|
||||
DEBUG_OutputA(chnl, ach, l);
|
||||
if (l < sizeof(ach) - 1) break;
|
||||
lin += l;
|
||||
int to_write = min(CHARBUFSIZE, len - written );
|
||||
if (!DEBUG_READ_MEM_VERBOSE(lin, ch, to_write)) break;
|
||||
ch[to_write] = '\0'; /* protect from displaying junk */
|
||||
to_write = lstrlenA(ch);
|
||||
DEBUG_OutputA(chnl, ch, to_write);
|
||||
lin += to_write;
|
||||
written += to_write;
|
||||
if (to_write < CHARBUFSIZE) break;
|
||||
}
|
||||
return len - i; /* number of actually written chars */
|
||||
return written; /* number of actually written chars */
|
||||
}
|
||||
|
||||
int DEBUG_PrintStringW(int chnl, const DBG_ADDR* address, int len)
|
||||
{
|
||||
char* lin = (void*)DEBUG_ToLinear(address);
|
||||
WCHAR wch;
|
||||
int ret = 0;
|
||||
WCHAR ch[CHARBUFSIZE+1];
|
||||
int written = 0;
|
||||
|
||||
if (len == -1) len = 32767; /* should be big enough */
|
||||
while (len--)
|
||||
|
||||
while (written < len)
|
||||
{
|
||||
if (!DEBUG_READ_MEM_VERBOSE(lin, &wch, sizeof(wch)) || !wch)
|
||||
break;
|
||||
lin += sizeof(wch);
|
||||
DEBUG_OutputW(chnl, &wch, 1);
|
||||
ret++;
|
||||
int to_write = min(CHARBUFSIZE, len - written );
|
||||
if (!DEBUG_READ_MEM_VERBOSE(lin, ch, to_write * sizeof(WCHAR))) break;
|
||||
ch[to_write] = 0; /* protect from displaying junk */
|
||||
to_write = lstrlenW(ch);
|
||||
DEBUG_OutputW(chnl, ch, to_write);
|
||||
lin += to_write;
|
||||
written += to_write;
|
||||
if (to_write < CHARBUFSIZE) break;
|
||||
}
|
||||
return ret;
|
||||
return written; /* number of actually written chars */
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define NR_TYPE_HASH 521
|
||||
|
||||
int DEBUG_nchar;
|
||||
static int DEBUG_maxchar = 1024;
|
||||
static const int DEBUG_maxchar = 1024;
|
||||
|
||||
struct en_values
|
||||
{
|
||||
@ -890,20 +890,14 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
|
||||
switch (value->cookie)
|
||||
{
|
||||
case DV_TARGET:
|
||||
clen = DEBUG_PrintStringA(DBG_CHN_MESG, &value->addr, clen);
|
||||
DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &value->addr, clen);
|
||||
break;
|
||||
case DV_HOST:
|
||||
DEBUG_OutputA(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, "\"");
|
||||
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, (len > clen) ? "...\"" : "\"");
|
||||
break;
|
||||
}
|
||||
val1 = *value;
|
||||
@ -943,7 +937,6 @@ leave:
|
||||
{
|
||||
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void DEBUG_DumpAType(struct datatype* dt, BOOL deep)
|
||||
|
Loading…
Reference in New Issue
Block a user