[Haiku-commits] r27682 - haiku/trunk/src/kits/debug
bonefish at BerliOS
bonefish at mail.berlios.de
Mon Sep 22 01:38:46 CEST 2008
Author: bonefish
Date: 2008-09-22 01:38:46 +0200 (Mon, 22 Sep 2008)
New Revision: 27682
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=27682&view=rev
Modified:
haiku/trunk/src/kits/debug/SymbolLookup.cpp
haiku/trunk/src/kits/debug/SymbolLookup.h
Log:
Also store the string table size for an image. This helps to improve the
symbol name len check.
Modified: haiku/trunk/src/kits/debug/SymbolLookup.cpp
===================================================================
--- haiku/trunk/src/kits/debug/SymbolLookup.cpp 2008-09-21 22:31:18 UTC (rev 27681)
+++ haiku/trunk/src/kits/debug/SymbolLookup.cpp 2008-09-21 23:38:46 UTC (rev 27682)
@@ -200,7 +200,8 @@
fLoadDelta(0),
fSymbolTable(NULL),
fStringTable(NULL),
- fSymbolCount(0)
+ fSymbolCount(0),
+ fStringTableSize(0)
{
}
@@ -300,6 +301,7 @@
= (const Elf32_Sym*)(fMappedFile + sectionHeader->sh_offset);
fStringTable = (const char*)(fMappedFile + stringHeader.sh_offset);
fSymbolCount = sectionHeader->sh_size / sizeof(Elf32_Sym);
+ fStringTableSize = stringHeader.sh_size;
return B_OK;
}
@@ -392,12 +394,12 @@
ImageFile::_SymbolNameLen(const char* symbolName) const
{
if (symbolName == NULL || (addr_t)symbolName < (addr_t)fStringTable
- || (addr_t)symbolName >= (addr_t)fMappedFile + fFileSize) {
+ || (addr_t)symbolName >= (addr_t)fStringTable + fStringTableSize) {
return 0;
}
return strnlen(symbolName,
- (addr_t)fMappedFile + fFileSize - (addr_t)symbolName);
+ (addr_t)fStringTable + fStringTableSize - (addr_t)symbolName);
}
Modified: haiku/trunk/src/kits/debug/SymbolLookup.h
===================================================================
--- haiku/trunk/src/kits/debug/SymbolLookup.h 2008-09-21 22:31:18 UTC (rev 27681)
+++ haiku/trunk/src/kits/debug/SymbolLookup.h 2008-09-21 23:38:46 UTC (rev 27682)
@@ -152,6 +152,7 @@
const Elf32_Sym* fSymbolTable;
const char* fStringTable;
int32 fSymbolCount;
+ size_t fStringTableSize;
};
More information about the Haiku-commits
mailing list