Eric Pouech : winedbg: Be more strict when detecting a string from an array.
Alexandre Julliard
julliard at winehq.org
Wed Dec 1 15:23:50 CST 2021
Module: wine
Branch: master
Commit: 9061634a01d358dd6b071ebcca5a7567d604219e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9061634a01d358dd6b071ebcca5a7567d604219e
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Wed Dec 1 15:29:39 2021 +0100
winedbg: Be more strict when detecting a string from an array.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/winedbg/types.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c
index 5e9188ccc6e..0ee6ab05f0f 100644
--- a/programs/winedbg/types.c
+++ b/programs/winedbg/types.c
@@ -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++)
{
More information about the wine-cvs
mailing list