mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
RSYM: force all sym files to have 0-based function offsets.
NTOSKRNL: look for 0-based offsets instead of absolute offsets. svn path=/trunk/; revision=12127
This commit is contained in:
parent
262a6b4866
commit
66468c3013
2 changed files with 25 additions and 14 deletions
|
@ -88,12 +88,10 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
|
|||
|
||||
if (RelativeAddress != NULL)
|
||||
{
|
||||
if (StabEntry->n_value < (ULONG_PTR)SymbolInfo->ImageBase)
|
||||
continue;
|
||||
if (StabEntry->n_value >= ((ULONG_PTR)SymbolInfo->ImageBase + SymbolInfo->ImageSize))
|
||||
if (StabEntry->n_value >= SymbolInfo->ImageSize)
|
||||
continue;
|
||||
|
||||
SymbolRelativeAddress = StabEntry->n_value - (ULONG_PTR)SymbolInfo->ImageBase;
|
||||
SymbolRelativeAddress = StabEntry->n_value;
|
||||
if ((SymbolRelativeAddress <= (ULONG_PTR)RelativeAddress) &&
|
||||
(SymbolRelativeAddress > AddrFound))
|
||||
{
|
||||
|
@ -109,9 +107,13 @@ KdbpStabFindEntry(IN PIMAGE_SYMBOL_INFO SymbolInfo,
|
|||
}
|
||||
|
||||
if (BestStabEntry == NULL)
|
||||
{
|
||||
DPRINT("StabEntry not found!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("StabEntry found!\n");
|
||||
}
|
||||
|
||||
return BestStabEntry;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,9 @@ int main(int argc, char* argv[])
|
|||
SYMBOLFILE_HEADER SymbolFileHeader;
|
||||
IMAGE_DOS_HEADER PEDosHeader;
|
||||
IMAGE_FILE_HEADER PEFileHeader;
|
||||
PIMAGE_OPTIONAL_HEADER PEOptHeader;
|
||||
PIMAGE_SECTION_HEADER PESectionHeaders;
|
||||
ULONG ImageBase;
|
||||
PVOID SymbolsBase;
|
||||
ULONG SymbolsLength;
|
||||
PVOID SymbolStringsBase;
|
||||
|
@ -224,6 +226,11 @@ int main(int argc, char* argv[])
|
|||
fseek(in, PEDosHeader.e_lfanew + sizeof(ULONG), SEEK_SET);
|
||||
n_in = fread(&PEFileHeader, 1, sizeof(PEFileHeader), in);
|
||||
|
||||
/* Read optional header */
|
||||
PEOptHeader = malloc(PEFileHeader.SizeOfOptionalHeader);
|
||||
fread ( PEOptHeader, 1, PEFileHeader.SizeOfOptionalHeader, in );
|
||||
ImageBase = PEOptHeader->ImageBase;
|
||||
|
||||
/* Read PE section headers */
|
||||
PESectionHeaders = malloc(PEFileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER));
|
||||
fseek(in, PEDosHeader.e_lfanew + sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER)
|
||||
|
@ -276,6 +283,8 @@ int main(int argc, char* argv[])
|
|||
StabEntry[i].n_type == N_SO)
|
||||
{
|
||||
memmove(&StabEntry[Count], &StabEntry[i], sizeof(STAB_ENTRY));
|
||||
if ( StabEntry[Count].n_value >= ImageBase )
|
||||
StabEntry[Count].n_value -= ImageBase;
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue