winedbg: Module info.

when requesting info on a module by address, always print the module
ELF/PE pair (if this applies) (and not only the embedded PE), which
can be confusing.
This commit is contained in:
Eric Pouech 2006-06-26 21:37:42 +02:00 committed by Alexandre Julliard
parent 82ed6a4578
commit 6cff43fd72
1 changed files with 52 additions and 60 deletions

View File

@ -146,6 +146,7 @@ static const char* get_symtype_str(const IMAGEHLP_MODULE64* mi)
struct info_module struct info_module
{ {
IMAGEHLP_MODULE64* mi; IMAGEHLP_MODULE64* mi;
DWORD base;
unsigned num_alloc; unsigned num_alloc;
unsigned num_used; unsigned num_used;
}; };
@ -199,31 +200,16 @@ static BOOL CALLBACK info_mod_cb(PSTR mod_name, DWORD64 base, void* ctx)
*/ */
void info_win32_module(DWORD base) void info_win32_module(DWORD base)
{ {
struct info_module im;
int i, j, num_printed = 0;
DWORD opt;
if (!dbg_curr_process || !dbg_curr_thread) if (!dbg_curr_process || !dbg_curr_thread)
{ {
dbg_printf("Cannot get info on module while no process is loaded\n"); dbg_printf("Cannot get info on module while no process is loaded\n");
return; return;
} }
if (base)
{
IMAGEHLP_MODULE64 mi;
mi.SizeOfStruct = sizeof(mi);
if (!SymGetModuleInfo64(dbg_curr_process->handle, base, &mi))
{
dbg_printf("'0x%08lx' is not a valid module address\n", base);
return;
}
module_print_info(&mi, FALSE);
}
else
{
struct info_module im;
int i, j;
DWORD opt;
im.mi = NULL; im.mi = NULL;
im.num_alloc = im.num_used = 0; im.num_alloc = im.num_used = 0;
@ -240,6 +226,9 @@ void info_win32_module(DWORD base)
for (i = 0; i < im.num_used; i++) for (i = 0; i < im.num_used; i++)
{ {
if (base &&
(base < im.mi[i].BaseOfImage || base >= im.mi[i].BaseOfImage + im.mi[i].ImageSize))
continue;
if (strstr(im.mi[i].ModuleName, "<elf>")) if (strstr(im.mi[i].ModuleName, "<elf>"))
{ {
dbg_printf("ELF\t"); dbg_printf("ELF\t");
@ -269,9 +258,12 @@ void info_win32_module(DWORD base)
dbg_printf("PE\t"); dbg_printf("PE\t");
module_print_info(&im.mi[i], FALSE); module_print_info(&im.mi[i], FALSE);
} }
num_printed++;
} }
HeapFree(GetProcessHeap(), 0, im.mi); HeapFree(GetProcessHeap(), 0, im.mi);
}
if (base && !num_printed)
dbg_printf("'0x%08lx' is not a valid module address\n", base);
} }
struct class_walker struct class_walker