Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/crashdlg.c | 21 +++++++-------------- programs/winedbg/tgt_active.c | 10 +++------- programs/winedbg/tgt_minidump.c | 4 ++-- programs/winedbg/types.c | 30 ++++++++++-------------------- programs/winedbg/winedbg.c | 3 +-- 5 files changed, 23 insertions(+), 45 deletions(-)
diff --git a/programs/winedbg/crashdlg.c b/programs/winedbg/crashdlg.c index 1d32749c1a8..7d2c99f513a 100644 --- a/programs/winedbg/crashdlg.c +++ b/programs/winedbg/crashdlg.c @@ -158,21 +158,17 @@ static void save_crash_log( HWND hwnd ) HANDLE handle; DWORD err, written; WCHAR *p, path[MAX_PATH], buffer[1024]; - static const WCHAR default_name[] = { 'b','a','c','k','t','r','a','c','e','.','t','x','t',0 }; - static const WCHAR default_ext[] = { 't','x','t',0 }; - static const WCHAR txt_files[] = { '*','.','t','x','t',0 }; - static const WCHAR all_files[] = { '*','.','*',0 };
memset( &save, 0, sizeof(save) ); - lstrcpyW( path, default_name ); + lstrcpyW( path, L"backtrace.txt" );
LoadStringW( GetModuleHandleW(0), IDS_TEXT_FILES, buffer, ARRAY_SIZE(buffer)); p = buffer + lstrlenW(buffer) + 1; - lstrcpyW(p, txt_files); + lstrcpyW(p, L"*.txt"); p += lstrlenW(p) + 1; LoadStringW( GetModuleHandleW(0), IDS_ALL_FILES, p, ARRAY_SIZE(buffer) - (p - buffer) ); p += lstrlenW(p) + 1; - lstrcpyW(p, all_files); + lstrcpyW(p, L"*.*"); p += lstrlenW(p) + 1; *p = '\0';
@@ -184,7 +180,7 @@ static void save_crash_log( HWND hwnd ) save.nMaxFile = MAX_PATH; save.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING; - save.lpstrDefExt = default_ext; + save.lpstrDefExt = L"txt";
if (!GetSaveFileNameW( &save )) return; handle = CreateFileW( save.lpstrFile, GENERIC_WRITE, FILE_SHARE_READ, @@ -214,7 +210,6 @@ static void save_crash_log( HWND hwnd )
static INT_PTR WINAPI crash_dlg_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - static const WCHAR openW[] = {'o','p','e','n',0}; switch (msg) { case WM_INITDIALOG: @@ -250,7 +245,7 @@ static INT_PTR WINAPI crash_dlg_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case NM_CLICK: case NM_RETURN: if (wParam == IDC_STATIC_TXT2) - ShellExecuteW( NULL, openW, ((NMLINK *)lParam)->item.szUrl, NULL, NULL, SW_SHOW ); + ShellExecuteW( NULL, L"open", ((NMLINK *)lParam)->item.szUrl, NULL, NULL, SW_SHOW ); break; } break; @@ -272,7 +267,6 @@ static INT_PTR WINAPI crash_dlg_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
static INT_PTR WINAPI details_dlg_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - static const WCHAR openW[] = {'o','p','e','n',0}; static POINT orig_size, min_size, edit_size, text_pos, save_pos, close_pos;
switch (msg) @@ -345,7 +339,7 @@ static INT_PTR WINAPI details_dlg_proc( HWND hwnd, UINT msg, WPARAM wparam, LPAR case NM_CLICK: case NM_RETURN: if (wparam == IDC_STATIC_TXT2) - ShellExecuteW( NULL, openW, ((NMLINK *)lparam)->item.szUrl, NULL, NULL, SW_SHOW ); + ShellExecuteW( NULL, L"open", ((NMLINK *)lparam)->item.szUrl, NULL, NULL, SW_SHOW ); break; } break; @@ -368,7 +362,6 @@ static INT_PTR WINAPI details_dlg_proc( HWND hwnd, UINT msg, WPARAM wparam, LPAR
int display_crash_dialog(void) { - static const WCHAR winedeviceW[] = {'w','i','n','e','d','e','v','i','c','e','.','e','x','e',0}; static const INITCOMMONCONTROLSEX init = { sizeof(init), ICC_LINK_CLASS };
/* dbg_curr_process->handle is not set */ @@ -380,7 +373,7 @@ int display_crash_dialog(void) hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dbg_curr_pid); g_ProgramName = get_program_name(hProcess); CloseHandle(hProcess); - if (!wcscmp( g_ProgramName, winedeviceW )) return TRUE; + if (!wcscmp( g_ProgramName, L"winedevice.exe" )) return TRUE; InitCommonControlsEx( &init ); return DialogBoxW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDD_CRASH_DLG), NULL, crash_dlg_proc); } diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 3372a001dfb..66156833fc6 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -294,8 +294,6 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bufsz) { - static const WCHAR dlladdr[] = {'D','L','L','_','%','0','8','l','x',0}; - memory_get_string_indirect(dbg_curr_process, name_addr, TRUE, buffer, bufsz); if (!buffer[0] && !GetModuleFileNameExW(dbg_curr_process->handle, mod_addr, buffer, bufsz)) { @@ -308,7 +306,7 @@ void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bu memmove( buffer, buffer + 4, (lstrlenW(buffer + 4) + 1) * sizeof(WCHAR) ); } else - swprintf(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr); + swprintf(buffer, bufsz, L"DLL_%08lx", (ULONG_PTR)mod_addr); } }
@@ -371,8 +369,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) size = ARRAY_SIZE(u.buffer); if (!QueryFullProcessImageNameW( dbg_curr_process->handle, 0, u.buffer, &size )) { - static const WCHAR pcspid[] = {'P','r','o','c','e','s','s','_','%','0','8','x',0}; - swprintf( u.buffer, ARRAY_SIZE(u.buffer), pcspid, dbg_curr_pid); + swprintf( u.buffer, ARRAY_SIZE(u.buffer), L"Process_%08x", dbg_curr_pid); }
WINE_TRACE("%04x:%04x: create process '%s'/%p @%p (%u<%u>)\n", @@ -669,10 +666,9 @@ static BOOL str2int(const char* str, DWORD_PTR* val)
static HANDLE create_temp_file(void) { - static const WCHAR prefixW[] = {'w','d','b',0}; WCHAR path[MAX_PATH], name[MAX_PATH];
- if (!GetTempPathW( MAX_PATH, path ) || !GetTempFileNameW( path, prefixW, 0, name )) + if (!GetTempPathW( MAX_PATH, path ) || !GetTempFileNameW( path, L"wdb", 0, name )) return INVALID_HANDLE_VALUE; return CreateFileW( name, GENERIC_READ|GENERIC_WRITE|DELETE, FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, 0 ); diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c index ab695371f17..368870bde42 100644 --- a/programs/winedbg/tgt_minidump.c +++ b/programs/winedbg/tgt_minidump.c @@ -204,7 +204,6 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) WCHAR exec_name[1024]; WCHAR nameW[1024]; unsigned len; - static const WCHAR default_exec_name[] = {'<','m','i','n','i','d','u','m','p','-','e','x','e','c','>',0};
/* fetch PID */ if (MiniDumpReadDumpStream(data->mapping, MiscInfoStream, NULL, &stream, NULL)) @@ -215,7 +214,8 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) }
/* fetch executable name (it's normally the first one in module list) */ - lstrcpyW(exec_name, default_exec_name); + lstrcpyW(exec_name, L"<minidump-exec>"); + if (MiniDumpReadDumpStream(data->mapping, ModuleListStream, NULL, &stream, NULL)) { mml = stream; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 5751ce095cc..236373858d5 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -755,30 +755,20 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v tag == SymTagBaseType && SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_BASETYPE, &bt)) { - static const WCHAR voidW[] = {'v','o','i','d','\0'}; - static const WCHAR charW[] = {'c','h','a','r','\0'}; - static const WCHAR wcharW[] = {'W','C','H','A','R','\0'}; - static const WCHAR intW[] = {'i','n','t','\0'}; - static const WCHAR uintW[] = {'u','n','s','i','g','n','e','d',' ','i','n','t','\0'}; - static const WCHAR floatW[] = {'f','l','o','a','t','\0'}; - static const WCHAR boolW[] = {'b','o','o','l','\0'}; - static const WCHAR longW[] = {'l','o','n','g',' ','i','n','t','\0'}; - static const WCHAR ulongW[] = {'u','n','s','i','g','n','e','d',' ','l','o','n','g',' ','i','n','t','\0'}; - static const WCHAR complexW[] = {'c','o','m','p','l','e','x','\0'}; const WCHAR* name = NULL;
switch (bt) { - case btVoid: name = voidW; break; - case btChar: name = charW; break; - case btWChar: name = wcharW; break; - case btInt: name = intW; break; - case btUInt: name = uintW; break; - case btFloat: name = floatW; break; - case btBool: name = boolW; break; - case btLong: name = longW; break; - case btULong: name = ulongW; break; - case btComplex: name = complexW; break; + case btVoid: name = L"void"; break; + case btChar: name = L"char"; break; + case btWChar: name = L"WCHAR"; break; + case btInt: name = L"int"; break; + case btUInt: name = L"unsigned int"; break; + case btFloat: name = L"float"; break; + case btBool: name = L"bool"; break; + case btLong: name = L"long int"; break; + case btULong: name = L"unsigned long int"; break; + case btComplex: name = L"complex"; break; default: WINE_FIXME("Unsupported basic type %u\n", bt); return FALSE; } X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(WCHAR)); diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 66ff5cc7c23..76ecea3f3ee 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -596,7 +596,6 @@ static void restart_if_wow64(void)
if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64) { - static const WCHAR winedbgW[] = {'\','w','i','n','e','d','b','g','.','e','x','e',0}; STARTUPINFOW si; PROCESS_INFORMATION pi; WCHAR filename[MAX_PATH]; @@ -606,7 +605,7 @@ static void restart_if_wow64(void) memset( &si, 0, sizeof(si) ); si.cb = sizeof(si); GetSystemDirectoryW( filename, MAX_PATH ); - lstrcatW( filename, winedbgW ); + lstrcatW( filename, L"\winedbg.exe" );
Wow64DisableWow64FsRedirection( &redir ); if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/break.c | 2 +- programs/winedbg/expr.c | 4 ++-- programs/winedbg/gdbproxy.c | 8 ++++---- programs/winedbg/info.c | 14 +++++++------- programs/winedbg/memory.c | 4 ++-- programs/winedbg/stack.c | 2 +- programs/winedbg/symbol.c | 8 ++++---- programs/winedbg/tgt_active.c | 4 ++-- programs/winedbg/types.c | 2 +- programs/winedbg/winedbg.c | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index e5458c34bf9..03f7bdf5a2f 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -319,7 +319,7 @@ void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp) il.SizeOfStruct = sizeof(il); if (!SymGetLineFromAddr64(dbg_curr_process->handle, linear, &disp, &il)) { - dbg_printf("Unable to add breakpoint (unknown address %lx)\n", linear); + dbg_printf("Unable to add breakpoint (unknown address %Ix)\n", linear); return; } filename = il.FileName; diff --git a/programs/winedbg/expr.c b/programs/winedbg/expr.c index 4c791e19012..842fa8e7925 100644 --- a/programs/winedbg/expr.c +++ b/programs/winedbg/expr.c @@ -687,10 +687,10 @@ BOOL expr_print(const struct expr* exp) dbg_printf("$%s", exp->un.intvar.name); break; case EXPR_TYPE_U_CONST: - dbg_printf("%lu", exp->un.u_const.value); + dbg_printf("%Iu", exp->un.u_const.value); break; case EXPR_TYPE_S_CONST: - dbg_printf("%ld", exp->un.s_const.value); + dbg_printf("%Id", exp->un.s_const.value); break; case EXPR_TYPE_STRING: dbg_printf(""%s"", exp->un.string.str); diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 37d7c8ffc66..b578ac289e1 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -1486,7 +1486,7 @@ static void packet_query_monitor_wnd_helper(struct gdb_context* gdbctx, HWND hWn packet_reply_open(gdbctx); packet_reply_add(gdbctx, "O"); snprintf(buffer, sizeof(buffer), - "%*s%04lx%*s%-17.17s %08x %0*lx %.14s\n", + "%*s%04Ix%*s%-17.17s %08x %0*Ix %.14s\n", indent, "", (ULONG_PTR)hWnd, 13 - indent, "", clsName, GetWindowLongW(hWnd, GWL_STYLE), addr_width(gdbctx), (ULONG_PTR)GetWindowLongPtrW(hWnd, GWLP_WNDPROC), @@ -1613,7 +1613,7 @@ static void packet_query_monitor_mem(struct gdb_context* gdbctx, int len, const prot[0] = '\0'; } packet_reply_open(gdbctx); - snprintf(buffer, sizeof(buffer), "%0*lx %0*lx %s %s %s\n", + snprintf(buffer, sizeof(buffer), "%0*Ix %0*Ix %s %s %s\n", addr_width(gdbctx), (DWORD_PTR)addr, addr_width(gdbctx), mbi.RegionSize, state, type, prot); packet_reply_add(gdbctx, "O"); @@ -2042,7 +2042,7 @@ static enum packet_return packet_query(struct gdb_context* gdbctx) char buf[64];
snprintf(buf, sizeof(buf), - "Text=%08lx;Data=%08lx;Bss=%08lx", + "Text=%08Ix;Data=%08Ix;Bss=%08Ix", gdbctx->wine_segs[0], gdbctx->wine_segs[1], gdbctx->wine_segs[2]); return packet_reply(gdbctx, buf); @@ -2439,7 +2439,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, unsigned flags, unsigned por if (gdbctx->sock != INVALID_SOCKET) { ret = TRUE; - TRACE("connected on %lu\n", gdbctx->sock); + TRACE("connected on %Iu\n", gdbctx->sock); /* don't keep our small packets too long: send them ASAP back to GDB * without this, GDB really crawls */ diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index b7f45086c5c..23d87bbb006 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -392,7 +392,7 @@ static void info_window(HWND hWnd, int indent) if (!GetWindowTextA(hWnd, wndName, sizeof(wndName))) strcpy(wndName, "-- Empty --");
- dbg_printf("%*s%08lx%*s %-17.17s %08x %0*lx %08x %.14s\n", + dbg_printf("%*s%08Ix%*s %-17.17s %08x %0*Ix %08x %.14s\n", indent, "", (DWORD_PTR)hWnd, 12 - indent, "", clsName, GetWindowLongW(hWnd, GWL_STYLE), ADDRWIDTH, (ULONG_PTR)GetWindowLongPtrW(hWnd, GWLP_WNDPROC), @@ -434,7 +434,7 @@ void info_win32_window(HWND hWnd, BOOL detailed)
/* FIXME missing fields: hmemTaskQ, hrgnUpdate, dce, flags, pProp, scroll */ dbg_printf("next=%p child=%p parent=%p owner=%p class='%s'\n" - "inst=%p active=%p idmenu=%08lx\n" + "inst=%p active=%p idmenu=%08Ix\n" "style=0x%08x exstyle=0x%08x wndproc=%p text='%s'\n" "client=%d,%d-%d,%d window=%d,%d-%d,%d sysmenu=%p\n", GetWindow(hWnd, GW_HWNDNEXT), @@ -791,7 +791,7 @@ void info_win32_virtual(DWORD pid) type = ""; prot[0] = '\0'; } - dbg_printf("%0*lx %0*lx %s %s %s\n", + dbg_printf("%0*Ix %0*Ix %s %s %s\n", ADDRWIDTH, (DWORD_PTR)addr, ADDRWIDTH, (DWORD_PTR)addr + mbi.RegionSize - 1, state, type, prot); if (addr + mbi.RegionSize < addr) /* wrap around ? */ break; @@ -893,7 +893,7 @@ void info_win32_exception(void) break; case EXCEPTION_ACCESS_VIOLATION: if (rec->NumberParameters == 2) - dbg_printf("page fault on %s access to 0x%0*lx", + dbg_printf("page fault on %s access to 0x%0*Ix", rec->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT ? "write" : rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT ? "execute" : "read", ADDRWIDTH, rec->ExceptionInformation[1]); @@ -931,7 +931,7 @@ void info_win32_exception(void) (void*)rec->ExceptionInformation[1], TRUE, FALSE, name, sizeof(name)); else - sprintf( name, "%ld", rec->ExceptionInformation[1] ); + sprintf( name, "%Id", rec->ExceptionInformation[1] ); dbg_printf("unimplemented function %s.%s called", dll, name); } break; @@ -961,14 +961,14 @@ void info_win32_exception(void) break; case EXCEPTION_WINE_CXX_EXCEPTION: if(rec->NumberParameters == 3 && rec->ExceptionInformation[0] == EXCEPTION_WINE_CXX_FRAME_MAGIC) - dbg_printf("C++ exception(object = 0x%0*lx, type = 0x%0*lx)", + dbg_printf("C++ exception(object = 0x%0*Ix, type = 0x%0*Ix)", ADDRWIDTH, rec->ExceptionInformation[1], ADDRWIDTH, rec->ExceptionInformation[2]); else if(rec->NumberParameters == 4 && rec->ExceptionInformation[0] == EXCEPTION_WINE_CXX_FRAME_MAGIC) dbg_printf("C++ exception(object = %p, type = %p, base = %p)", (void*)rec->ExceptionInformation[1], (void*)rec->ExceptionInformation[2], (void*)rec->ExceptionInformation[3]); else - dbg_printf("C++ exception with strange parameter count %d or magic 0x%0*lx", + dbg_printf("C++ exception with strange parameter count %d or magic 0x%0*Ix", rec->NumberParameters, ADDRWIDTH, rec->ExceptionInformation[0]); break; default: diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 6cd90b236eb..2490b7cf7e2 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -219,11 +219,11 @@ void memory_examine(const struct dbg_lvalue *lvalue, int count, char format) case 'a': if (sizeof(DWORD_PTR) == 4) { - DO_DUMP(DWORD_PTR, 4, " %8.8lx"); + DO_DUMP(DWORD_PTR, 4, " %8.8Ix"); } else { - DO_DUMP(DWORD_PTR, 2, " %16.16lx"); + DO_DUMP(DWORD_PTR, 2, " %16.16Ix"); } break; case 'c': DO_DUMP2(char, 32, " %c", (_v < 0x20) ? ' ' : _v); break; diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index 4d2389ee345..34ca6c985be 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -409,7 +409,7 @@ static void backtrace_all(void) dbg_active_wait_for_first_exception(); }
- dbg_printf("\nBacktracing for thread %04x in process %04lx (%s):\n", + dbg_printf("\nBacktracing for thread %04x in process %04Ix (%s):\n", entry.th32ThreadID, dbg_curr_pid, dbg_W2A(dbg_curr_process->imageName, -1)); backtrace_tid(dbg_curr_process, entry.th32ThreadID); diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c index 67be370cc5b..856cc86c8f4 100644 --- a/programs/winedbg/symbol.c +++ b/programs/winedbg/symbol.c @@ -87,10 +87,10 @@ static BOOL fill_sym_lvalue(const SYMBOL_INFO* sym, ULONG_PTR base, buffer += l; lvalue->cookie = DLV_TARGET; lvalue->addr.Offset = (ULONG64)*pval + sym->Address; - if ((LONG_PTR)sym->Address >= 0) - snprintf(buffer, sz, "+%ld]", (ULONG_PTR)sym->Address); + if ((LONG64)sym->Address >= 0) + snprintf(buffer, sz, "+%I64d]", sym->Address); else - snprintf(buffer, sz, "-%ld]", -(LONG_PTR)sym->Address); + snprintf(buffer, sz, "-%I64d]", -(LONG64)sym->Address); } else if (sym->Flags & SYMFLAG_VALUEPRESENT) { @@ -779,7 +779,7 @@ static BOOL CALLBACK symbols_info_cb(PSYMBOL_INFO sym, ULONG size, PVOID ctx) mi.ModuleName[len - 5] = '\0'; }
- dbg_printf("%0*lx: %s!%s", ADDRWIDTH, (ULONG_PTR)sym->Address, mi.ModuleName, sym->Name); + dbg_printf("%0*I64x: %s!%s", ADDRWIDTH, sym->Address, mi.ModuleName, sym->Name); type.id = sym->TypeIndex; type.module = sym->ModBase;
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 66156833fc6..2fd05df39d9 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -536,12 +536,12 @@ static void dbg_resume_debuggee(DWORD cont) if (dbg_curr_thread) { if (!dbg_curr_process->be_cpu->set_context(dbg_curr_thread->handle, &dbg_context)) - dbg_printf("Cannot set ctx on %04lx\n", dbg_curr_tid); + dbg_printf("Cannot set ctx on %04Ix\n", dbg_curr_tid); } } dbg_interactiveP = FALSE; if (!ContinueDebugEvent(dbg_curr_pid, dbg_curr_tid, cont)) - dbg_printf("Cannot continue on %04lx (%08x)\n", dbg_curr_tid, cont); + dbg_printf("Cannot continue on %04Ix (%08x)\n", dbg_curr_tid, cont); }
static void wait_exception(void) diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 236373858d5..c091420ed50 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -571,7 +571,7 @@ static BOOL CALLBACK print_types_cb(PSYMBOL_INFO sym, ULONG size, void* ctx) struct dbg_type type; type.module = sym->ModBase; type.id = sym->TypeIndex; - dbg_printf("Mod: %0*lx ID: %08x\n", ADDRWIDTH, type.module, type.id); + dbg_printf("Mod: %0*Ix ID: %08x\n", ADDRWIDTH, type.module, type.id); types_print_type(&type, TRUE); dbg_printf("\n"); return TRUE; diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 76ecea3f3ee..45a7edfb309 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -571,7 +571,7 @@ void dbg_start_interactive(HANDLE hFile)
if (dbg_curr_process) { - dbg_printf("WineDbg starting on pid %04lx\n", dbg_curr_pid); + dbg_printf("WineDbg starting on pid %04Ix\n", dbg_curr_pid); if (dbg_curr_process->active_debuggee) dbg_active_wait_for_first_exception(); }
No longer print the form 'func+disp' when the address is after the end of said function. Print instead 'module+disp'
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/memory.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 2490b7cf7e2..4128606c9a9 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -583,28 +583,42 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line) { char buffer[sizeof(SYMBOL_INFO) + 256]; SYMBOL_INFO* si = (SYMBOL_INFO*)buffer; - void* lin = memory_to_linear_addr(addr); + DWORD_PTR lin = (DWORD_PTR)memory_to_linear_addr(addr); DWORD64 disp64; DWORD disp; + IMAGEHLP_MODULE im;
print_bare_address(addr);
si->SizeOfStruct = sizeof(*si); si->MaxNameLen = 256; - if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp64, si)) return; - dbg_printf(" %s", si->Name); - if (disp64) dbg_printf("+0x%I64x", disp64); + im.SizeOfStruct = 0; + if (SymFromAddr(dbg_curr_process->handle, lin, &disp64, si) && disp64 < si->Size) + { + dbg_printf(" %s", si->Name); + if (disp64) dbg_printf("+0x%I64x", disp64); + } + else + { + im.SizeOfStruct = sizeof(im); + if (!SymGetModuleInfo(dbg_curr_process->handle, lin, &im)) return; + dbg_printf(" %s", im.ModuleName); + if (lin > im.BaseOfImage) + dbg_printf("+0x%Ix", lin - im.BaseOfImage); + } if (with_line) { IMAGEHLP_LINE64 il; - IMAGEHLP_MODULE im;
il.SizeOfStruct = sizeof(il); - if (SymGetLineFromAddr64(dbg_curr_process->handle, (DWORD_PTR)lin, &disp, &il)) + if (SymGetLineFromAddr64(dbg_curr_process->handle, lin, &disp, &il)) dbg_printf(" [%s:%u]", il.FileName, il.LineNumber); - im.SizeOfStruct = sizeof(im); - if (SymGetModuleInfo(dbg_curr_process->handle, (DWORD_PTR)lin, &im)) - dbg_printf(" in %s", im.ModuleName); + if (im.SizeOfStruct == 0) /* don't display again module if address is in module+disp form */ + { + im.SizeOfStruct = sizeof(im); + if (SymGetModuleInfo(dbg_curr_process->handle, lin, &im)) + dbg_printf(" in %s", im.ModuleName); + } } }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/break.c | 7 +++---- programs/winedbg/gdbproxy.c | 2 +- programs/winedbg/info.c | 6 +++--- programs/winedbg/types.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 03f7bdf5a2f..d22dd7ac074 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -402,8 +402,7 @@ static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write) { case 4: case 2: case 1: break; default: - dbg_printf("Unsupported length (%s) for watch-points, defaulting to 4\n", - wine_dbgstr_longlong(l)); + dbg_printf("Unsupported length (%I64x) for watch-points, defaulting to 4\n", l); break; } } @@ -752,8 +751,8 @@ BOOL break_should_continue(ADDRESS64* addr, DWORD code) case be_xpoint_watch_write: dbg_printf("Stopped on watchpoint %d at ", dbg_curr_thread->stopped_xpoint); print_address(addr, TRUE); - dbg_printf(" new value %s\n", - wine_dbgstr_longlong(dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval)); + dbg_printf(" new value %I64x\n", + dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval); } return FALSE; } diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index b578ac289e1..0fb27023957 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -1420,7 +1420,7 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx) return packet_error; }
- TRACE("%Iu => %s\n", reg, wine_dbgstr_longlong(cpu_register(gdbctx, &ctx, reg))); + TRACE("%Iu => %I64x\n", reg, cpu_register(gdbctx, &ctx, reg));
packet_reply_open(gdbctx); packet_reply_register_hex_to(gdbctx, &ctx, reg); diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index 23d87bbb006..07b2a5acc8b 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -168,9 +168,9 @@ struct info_modules
static void module_print_info(const struct info_module *module, BOOL is_embedded) { - dbg_printf("%*.*s-%*.*s\t%-16s%s\n", - ADDRWIDTH, ADDRWIDTH, wine_dbgstr_longlong(module->mi.BaseOfImage), - ADDRWIDTH, ADDRWIDTH, wine_dbgstr_longlong(module->mi.BaseOfImage + module->mi.ImageSize), + dbg_printf("%*.*I64x-%*.*I64x\t%-16s%s\n", + ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage, + ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage + module->mi.ImageSize, is_embedded ? "\" : get_symtype_str(&module->mi), module->name); }
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index c091420ed50..9d98a136428 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -83,7 +83,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, } if (size > sizeof(rtn)) { - WINE_ERR("Size too large (%s)\n", wine_dbgstr_longlong(size)); + WINE_ERR("Size too large (%I64x)\n", size); RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL); return rtn; }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/memory.c | 6 +++--- programs/winedbg/symbol.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 4128606c9a9..9000d0126c7 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -466,10 +466,10 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) sub_type.id = fcp->ChildId[i]; if (!types_get_info(&sub_type, TI_GET_VALUE, &variant)) continue; - switch (variant.n1.n2.vt) + switch (V_VT(&variant)) { - case VT_I4: ok = (val_int == variant.n1.n2.n3.lVal); break; - default: WINE_FIXME("Unsupported variant type (%u)\n", variant.n1.n2.vt); + case VT_I4: ok = (val_int == V_I4(&variant)); break; + default: WINE_FIXME("Unsupported variant type (%u)\n", V_VT(&variant)); } if (ok) { diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c index 856cc86c8f4..a3b9cb38995 100644 --- a/programs/winedbg/symbol.c +++ b/programs/winedbg/symbol.c @@ -105,7 +105,7 @@ static BOOL fill_sym_lvalue(const SYMBOL_INFO* sym, ULONG_PTR base, if (buffer) snprintf(buffer, sz, "Couldn't get full value information for %s", sym->Name); return FALSE; } - else if (v.n1.n2.vt & VT_BYREF) + else if (V_ISBYREF(&v)) { /* FIXME: this won't work for pointers or arrays, as we don't always * know, if the value to be dereferenced lies in debuggee or
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/memory.c | 10 +++++----- programs/winedbg/types.c | 4 ++-- programs/winedbg/winedbg.c | 1 - 3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 9000d0126c7..b736d06a67e 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -439,11 +439,8 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) { BOOL ok = FALSE;
- /* FIXME: it depends on underlying type for enums - * (not supported yet in dbghelp) - * Assuming 4 as for an int - */ - if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, 4, TRUE, &val_int)) return; + if (!types_get_info(&type, TI_GET_LENGTH, &size64) || + !dbg_curr_process->be_cpu->fetch_integer(lvalue, size64, TRUE, &val_int)) return;
if (types_get_info(&type, TI_GET_CHILDRENCOUNT, &count)) { @@ -468,7 +465,10 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) continue; switch (V_VT(&variant)) { + case VT_I1: ok = (val_int == V_I1(&variant)); break; + case VT_I2: ok = (val_int == V_I2(&variant)); break; case VT_I4: ok = (val_int == V_I4(&variant)); break; + case VT_I8: ok = (val_int == V_I8(&variant)); break; default: WINE_FIXME("Unsupported variant type (%u)\n", V_VT(&variant)); } if (ok) diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 9d98a136428..354c97e5d70 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -114,8 +114,8 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); break; case SymTagEnum: - /* FIXME: we don't handle enum size */ - if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn)) + if (!types_get_info(&type, TI_GET_LENGTH, &size) || + !dbg_curr_process->be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn)) RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); break; case SymTagFunctionType: diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 45a7edfb309..0d4a38b2d83 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -44,7 +44,6 @@ * - type management: * + some bits of internal types are missing (like type casts and the address * operator) - * + the type for an enum's value is always inferred as int (winedbg & dbghelp) * + most of the code implies that sizeof(void*) = sizeof(int) * + all computations should be made on long long * o expr computations are in int:s
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/types.c | 3 ++- programs/winedbg/winedbg.c | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 354c97e5d70..5e9188ccc6e 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -105,7 +105,8 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, if (issigned) *issigned = s; break; case SymTagPointerType: - if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(void*), s = FALSE, &rtn)) + if (!types_get_info(&type, TI_GET_LENGTH, &size) || + !dbg_curr_process->be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn)) RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); break; case SymTagArrayType: diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 0d4a38b2d83..55801536a79 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -44,7 +44,6 @@ * - type management: * + some bits of internal types are missing (like type casts and the address * operator) - * + most of the code implies that sizeof(void*) = sizeof(int) * + all computations should be made on long long * o expr computations are in int:s * o bitfield size is on a 4-bytes
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/be_arm.c | 3 ++- programs/winedbg/be_arm64.c | 3 ++- programs/winedbg/be_i386.c | 3 ++- programs/winedbg/be_x86_64.c | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index fa25ce8dd2b..3bf5771439c 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -1834,7 +1834,8 @@ static int be_arm_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way) static BOOL be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG* ret) { - if (size != 1 && size != 2 && size != 4 && size != 8) return FALSE; + /* size must fit in ret and be a power of two */ + if (size > sizeof(*ret) || (size & (size - 1))) return FALSE;
memset(ret, 0, sizeof(*ret)); /* clear unread bytes */ /* FIXME: this assumes that debuggee and debugger use the same diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index 9ceb9291d54..d7611ba75de 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -231,7 +231,8 @@ static int be_arm64_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way) static BOOL be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG* ret) { - if (size != 1 && size != 2 && size != 4 && size != 8) return FALSE; + /* size must fit in ret and be a power of two */ + if (size > sizeof(*ret) || (size & (size - 1))) return FALSE;
memset(ret, 0, sizeof(*ret)); /* clear unread bytes */ /* FIXME: this assumes that debuggee and debugger use the same diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index 08d0841a208..e7a1dd9d460 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -780,7 +780,8 @@ static int be_i386_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way) static BOOL be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG* ret) { - if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) return FALSE; + /* size must fit in ret and be a power of two */ + if (size > sizeof(*ret) || (size & (size - 1))) return FALSE;
memset(ret, 0, sizeof(*ret)); /* clear unread bytes */ /* FIXME: this assumes that debuggee and debugger use the same diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index c2839cf4097..4920bf2d0ca 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -702,8 +702,8 @@ static int be_x86_64_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way) static BOOL be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG* ret) { - if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) - return FALSE; + /* size must fit in ret and be a power of two */ + if (size > sizeof(*ret) || (size & (size - 1))) return FALSE;
memset(ret, 0, sizeof(*ret)); /* clear unread bytes */ /* FIXME: this assumes that debuggee and debugger use the same
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/be_arm.c | 1 + programs/winedbg/be_arm64.c | 1 + programs/winedbg/be_i386.c | 1 + programs/winedbg/be_x86_64.c | 1 + 4 files changed, 4 insertions(+)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index 3bf5771439c..451eb50e772 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -1859,6 +1859,7 @@ static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, d /* FIXME: this assumes that debuggee and debugger use the same * representation for reals */ + if (size > sizeof(tmp)) return FALSE; if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp; diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index d7611ba75de..aaf6ecf0bb6 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -256,6 +256,7 @@ static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, /* FIXME: this assumes that debuggee and debugger use the same * representation for reals */ + if (size > sizeof(tmp)) return FALSE; if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp; diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index e7a1dd9d460..3bb7b9b4240 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -805,6 +805,7 @@ static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, /* FIXME: this assumes that debuggee and debugger use the same * representation for reals */ + if (size > sizeof(tmp)) return FALSE; if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp; diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index 4920bf2d0ca..45c01a70594 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -727,6 +727,7 @@ static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size /* FIXME: this assumes that debuggee and debugger use the same * representation for reals */ + if (size > sizeof(tmp)) return FALSE; if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp;