Commit acac3cce authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Added support for printing WCHAR in print_typed_basic.

parent b14e4e58
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "debugger.h" #include "debugger.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(winedbg); WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
...@@ -393,18 +394,23 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) ...@@ -393,18 +394,23 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
dbg_printf("%Lf", val_real); dbg_printf("%Lf", val_real);
break; break;
case btChar: case btChar:
case btWChar:
/* sometimes WCHAR is defined as btChar with size = 2, so discrimate
* Ansi/Unicode based on size, not on basetype
*/
if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return; if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
/* FIXME: should do the same for a Unicode character (size == 2) */
print_char: print_char:
if (size == 1 && (val_int < 0x20 || val_int > 0x80)) if (size == 1 && isprint((char)val_int))
dbg_printf("%d", (int)val_int); dbg_printf("'%c'", (char)val_int);
else if (size == 2) else if (size == 2 && isprintW((WCHAR)val_int))
{ {
WCHAR wch = (WCHAR)val_int; WCHAR wch = (WCHAR)val_int;
dbg_printf("'");
dbg_outputW(&wch, 1); dbg_outputW(&wch, 1);
dbg_printf("'");
} }
else else
dbg_printf("'%c'", (char)val_int); dbg_printf("%d", (int)val_int);
break; break;
case btBool: case btBool:
if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return; if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
......
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