The aim of this MR is to mark some debug formats loaded by dbghelp as deprecated.
The idea is to remove them from dbghelp: - after Wine 11 is released (for the ones still working) - during PDB rewrite landing (after Wine 10 is released) if this can help the process
The considered debug formats are: 1) COFF inside PE images 2) CodeView inside PE images 3) OMAP inside PE images 4) split debug info in .DBG files 5) PDB (in JG format). This is an early format, which has been superseded by the DS format. clang only supports/understands the later DS format.
I retested on a small 'Hello World' application, using a MSVC compiler from 1998 (version 12.0). This compiler allows to emit COFF in PE images, split .DBG and PDB/JG debug formats (it doesn't even seem to be able to emit Codeview inside PE images, nor OMAP).
And from MSVC 14.0 onwards, none of these formats are available (only PDB DS).
Test results with MSVC 12.0: - COFF inside PE image: doesn't work - split .DBG: doesn't work - PDB JG: does work (even if exceptions are caught)
work = can set BP on main, can backtrace (with line number) when that BP is hit (using winedbg + builtin dbghelp)
-- v2: dbghelp: Emit deprecation FIXME for embedded, .dbg and PDB JG formats. winedump: Use correct computation for first section out of a .DBG file.
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- tools/winedump/pe.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index 4dab6aceb79..34fd32bef4d 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -2617,7 +2617,7 @@ static void dump_dir_delay_imported_functions(void) printf("\n"); }
-static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) +static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx, const IMAGE_SECTION_HEADER *first_section) { const char* str;
@@ -2657,8 +2657,7 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) case IMAGE_DEBUG_TYPE_UNKNOWN: break; case IMAGE_DEBUG_TYPE_COFF: - dump_coff(idd->PointerToRawData, idd->SizeOfData, - IMAGE_FIRST_SECTION(PE_nt_headers)); + dump_coff(idd->PointerToRawData, idd->SizeOfData, first_section); break; case IMAGE_DEBUG_TYPE_CODEVIEW: dump_codeview(idd->PointerToRawData, idd->SizeOfData); @@ -2735,7 +2734,7 @@ static void dump_dir_debug(void)
for (i = 0; i < nb_dbg; i++) { - dump_dir_debug_dir(debugDir, i); + dump_dir_debug_dir(debugDir, i, IMAGE_FIRST_SECTION(PE_nt_headers)); debugDir++; } printf("\n"); @@ -4185,7 +4184,7 @@ void dbg_dump(void)
for (i = 0; i < nb_dbg; i++) { - dump_dir_debug_dir(debugDir, i); + dump_dir_debug_dir(debugDir, i, (const IMAGE_SECTION_HEADER*)(separateDebugHead + 1)); debugDir++; } }
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/msc.c | 14 ++++++++++---- dlls/dbghelp/pe_module.c | 5 +++-- 3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 8def6a7dae6..b07c30b1a97 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -750,7 +750,7 @@ extern BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, const BYTE* mapping, const IMAGE_SECTION_HEADER* sectp, DWORD nsect, - const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg); + const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg, BOOL in_pe_image); extern DWORD msc_get_file_indexinfo(void* image, const IMAGE_DEBUG_DIRECTORY* dbgdir, DWORD size, SYMSRV_INDEX_INFOW* info); struct pdb_cmd_pair { diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 22ec5230f7a..952426b824b 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3507,6 +3507,8 @@ static BOOL pdb_init(struct pdb_file_info* pdb_file, const char* image) default: ERR("-Unknown root block version %d\n", root->Version); } + ERR("Support of old PDB format (JG) is deprecated\n"); + pdb_file->kind = PDB_JG; pdb_file->u.jg.toc = jg_toc; TRACE("found JG: age=%x timestamp=%x\n", root->Age, root->TimeDateStamp); @@ -4323,7 +4325,7 @@ BOOL pdb_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip, #define CODEVIEW_RSDS_SIG MAKESIG('R','S','D','S')
static BOOL codeview_process_info(const struct process *pcs, - const struct msc_debug_info *msc_dbg) + const struct msc_debug_info *msc_dbg, BOOL in_pe_image) { const DWORD* signature = (const DWORD*)msc_dbg->root; BOOL ret = FALSE; @@ -4344,6 +4346,8 @@ static BOOL codeview_process_info(const struct process *pcs,
codeview_init_basic_types(msc_dbg->module);
+ if (in_pe_image) ERR("Support of CodeView debug information in PE image is deprecated\n"); + for (i = 0; i < hdr->cDir; i++) { ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader + i * hdr->cbDirEntry); @@ -4452,7 +4456,7 @@ static BOOL codeview_process_info(const struct process *pcs, BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, const BYTE* mapping, const IMAGE_SECTION_HEADER* sectp, DWORD nsect, - const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg) + const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg, BOOL in_pe_image) { BOOL ret; int i; @@ -4473,6 +4477,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, { if (dbg[i].Type == IMAGE_DEBUG_TYPE_OMAP_FROM_SRC) { + if (in_pe_image) ERR("Support of OMAP debug information in PE image is deprecated\n"); msc_dbg.nomap = dbg[i].SizeOfData / sizeof(OMAP); msc_dbg.omapp = (const OMAP*)(mapping + dbg[i].PointerToRawData); break; @@ -4485,7 +4490,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, if (dbg[i].Type == IMAGE_DEBUG_TYPE_CODEVIEW) { msc_dbg.root = mapping + dbg[i].PointerToRawData; - if ((ret = codeview_process_info(pcs, &msc_dbg))) goto done; + if ((ret = codeview_process_info(pcs, &msc_dbg, in_pe_image))) goto done; } }
@@ -4494,6 +4499,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, { if (dbg[i].Type == IMAGE_DEBUG_TYPE_COFF) { + if (in_pe_image) ERR("Support of COFF debug information in PE image is deprecated\n"); msc_dbg.root = mapping + dbg[i].PointerToRawData; if ((ret = coff_process_info(&msc_dbg))) goto done; } @@ -4505,7 +4511,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, */ for (i = 0; i < nDbg; i++) if (dbg[i].Type == IMAGE_DEBUG_TYPE_FPO) - FIXME("This guy has FPO information\n"); + FIXME("No support for FPO information in PE image\n"); #if 0
#define FRAME_FPO 0 diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index bd3d6000535..88f2ba9427b 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -594,6 +594,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, SYMSRV_INDEX_INFOW info;
TRACE("Processing DBG file %s\n", debugstr_a(dbg_name)); + ERR("Support of split debug information in .DBG file (%s) is deprecated.\n", debugstr_a(dbg_name));
if (path_find_symbol_file(pcs, module, dbg_name, FALSE, NULL, timestamp, 0, &info, &module->module.DbgUnmatched) && (hFile = CreateFileW(info.dbgfile, GENERIC_READ, FILE_SHARE_READ, NULL, @@ -616,7 +617,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
ret = pe_load_debug_directory(pcs, module, dbg_mapping, sectp, hdr->NumberOfSections, dbg, - hdr->DebugDirectorySize / sizeof(*dbg)); + hdr->DebugDirectorySize / sizeof(*dbg), FALSE); } else ERR("Couldn't find .DBG file %s (%s)\n", debugstr_a(dbg_name), debugstr_w(info.dbgfile)); @@ -668,7 +669,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod { /* Debug info is embedded into PE module */ ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), - nth->FileHeader.NumberOfSections, dbg, nDbg); + nth->FileHeader.NumberOfSections, dbg, nDbg, TRUE); } pe_unmap_full(fmap); return ret;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150905
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000001C900F6, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
On Wed Jan 15 11:09:48 2025 +0000, eric pouech wrote:
right, that's not very logical I don't like MESSAGE here as it cannot be turned off, nor creating a specific debug channel (or even a new debug class) just for this case I'll go for ERR then
Using ERR() makes it even worse. We either do support some feature, and make an effort to do it best, or don't, and we emit a FIXME() in that case. Emitting FIXMEs or ERRs for random things adds a confusion and doesn't improve anything.