DbgHelp: Fix PDB Loading
Robert Shearman
rob at codeweavers.com
Mon Oct 11 08:54:17 CDT 2004
Hi,
My previous patch broke PDB file loading as I hadn't considered that
pe_load_debug_directory was used for loading traditional PE files as
well as DBG files with a different header. This patch moves the parsing
of the header to the callers of the function that know what sort of file
that is being loaded.
Rob
Changelog:
- Move header parsing to callers of pe_load_debug_directory.
- Add stubs and structures for LF_PROCEDURE types.
-------------- next part --------------
Index: wine/dlls/dbghelp/pe_module.c
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/pe_module.c,v
retrieving revision 1.6
diff -u -p -r1.6 pe_module.c
--- wine/dlls/dbghelp/pe_module.c 4 Oct 2004 19:30:50 -0000 1.6
+++ wine/dlls/dbghelp/pe_module.c 11 Oct 2004 13:49:00 -0000
@@ -117,12 +117,18 @@ static BOOL pe_load_dbg_file(const struc
}
if (hdr->Signature == IMAGE_SEPARATE_DEBUG_SIGNATURE)
{
+ /* section headers come immediately after debug header */
+ const IMAGE_SECTION_HEADER *sectp =
+ (const IMAGE_SECTION_HEADER*)(hdr + 1);
+ /* and after that and the exported names comes the debug directory */
dbg = (const IMAGE_DEBUG_DIRECTORY*)
(dbg_mapping + sizeof(*hdr) +
hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) +
hdr->ExportedNamesSize);
-
- ret = pe_load_debug_directory(pcs, module, dbg_mapping, dbg,
+
+
+ ret = pe_load_debug_directory(pcs, module, dbg_mapping, sectp,
+ hdr->NumberOfSections, dbg,
hdr->DebugDirectorySize / sizeof(*dbg));
}
else
@@ -178,8 +184,10 @@ static BOOL pe_load_msc_debug_info(const
}
else
{
+ const IMAGE_SECTION_HEADER *sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
/* Debug info is embedded into PE module */
- ret = pe_load_debug_directory(pcs, module, mapping, dbg, nDbg);
+ ret = pe_load_debug_directory(pcs, module, mapping, sectp,
+ nth->FileHeader.NumberOfSections, dbg, nDbg);
}
return ret;
Index: wine/dlls/dbghelp/msc.c
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/msc.c,v
retrieving revision 1.7
diff -u -p -r1.7 msc.c
--- wine/dlls/dbghelp/msc.c 4 Oct 2004 19:30:50 -0000 1.7
+++ wine/dlls/dbghelp/msc.c 11 Oct 2004 13:49:00 -0000
@@ -638,6 +638,28 @@ union codeview_type
short int id;
unsigned char list[1];
} fieldlist;
+
+ struct
+ {
+ unsigned short int len;
+ short int id;
+ unsigned short int rvtype;
+ unsigned char call;
+ unsigned char reserved;
+ unsigned short int params;
+ unsigned short int arglist;
+ } procedure;
+
+ struct
+ {
+ unsigned short int len;
+ short int id;
+ unsigned int rvtype;
+ unsigned char call;
+ unsigned char reserved;
+ unsigned short int params;
+ unsigned int arglist;
+ } procedure32;
};
union codeview_fieldtype
@@ -1709,6 +1731,14 @@ static int codeview_parse_type_table(str
type->enumeration32.field);
break;
+ case LF_PROCEDURE:
+ FIXME("LF_PROCEDURE unhandled\n");
+ break;
+
+ case LF_PROCEDURE_32:
+ FIXME("LF_PROCEDURE_32 unhandled\n");
+ break;
+
default:
FIXME("Unhandled leaf %x\n", type->generic.id);
break;
@@ -2991,18 +3021,17 @@ static BOOL codeview_process_info(const
* Process debug directory.
*/
BOOL pe_load_debug_directory(const struct process* pcs, struct module* module,
- const BYTE* mapping, const IMAGE_DEBUG_DIRECTORY* dbg,
- int nDbg)
+ const BYTE* mapping,
+ const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
+ const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg)
{
BOOL ret;
int i;
struct msc_debug_info msc_dbg;
- const IMAGE_SEPARATE_DEBUG_HEADER* dbg_hdr = (const IMAGE_SEPARATE_DEBUG_HEADER*)mapping;
msc_dbg.module = module;
- msc_dbg.nsect = dbg_hdr->NumberOfSections;
- /* section headers come immediately after debug header */
- msc_dbg.sectp = (const IMAGE_SECTION_HEADER*)(dbg_hdr + 1);
+ msc_dbg.nsect = nsect;
+ msc_dbg.sectp = sectp;
msc_dbg.nomap = 0;
msc_dbg.omapp = NULL;
Index: wine/dlls/dbghelp/dbghelp_private.h
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/dbghelp_private.h,v
retrieving revision 1.8
diff -u -p -r1.8 dbghelp_private.h
--- wine/dlls/dbghelp/dbghelp_private.h 27 Sep 2004 20:31:42 -0000 1.8
+++ wine/dlls/dbghelp/dbghelp_private.h 11 Oct 2004 13:49:01 -0000
@@ -332,7 +332,8 @@ extern BOOL module_remove(struct
/* msc.c */
extern BOOL pe_load_debug_directory(const struct process* pcs,
struct module* module,
- const BYTE* file_map,
+ const BYTE* mapping,
+ const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg);
/* pe_module.c */
extern struct module*
More information about the wine-patches
mailing list