- 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 */ /* msc.c */
extern BOOL pe_load_debug_directory(const struct process* pcs, extern BOOL pe_load_debug_directory(const struct process* pcs,
struct module* module, struct module* module,
const BYTE* file_map, const BYTE* mapping,
const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg); const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg);
/* pe_module.c */ /* pe_module.c */
extern struct module* extern struct module*

View File

@ -638,6 +638,28 @@ union codeview_type
short int id; short int id;
unsigned char list[1]; unsigned char list[1];
} fieldlist; } 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 union codeview_fieldtype
@ -1709,6 +1731,14 @@ static int codeview_parse_type_table(struct module* module, const char* table, i
type->enumeration32.field); type->enumeration32.field);
break; break;
case LF_PROCEDURE:
FIXME("LF_PROCEDURE unhandled\n");
break;
case LF_PROCEDURE_32:
FIXME("LF_PROCEDURE_32 unhandled\n");
break;
default: default:
FIXME("Unhandled leaf %x\n", type->generic.id); FIXME("Unhandled leaf %x\n", type->generic.id);
break; break;
@ -2991,18 +3021,17 @@ static BOOL codeview_process_info(const struct process* pcs,
* Process debug directory. * Process debug directory.
*/ */
BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, BOOL pe_load_debug_directory(const struct process* pcs, struct module* module,
const BYTE* mapping, const IMAGE_DEBUG_DIRECTORY* dbg, const BYTE* mapping,
int nDbg) const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg)
{ {
BOOL ret; BOOL ret;
int i; int i;
struct msc_debug_info msc_dbg; 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.module = module;
msc_dbg.nsect = dbg_hdr->NumberOfSections; msc_dbg.nsect = nsect;
/* section headers come immediately after debug header */ msc_dbg.sectp = sectp;
msc_dbg.sectp = (const IMAGE_SECTION_HEADER*)(dbg_hdr + 1);
msc_dbg.nomap = 0; msc_dbg.nomap = 0;
msc_dbg.omapp = NULL; 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) 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 = (const IMAGE_DEBUG_DIRECTORY*)
(dbg_mapping + sizeof(*hdr) + (dbg_mapping + sizeof(*hdr) +
hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) + hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) +
hdr->ExportedNamesSize); 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)); hdr->DebugDirectorySize / sizeof(*dbg));
} }
else else
@ -178,8 +184,10 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs,
} }
else else
{ {
const IMAGE_SECTION_HEADER *sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
/* Debug info is embedded into PE module */ /* 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; return ret;