From 903c7855c90b2d92692b8f5b390673c9ea46e1d1 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 3 Jun 2017 19:01:43 +0000 Subject: [PATCH] [DBGHELP] Sync with Wine Staging 2.9. CORE-13362 d47c07d dbghelp: Avoid using isdigit() for WCHARs. 8d6cf80 dbghelp: Add support for char32_t type. b316ac1 dbghelp: Add support for char16_t type. 74f05b8 dbghelp: Use the main module load address from the PEB. 329b176 dbghelp: Use debugstr_a() to trace a string that can be NULL. 4bbb252 dbghelp: Removed no longer needed psapi import. svn path=/trunk/; revision=74794 --- reactos/dll/win32/dbghelp/cpu_i386.c | 6 +++--- reactos/dll/win32/dbghelp/dwarf.c | 2 +- reactos/dll/win32/dbghelp/elf_module.c | 10 +++++++++- reactos/dll/win32/dbghelp/module.c | 2 +- reactos/dll/win32/dbghelp/msc.c | 8 ++++++++ reactos/media/doc/README.WINE | 2 +- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/reactos/dll/win32/dbghelp/cpu_i386.c b/reactos/dll/win32/dbghelp/cpu_i386.c index c713049cf29..f0cf33aaf8c 100644 --- a/reactos/dll/win32/dbghelp/cpu_i386.c +++ b/reactos/dll/win32/dbghelp/cpu_i386.c @@ -215,16 +215,16 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO /* Init done */ set_curr_mode((frame->AddrPC.Mode == AddrModeFlat) ? stm_32bit : stm_16bit); - /* cur_switch holds address of WOW32Reserved field in TEB in debuggee + /* cur_switch holds address of SystemReserved1[0] field in TEB in debuggee * address space */ if (NtQueryInformationThread(csw->hThread, ThreadBasicInformation, &info, sizeof(info), NULL) == STATUS_SUCCESS) { - curr_switch = (DWORD_PTR)info.TebBaseAddress + FIELD_OFFSET(TEB, WOW32Reserved); + curr_switch = (DWORD_PTR)info.TebBaseAddress + FIELD_OFFSET(TEB, SystemReserved1[0]); if (!sw_read_mem(csw, curr_switch, &p, sizeof(p))) { - WARN("Can't read TEB:WOW32Reserved\n"); + WARN("Can't read TEB:SystemReserved1[0]\n"); goto done_err; } next_switch = p; diff --git a/reactos/dll/win32/dbghelp/dwarf.c b/reactos/dll/win32/dbghelp/dwarf.c index ce50a16a989..b8a5ec5b367 100644 --- a/reactos/dll/win32/dbghelp/dwarf.c +++ b/reactos/dll/win32/dbghelp/dwarf.c @@ -1888,7 +1888,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx, inline_flags.u.uvalue != DW_INL_not_inlined) { TRACE("Function %s declared as inlined (%ld)... skipping\n", - name.u.string ? name.u.string : "(null)", inline_flags.u.uvalue); + debugstr_a(name.u.string), inline_flags.u.uvalue); return NULL; } diff --git a/reactos/dll/win32/dbghelp/elf_module.c b/reactos/dll/win32/dbghelp/elf_module.c index b02026babd0..b44d988d020 100644 --- a/reactos/dll/win32/dbghelp/elf_module.c +++ b/reactos/dll/win32/dbghelp/elf_module.c @@ -1183,6 +1183,8 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename, char* ptr = (char*)fmap->u.elf.sect[ism.sidx].shdr.sh_addr; unsigned long len; + if (load_offset) ptr += load_offset - fmap->u.elf.elf_start; + do { if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) || @@ -1550,7 +1552,13 @@ static BOOL elf_enum_modules_internal(const struct process* pcs, */ static BOOL elf_search_loader(struct process* pcs, struct elf_info* elf_info) { - return elf_search_and_load_file(pcs, get_wine_loader_name(), 0, 0, elf_info); + PROCESS_BASIC_INFORMATION pbi; + ULONG_PTR base = 0; + + if (!NtQueryInformationProcess( pcs->handle, ProcessBasicInformation, &pbi, sizeof(pbi), NULL )) + ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0], &base, sizeof(base), NULL ); + + return elf_search_and_load_file(pcs, get_wine_loader_name(), base, 0, elf_info); } /****************************************************************** diff --git a/reactos/dll/win32/dbghelp/module.c b/reactos/dll/win32/dbghelp/module.c index 559c94f44a2..c0084ec1c0c 100644 --- a/reactos/dll/win32/dbghelp/module.c +++ b/reactos/dll/win32/dbghelp/module.c @@ -459,7 +459,7 @@ enum module_type module_get_type_by_name(const WCHAR* name) { int i = len; - while (i && isdigit(name[i - 1])) i--; + while (i && name[i - 1] >= '0' && name[i - 1] <= '9') i--; if (i && name[i - 1] == '.') len = i - 1; diff --git a/reactos/dll/win32/dbghelp/msc.c b/reactos/dll/win32/dbghelp/msc.c index e0037e93ecf..8fe509b59a6 100644 --- a/reactos/dll/win32/dbghelp/msc.c +++ b/reactos/dll/win32/dbghelp/msc.c @@ -149,6 +149,8 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_REAL80] = &symt_new_basic(module, btFloat, "long double", 10)->symt; cv_basic_types[T_RCHAR] = &symt_new_basic(module, btInt, "signed char", 1)->symt; cv_basic_types[T_WCHAR] = &symt_new_basic(module, btWChar, "wchar_t", 2)->symt; + cv_basic_types[T_CHAR16] = &symt_new_basic(module, btChar16,"char16_t", 2)->symt; + cv_basic_types[T_CHAR32] = &symt_new_basic(module, btChar32,"char32_t", 4)->symt; cv_basic_types[T_INT2] = &symt_new_basic(module, btInt, "INT2", 2)->symt; cv_basic_types[T_UINT2] = &symt_new_basic(module, btUInt, "UINT2", 2)->symt; cv_basic_types[T_INT4] = &symt_new_basic(module, btInt, "INT4", 4)->symt; @@ -175,6 +177,8 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_32PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80], 4)->symt; cv_basic_types[T_32PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR], 4)->symt; cv_basic_types[T_32PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR], 4)->symt; + cv_basic_types[T_32PCHAR16] = &symt_new_pointer(module, cv_basic_types[T_CHAR16], 4)->symt; + cv_basic_types[T_32PCHAR32] = &symt_new_pointer(module, cv_basic_types[T_CHAR32], 4)->symt; cv_basic_types[T_32PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2], 4)->symt; cv_basic_types[T_32PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2], 4)->symt; cv_basic_types[T_32PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4], 4)->symt; @@ -201,6 +205,8 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_64PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80], 8)->symt; cv_basic_types[T_64PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR], 8)->symt; cv_basic_types[T_64PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR], 8)->symt; + cv_basic_types[T_64PCHAR16] = &symt_new_pointer(module, cv_basic_types[T_CHAR16], 8)->symt; + cv_basic_types[T_64PCHAR32] = &symt_new_pointer(module, cv_basic_types[T_CHAR32], 8)->symt; cv_basic_types[T_64PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2], 8)->symt; cv_basic_types[T_64PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2], 8)->symt; cv_basic_types[T_64PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4], 8)->symt; @@ -227,6 +233,8 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_PREAL80] = &symt_new_pointer(module, cv_basic_types[T_REAL80], sizeof(void*))->symt; cv_basic_types[T_PRCHAR] = &symt_new_pointer(module, cv_basic_types[T_RCHAR], sizeof(void*))->symt; cv_basic_types[T_PWCHAR] = &symt_new_pointer(module, cv_basic_types[T_WCHAR], sizeof(void*))->symt; + cv_basic_types[T_PCHAR16] = &symt_new_pointer(module, cv_basic_types[T_CHAR16], sizeof(void*))->symt; + cv_basic_types[T_PCHAR32] = &symt_new_pointer(module, cv_basic_types[T_CHAR32], sizeof(void*))->symt; cv_basic_types[T_PINT2] = &symt_new_pointer(module, cv_basic_types[T_INT2], sizeof(void*))->symt; cv_basic_types[T_PUINT2] = &symt_new_pointer(module, cv_basic_types[T_UINT2], sizeof(void*))->symt; cv_basic_types[T_PINT4] = &symt_new_pointer(module, cv_basic_types[T_INT4], sizeof(void*))->symt; diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 2289955936d..b1a613457f5 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -63,7 +63,7 @@ reactos/dll/win32/cryptdlg # Synced to WineStaging-1.9.11 reactos/dll/win32/cryptdll # Synced to WineStaging-1.9.11 reactos/dll/win32/cryptnet # Synced to WineStaging-2.9 reactos/dll/win32/cryptui # Synced to WineStaging-1.9.16 -reactos/dll/win32/dbghelp # Synced to WineStaging-1.9.23 +reactos/dll/win32/dbghelp # Synced to WineStaging-2.9 reactos/dll/win32/dciman32 # Synced to WineStaging-1.9.11 reactos/dll/win32/faultrep # Synced to WineStaging-1.9.11 reactos/dll/win32/fontsub # Synced to WineStaging-1.9.13