winedbg: Get rid of dbg_W2A helper.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-18 17:25:36 +01:00 committed by Alexandre Julliard
parent fd886c726d
commit 9fa624583e
6 changed files with 10 additions and 34 deletions

View File

@ -501,7 +501,6 @@ extern BOOL types_is_integral_type(const struct dbg_lvalue*);
extern BOOL types_is_float_type(const struct dbg_lvalue*);
/* winedbg.c */
extern const char* dbg_W2A(const WCHAR* buffer, unsigned len);
#ifdef __GNUC__
extern int WINAPIV dbg_printf(const char* format, ...) __attribute__((format (printf,1,2)));
#else

View File

@ -538,9 +538,9 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx, BOOL stop_on_dll_load
QueryFullProcessImageNameW( gdbctx->process->handle, 0, u.buffer, &size );
dbg_set_process_name(gdbctx->process, u.buffer);
fprintf(stderr, "%04lx:%04lx: create process '%s'/%p @%p (%lu<%lu>)\n",
fprintf(stderr, "%04lx:%04lx: create process '%ls'/%p @%p (%lu<%lu>)\n",
de->dwProcessId, de->dwThreadId,
dbg_W2A(u.buffer, -1),
u.buffer,
de->u.CreateProcessInfo.lpImageName,
de->u.CreateProcessInfo.lpStartAddress,
de->u.CreateProcessInfo.dwDebugInfoFileOffset,
@ -564,9 +564,9 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx, BOOL stop_on_dll_load
case LOAD_DLL_DEBUG_EVENT:
fetch_module_name( de->u.LoadDll.lpImageName, de->u.LoadDll.lpBaseOfDll,
u.buffer, ARRAY_SIZE(u.buffer) );
fprintf(stderr, "%04lx:%04lx: loads DLL %s @%p (%lu<%lu>)\n",
fprintf(stderr, "%04lx:%04lx: loads DLL %ls @%p (%lu<%lu>)\n",
de->dwProcessId, de->dwThreadId,
dbg_W2A(u.buffer, -1),
u.buffer,
de->u.LoadDll.lpBaseOfDll,
de->u.LoadDll.dwDebugInfoFileOffset,
de->u.LoadDll.nDebugInfoSize);

View File

@ -407,9 +407,8 @@ static void backtrace_all(void)
dbg_active_wait_for_first_exception();
}
dbg_printf("\nBacktracing for thread %04lx in process %04lx (%s):\n",
entry.th32ThreadID, dbg_curr_pid,
dbg_W2A(dbg_curr_process->imageName, -1));
dbg_printf("\nBacktracing for thread %04lx in process %04lx (%ls):\n",
entry.th32ThreadID, dbg_curr_pid, dbg_curr_process->imageName);
backtrace_tid(dbg_curr_process, entry.th32ThreadID);
}
while (Thread32Next(snapshot, &entry));

View File

@ -484,8 +484,8 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
break_set_xpoints(TRUE);
if (DBG_IVAR(BreakOnDllLoad))
{
dbg_printf("Stopping on DLL %s loading at %p\n",
dbg_W2A(u.buffer, -1), de->u.LoadDll.lpBaseOfDll);
dbg_printf("Stopping on DLL %ls loading at %p\n",
u.buffer, de->u.LoadDll.lpBaseOfDll);
if (dbg_fetch_context()) cont = 0;
}
break;

View File

@ -307,8 +307,8 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
str = "???";
break;
}
dbg_printf(" %s was running on #%d %s CPU%s",
dbg_W2A(exec_name, -1), msi->u.s.NumberOfProcessors, str,
dbg_printf(" %ls was running on #%d %s CPU%s",
exec_name, msi->u.s.NumberOfProcessors, str,
msi->u.s.NumberOfProcessors < 2 ? "" : "s");
switch (msi->MajorVersion)
{

View File

@ -113,28 +113,6 @@ static void dbg_outputA(const char* buffer, int len)
}
}
const char* dbg_W2A(const WCHAR* buffer, unsigned len)
{
static unsigned ansilen;
static char* ansi;
unsigned newlen;
newlen = WideCharToMultiByte(CP_ACP, 0, buffer, len, NULL, 0, NULL, NULL);
if (newlen > ansilen)
{
static char* newansi;
if (ansi)
newansi = HeapReAlloc(GetProcessHeap(), 0, ansi, newlen);
else
newansi = HeapAlloc(GetProcessHeap(), 0, newlen);
if (!newansi) return NULL;
ansilen = newlen;
ansi = newansi;
}
WideCharToMultiByte(CP_ACP, 0, buffer, len, ansi, newlen, NULL, NULL);
return ansi;
}
int WINAPIV dbg_printf(const char* format, ...)
{
static char buf[4*1024];