BUGFIX: stabs lookup ( particularly line # lookup )

svn path=/trunk/; revision=12169
This commit is contained in:
Royce Mitchell III 2004-12-17 17:51:57 +00:00
parent 26b1a392bf
commit 6aa427939e
2 changed files with 54 additions and 51 deletions

View file

@ -79,6 +79,8 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
StabEntry = StartEntry;
}
if ( RelativeAddress != NULL )
{
for (; (ULONG_PTR)StabEntry < (ULONG_PTR)StabsEnd; StabEntry++)
{
ULONG_PTR SymbolRelativeAddress;
@ -91,6 +93,9 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
if (StabEntry->n_value >= SymbolInfo->ImageSize)
continue;
if (StabEntry->n_value > (ULONG_PTR)RelativeAddress )
break;
SymbolRelativeAddress = StabEntry->n_value;
if ((SymbolRelativeAddress <= (ULONG_PTR)RelativeAddress) &&
(SymbolRelativeAddress > AddrFound))
@ -99,12 +104,10 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
BestStabEntry = StabEntry;
}
}
}
}
else
{
BestStabEntry = StabEntry;
break;
}
}
if (BestStabEntry == NULL)
{
@ -117,4 +120,3 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
return BestStabEntry;
}

View file

@ -339,7 +339,7 @@ KdbSymGetAddressInformation(IN PIMAGE_SYMBOL_INFO SymbolInfo,
if (LineNumber != NULL && FunctionEntry != NULL)
{
/* find stab entry for line number */
ULONG_PTR FunctionRelativeAddress = FunctionEntry->n_value - (ULONG_PTR)SymbolInfo->ImageBase;
ULONG_PTR FunctionRelativeAddress = RelativeAddress - FunctionEntry->n_value;
ULONG_PTR AddrFound = 0;
PSTAB_ENTRY NextLineEntry;
@ -354,8 +354,8 @@ KdbSymGetAddressInformation(IN PIMAGE_SYMBOL_INFO SymbolInfo,
if (NextLineEntry->n_type != N_SLINE)
continue;
if (((NextLineEntry->n_value+FunctionRelativeAddress) <= RelativeAddress) &&
(NextLineEntry->n_value > AddrFound))
if ( NextLineEntry->n_value <= FunctionRelativeAddress
&& NextLineEntry->n_value >= AddrFound )
{
AddrFound = NextLineEntry->n_value;
LineEntry = NextLineEntry;
@ -960,7 +960,8 @@ KdbSymProcessSymbolFile(IN PVOID ModuleLoadBase,
SymbolInfo->SymbolStringsLength = SymbolFileHeader->StabstrLength;
DPRINT("Installed stabs: %s@%08x-%08x (%08x-%08x,%08x)\n",
FileName,
ModuleObject->Base, ModuleObject->Length + ModuleObject->Base,
ModuleObject->Base,
ModuleObject->Length + ModuleObject->Base,
SymbolInfo->SymbolsBase,
SymbolInfo->SymbolsLength + SymbolInfo->SymbolsBase,
SymbolInfo->SymbolStringsBase);