- Move header parsing to callers of pe_load_debug_directory.

- Add stubs and structures for LF_PROCEDURE types.
This commit is contained in:
Robert Shearman 2004-10-11 20:08:07 +00:00 committed by Alexandre Julliard
parent 7213264d65
commit 5f21fd47f8
3 changed files with 48 additions and 10 deletions

View File

@ -334,7 +334,8 @@ extern BOOL module_remove(struct process* pcs,
/* 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*

View File

@ -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(struct module* module, const char* table, i
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 struct process* pcs,
* 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;

View File

@ -117,12 +117,18 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
}
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 struct process* pcs,
}
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;