Commit 9061634a authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Be more strict when detecting a string from an array.

parent 13a3340b
......@@ -519,24 +519,29 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level)
count = 1; size = 1;
types_get_info(&type, TI_GET_COUNT, &count);
types_get_info(&type, TI_GET_LENGTH, &size);
lvalue_field = *lvalue;
types_get_info(&lvalue_field.type, TI_GET_TYPE, &lvalue_field.type.id);
types_get_real_type(&lvalue_field.type, &tag);
if (size == count)
{
unsigned len;
char buffer[256];
/*
* Special handling for character arrays.
*/
/* FIXME should check basic type here (should be a char!!!!)... */
len = min(count, sizeof(buffer));
memory_get_string(dbg_curr_process,
memory_to_linear_addr(&lvalue->addr),
lvalue->cookie == DLV_TARGET, TRUE, buffer, len);
dbg_printf("\"%s%s\"", buffer, (len < count) ? "..." : "");
break;
if (size == count && tag == SymTagBaseType)
{
DWORD basetype;
types_get_info(&lvalue_field.type, TI_GET_BASETYPE, &basetype);
if (basetype == btChar)
{
char buffer[256];
/*
* Special handling for character arrays.
*/
unsigned len = min(count, sizeof(buffer));
memory_get_string(dbg_curr_process,
memory_to_linear_addr(&lvalue->addr),
lvalue->cookie == DLV_TARGET, TRUE, buffer, len);
dbg_printf("\"%s%s\"", buffer, (len < count) ? "..." : "");
break;
}
}
lvalue_field = *lvalue;
types_get_info(&type, TI_GET_TYPE, &lvalue_field.type.id);
dbg_printf("{");
for (i = 0; i < count; i++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment