Commit a29a8a31 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Print 'module+disp' instead of 'func+disp' when the address is after the function.

parent d65edd04
...@@ -583,28 +583,42 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line) ...@@ -583,28 +583,42 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line)
{ {
char buffer[sizeof(SYMBOL_INFO) + 256]; char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO* si = (SYMBOL_INFO*)buffer; SYMBOL_INFO* si = (SYMBOL_INFO*)buffer;
void* lin = memory_to_linear_addr(addr); DWORD_PTR lin = (DWORD_PTR)memory_to_linear_addr(addr);
DWORD64 disp64; DWORD64 disp64;
DWORD disp; DWORD disp;
IMAGEHLP_MODULE im;
print_bare_address(addr); print_bare_address(addr);
si->SizeOfStruct = sizeof(*si); si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256; si->MaxNameLen = 256;
if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp64, si)) return; im.SizeOfStruct = 0;
dbg_printf(" %s", si->Name); if (SymFromAddr(dbg_curr_process->handle, lin, &disp64, si) && disp64 < si->Size)
if (disp64) dbg_printf("+0x%I64x", disp64); {
dbg_printf(" %s", si->Name);
if (disp64) dbg_printf("+0x%I64x", disp64);
}
else
{
im.SizeOfStruct = sizeof(im);
if (!SymGetModuleInfo(dbg_curr_process->handle, lin, &im)) return;
dbg_printf(" %s", im.ModuleName);
if (lin > im.BaseOfImage)
dbg_printf("+0x%Ix", lin - im.BaseOfImage);
}
if (with_line) if (with_line)
{ {
IMAGEHLP_LINE64 il; IMAGEHLP_LINE64 il;
IMAGEHLP_MODULE im;
il.SizeOfStruct = sizeof(il); il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr64(dbg_curr_process->handle, (DWORD_PTR)lin, &disp, &il)) if (SymGetLineFromAddr64(dbg_curr_process->handle, lin, &disp, &il))
dbg_printf(" [%s:%u]", il.FileName, il.LineNumber); dbg_printf(" [%s:%u]", il.FileName, il.LineNumber);
im.SizeOfStruct = sizeof(im); if (im.SizeOfStruct == 0) /* don't display again module if address is in module+disp form */
if (SymGetModuleInfo(dbg_curr_process->handle, (DWORD_PTR)lin, &im)) {
dbg_printf(" in %s", im.ModuleName); im.SizeOfStruct = sizeof(im);
if (SymGetModuleInfo(dbg_curr_process->handle, lin, &im))
dbg_printf(" in %s", im.ModuleName);
}
} }
} }
......
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