Commit 3c070225 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed module mapping for debug info when PE section is compressed.

parent 9e881be5
...@@ -124,6 +124,7 @@ static void* DEBUG_MapDebugInfoFile(const char* name, DWORD offset, DWORD size, ...@@ -124,6 +124,7 @@ static void* DEBUG_MapDebugInfoFile(const char* name, DWORD offset, DWORD size,
if ((ret = MapViewOfFile(*hMap, FILE_MAP_READ, 0, g_offset, g_size)) != NULL) if ((ret = MapViewOfFile(*hMap, FILE_MAP_READ, 0, g_offset, g_size)) != NULL)
ret += offset - g_offset; ret += offset - g_offset;
return ret; return ret;
} }
...@@ -2856,25 +2857,30 @@ static enum DbgInfoLoad DEBUG_ProcessDebugDirectory( DBG_MODULE *module, ...@@ -2856,25 +2857,30 @@ static enum DbgInfoLoad DEBUG_ProcessDebugDirectory( DBG_MODULE *module,
/* First, watch out for OMAP data */ /* First, watch out for OMAP data */
for ( i = 0; i < nDbg; i++ ) for ( i = 0; i < nDbg; i++ )
{
if ( dbg[i].Type == IMAGE_DEBUG_TYPE_OMAP_FROM_SRC ) if ( dbg[i].Type == IMAGE_DEBUG_TYPE_OMAP_FROM_SRC )
{ {
module->msc_info->nomap = dbg[i].SizeOfData / sizeof(OMAP_DATA); module->msc_info->nomap = dbg[i].SizeOfData / sizeof(OMAP_DATA);
module->msc_info->omapp = (OMAP_DATA *)(file_map + dbg[i].PointerToRawData); module->msc_info->omapp = (OMAP_DATA *)(file_map + dbg[i].PointerToRawData);
break; break;
} }
}
/* Now, try to parse CodeView debug info */ /* Now, try to parse CodeView debug info */
for ( i = 0; dil != DIL_LOADED && i < nDbg; i++ ) for ( i = 0; dil != DIL_LOADED && i < nDbg; i++ )
{
if ( dbg[i].Type == IMAGE_DEBUG_TYPE_CODEVIEW ) if ( dbg[i].Type == IMAGE_DEBUG_TYPE_CODEVIEW )
{
dil = DEBUG_ProcessCodeView( module, file_map + dbg[i].PointerToRawData ); dil = DEBUG_ProcessCodeView( module, file_map + dbg[i].PointerToRawData );
}
}
/* If not found, try to parse COFF debug info */ /* If not found, try to parse COFF debug info */
for ( i = 0; dil != DIL_LOADED && i < nDbg; i++ ) for ( i = 0; dil != DIL_LOADED && i < nDbg; i++ )
{
if ( dbg[i].Type == IMAGE_DEBUG_TYPE_COFF ) if ( dbg[i].Type == IMAGE_DEBUG_TYPE_COFF )
dil = DEBUG_ProcessCoff( module, file_map + dbg[i].PointerToRawData ); dil = DEBUG_ProcessCoff( module, file_map + dbg[i].PointerToRawData );
}
#if 0 #if 0
/* FIXME: this should be supported... this is the debug information for /* FIXME: this should be supported... this is the debug information for
* functions compiled without a frame pointer (FPO = frame pointer omission) * functions compiled without a frame pointer (FPO = frame pointer omission)
...@@ -3032,8 +3038,30 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile, ...@@ -3032,8 +3038,30 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
else else
{ {
/* Debug info is embedded into PE module */ /* Debug info is embedded into PE module */
/* FIXME: the nDBG information we're manipulating comes from the debuggee
* address space. However, the following code will be made against the
* version mapped in the debugger address space. There are cases (for example
* when the PE sections are compressed in the file and become decompressed
* in the debuggee address space) where the two don't match.
* Therefore, redo the DBG information lookup with the mapped data
*/
PIMAGE_NT_HEADERS mpd_nth = (PIMAGE_NT_HEADERS)(file_map + nth_ofs);
PIMAGE_DATA_DIRECTORY mpd_dir;
PIMAGE_DEBUG_DIRECTORY mpd_dbg = NULL;
/* sanity checks */
if ( mpd_nth->Signature != IMAGE_NT_SIGNATURE ||
mpd_nth->FileHeader.NumberOfSections != nth->FileHeader.NumberOfSections ||
!(mpd_nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED ))
goto leave;
mpd_dir = mpd_nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG;
if ((mpd_dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY)) != nDbg)
goto leave;
mpd_dbg = (PIMAGE_DEBUG_DIRECTORY)(file_map + mpd_dir->VirtualAddress);
dil = DEBUG_ProcessDebugDirectory( module, file_map, dbg, nDbg ); dil = DEBUG_ProcessDebugDirectory( module, file_map, mpd_dbg, nDbg );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment