mirror of
https://github.com/reactos/wine.git
synced 2025-02-13 08:44:54 +00:00
dbghelp: Wrap TRACE strings using the debugstr functions and update some type casting.
This commit is contained in:
parent
a5a35ec211
commit
e254a1d929
@ -40,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
|||||||
* its debugging information)
|
* its debugging information)
|
||||||
*/
|
*/
|
||||||
static BOOL pe_load_stabs(const struct process* pcs, struct module* module,
|
static BOOL pe_load_stabs(const struct process* pcs, struct module* module,
|
||||||
const void* mapping, IMAGE_NT_HEADERS* nth)
|
void* mapping, IMAGE_NT_HEADERS* nth)
|
||||||
{
|
{
|
||||||
IMAGE_SECTION_HEADER* section;
|
IMAGE_SECTION_HEADER* section;
|
||||||
int i, stabsize = 0, stabstrsize = 0;
|
int i, stabsize = 0, stabstrsize = 0;
|
||||||
@ -67,11 +67,13 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module* module,
|
|||||||
{
|
{
|
||||||
ret = stabs_parse(module,
|
ret = stabs_parse(module,
|
||||||
module->module.BaseOfImage - nth->OptionalHeader.ImageBase,
|
module->module.BaseOfImage - nth->OptionalHeader.ImageBase,
|
||||||
RtlImageRvaToVa(nth, (void*)mapping, stabs, NULL),
|
RtlImageRvaToVa(nth, mapping, stabs, NULL),
|
||||||
stabsize,
|
stabsize,
|
||||||
RtlImageRvaToVa(nth, (void*)mapping, stabstr, NULL),
|
RtlImageRvaToVa(nth, mapping, stabstr, NULL),
|
||||||
stabstrsize);
|
stabstrsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE("%s the STABS debug info\n", ret ? "successfully loaded" : "failed to load");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +98,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
|
|||||||
const IMAGE_DEBUG_DIRECTORY* dbg;
|
const IMAGE_DEBUG_DIRECTORY* dbg;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
WINE_TRACE("Processing DBG file %s\n", dbg_name);
|
WINE_TRACE("Processing DBG file %s\n", debugstr_a(dbg_name));
|
||||||
|
|
||||||
if (SymFindFileInPath(pcs->handle, NULL, dbg_name, NULL, 0, 0, 0, tmp, dbg_match, NULL) &&
|
if (SymFindFileInPath(pcs->handle, NULL, dbg_name, NULL, 0, 0, 0, tmp, dbg_match, NULL) &&
|
||||||
(hFile = CreateFileA(tmp, GENERIC_READ, FILE_SHARE_READ, NULL,
|
(hFile = CreateFileA(tmp, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
@ -108,7 +110,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
|
|||||||
if (hdr->TimeDateStamp != timestamp)
|
if (hdr->TimeDateStamp != timestamp)
|
||||||
{
|
{
|
||||||
WINE_ERR("Warning - %s has incorrect internal timestamp\n",
|
WINE_ERR("Warning - %s has incorrect internal timestamp\n",
|
||||||
dbg_name);
|
debugstr_a(dbg_name));
|
||||||
/*
|
/*
|
||||||
* Well, sometimes this happens to DBG files which ARE REALLY the
|
* Well, sometimes this happens to DBG files which ARE REALLY the
|
||||||
* right .DBG files but nonetheless this check fails. Anyway,
|
* right .DBG files but nonetheless this check fails. Anyway,
|
||||||
@ -136,7 +138,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
|
|||||||
ERR("Wrong signature in .DBG file %s\n", debugstr_a(tmp));
|
ERR("Wrong signature in .DBG file %s\n", debugstr_a(tmp));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WINE_ERR("-Unable to peruse .DBG file %s (%s)\n", dbg_name, debugstr_a(tmp));
|
WINE_ERR("-Unable to peruse .DBG file %s (%s)\n", debugstr_a(dbg_name), debugstr_a(tmp));
|
||||||
|
|
||||||
if (dbg_mapping) UnmapViewOfFile(dbg_mapping);
|
if (dbg_mapping) UnmapViewOfFile(dbg_mapping);
|
||||||
if (hMap) CloseHandle(hMap);
|
if (hMap) CloseHandle(hMap);
|
||||||
@ -151,7 +153,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
|
|||||||
*/
|
*/
|
||||||
static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
||||||
struct module* module,
|
struct module* module,
|
||||||
const void* mapping, IMAGE_NT_HEADERS* nth)
|
void* mapping, IMAGE_NT_HEADERS* nth)
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
const IMAGE_DATA_DIRECTORY* dir;
|
const IMAGE_DATA_DIRECTORY* dir;
|
||||||
@ -163,7 +165,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
|||||||
nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY);
|
nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY);
|
||||||
if (!nDbg) return FALSE;
|
if (!nDbg) return FALSE;
|
||||||
|
|
||||||
dbg = RtlImageRvaToVa(nth, (void*)mapping, dir->VirtualAddress, NULL);
|
dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL);
|
||||||
|
|
||||||
/* Parse debug directory */
|
/* Parse debug directory */
|
||||||
if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)
|
if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)
|
||||||
@ -199,7 +201,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
|||||||
*/
|
*/
|
||||||
static BOOL pe_load_export_debug_info(const struct process* pcs,
|
static BOOL pe_load_export_debug_info(const struct process* pcs,
|
||||||
struct module* module,
|
struct module* module,
|
||||||
const void* mapping, IMAGE_NT_HEADERS* nth)
|
void* mapping, IMAGE_NT_HEADERS* nth)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
const IMAGE_EXPORT_DIRECTORY* exports;
|
const IMAGE_EXPORT_DIRECTORY* exports;
|
||||||
@ -229,13 +231,13 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
|
|||||||
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
|
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
|
||||||
{
|
{
|
||||||
symt_new_public(module, NULL, section->Name,
|
symt_new_public(module, NULL, section->Name,
|
||||||
RtlImageRvaToVa(nth, (void*)mapping, section->VirtualAddress, NULL),
|
RtlImageRvaToVa(nth, mapping, section->VirtualAddress, NULL),
|
||||||
1, TRUE /* FIXME */, TRUE /* FIXME */);
|
1, TRUE /* FIXME */, TRUE /* FIXME */);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Add exported functions */
|
/* Add exported functions */
|
||||||
if ((exports = RtlImageDirectoryEntryToData((void*)mapping, FALSE,
|
if ((exports = RtlImageDirectoryEntryToData(mapping, FALSE,
|
||||||
IMAGE_DIRECTORY_ENTRY_EXPORT, &size)))
|
IMAGE_DIRECTORY_ENTRY_EXPORT, &size)))
|
||||||
{
|
{
|
||||||
const WORD* ordinals = NULL;
|
const WORD* ordinals = NULL;
|
||||||
@ -244,9 +246,9 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
|
|
||||||
functions = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfFunctions, NULL);
|
functions = RtlImageRvaToVa(nth, mapping, exports->AddressOfFunctions, NULL);
|
||||||
ordinals = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNameOrdinals, NULL);
|
ordinals = RtlImageRvaToVa(nth, mapping, exports->AddressOfNameOrdinals, NULL);
|
||||||
names = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNames, NULL);
|
names = RtlImageRvaToVa(nth, mapping, exports->AddressOfNames, NULL);
|
||||||
|
|
||||||
if (functions && ordinals && names)
|
if (functions && ordinals && names)
|
||||||
{
|
{
|
||||||
@ -254,7 +256,7 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
|
|||||||
{
|
{
|
||||||
if (!names[i]) continue;
|
if (!names[i]) continue;
|
||||||
symt_new_public(module, NULL,
|
symt_new_public(module, NULL,
|
||||||
RtlImageRvaToVa(nth, (void*)mapping, names[i], NULL),
|
RtlImageRvaToVa(nth, mapping, names[i], NULL),
|
||||||
base + functions[ordinals[i]],
|
base + functions[ordinals[i]],
|
||||||
1, TRUE /* FIXME */, TRUE /* FIXME */);
|
1, TRUE /* FIXME */, TRUE /* FIXME */);
|
||||||
}
|
}
|
||||||
@ -369,6 +371,8 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
|
|||||||
else
|
else
|
||||||
pe_load_debug_info(pcs, module);
|
pe_load_debug_info(pcs, module);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ERR("could not load the module '%s'\n", debugstr_w(loaded_name));
|
||||||
}
|
}
|
||||||
UnmapViewOfFile(mapping);
|
UnmapViewOfFile(mapping);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user