Debugger: ElfSymbolLookup: Support specifying the symbol count
Getting the symbol count from the hash table is still an option.
This commit is contained in:
parent
a689b8f22e
commit
22224d83ad
@ -227,8 +227,9 @@ CoreFile::CreateSymbolLookup(const CoreFileImageInfo* imageInfo,
|
||||
|
||||
// create the symbol lookup
|
||||
return ElfSymbolLookup::Create(source, symbolTable, symbolHash, stringTable,
|
||||
symbolTableEntrySize, textDelta, fElfFile.Is64Bit(),
|
||||
fElfFile.IsByteOrderSwapped(), true, _lookup);
|
||||
ElfSymbolLookup::kGetSymbolCountFromHash, symbolTableEntrySize,
|
||||
textDelta, fElfFile.Is64Bit(), fElfFile.IsByteOrderSwapped(), true,
|
||||
_lookup);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,14 +136,14 @@ public:
|
||||
typedef typename ElfClass::Sym ElfSym;
|
||||
|
||||
ElfSymbolLookupImpl(ElfSymbolLookupSource* source, uint64 symbolTable,
|
||||
uint64 symbolHash, uint64 stringTable, uint32 symbolTableEntrySize,
|
||||
uint64 textDelta, bool swappedByteOrder)
|
||||
uint64 symbolHash, uint64 stringTable, uint32 symbolCount,
|
||||
uint32 symbolTableEntrySize, uint64 textDelta, bool swappedByteOrder)
|
||||
:
|
||||
fSource(NULL),
|
||||
fSymbolTable(symbolTable),
|
||||
fSymbolHash(symbolHash),
|
||||
fStringTable(stringTable),
|
||||
fSymbolCount(0),
|
||||
fSymbolCount(symbolCount),
|
||||
fSymbolTableEntrySize(symbolTableEntrySize),
|
||||
fTextDelta(textDelta),
|
||||
fSwappedByteOrder(swappedByteOrder)
|
||||
@ -195,16 +195,18 @@ public:
|
||||
return error;
|
||||
}
|
||||
|
||||
// Read the number of symbols in the symbol table from the hash table
|
||||
// entry 1.
|
||||
uint32 symbolCount;
|
||||
ssize_t bytesRead = fSource->Read(fSymbolHash + 4, &symbolCount, 4);
|
||||
if (bytesRead < 0)
|
||||
return bytesRead;
|
||||
if (bytesRead != 4)
|
||||
return B_IO_ERROR;
|
||||
if (fSymbolCount == kGetSymbolCountFromHash) {
|
||||
// Read the number of symbols in the symbol table from the hash
|
||||
// table entry 1.
|
||||
uint32 symbolCount;
|
||||
ssize_t bytesRead = fSource->Read(fSymbolHash + 4, &symbolCount, 4);
|
||||
if (bytesRead < 0)
|
||||
return bytesRead;
|
||||
if (bytesRead != 4)
|
||||
return B_IO_ERROR;
|
||||
|
||||
fSymbolCount = Get(symbolCount);
|
||||
fSymbolCount = Get(symbolCount);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -322,20 +324,20 @@ ElfSymbolLookup::~ElfSymbolLookup()
|
||||
|
||||
/*static*/ status_t
|
||||
ElfSymbolLookup::Create(ElfSymbolLookupSource* source, uint64 symbolTable,
|
||||
uint64 symbolHash, uint64 stringTable, uint32 symbolTableEntrySize,
|
||||
uint64 textDelta, bool is64Bit, bool swappedByteOrder, bool cacheSource,
|
||||
ElfSymbolLookup*& _lookup)
|
||||
uint64 symbolHash, uint64 stringTable, uint32 symbolCount,
|
||||
uint32 symbolTableEntrySize, uint64 textDelta, bool is64Bit,
|
||||
bool swappedByteOrder, bool cacheSource, ElfSymbolLookup*& _lookup)
|
||||
{
|
||||
// create
|
||||
ElfSymbolLookup* lookup;
|
||||
if (is64Bit) {
|
||||
lookup = new(std::nothrow) ElfSymbolLookupImpl<ElfClass64>(source,
|
||||
symbolTable, symbolHash, stringTable, symbolTableEntrySize,
|
||||
textDelta, swappedByteOrder);
|
||||
symbolTable, symbolHash, stringTable, symbolCount,
|
||||
symbolTableEntrySize, textDelta, swappedByteOrder);
|
||||
} else {
|
||||
lookup = new(std::nothrow) ElfSymbolLookupImpl<ElfClass32>(source,
|
||||
symbolTable, symbolHash, stringTable, symbolTableEntrySize,
|
||||
textDelta, swappedByteOrder);
|
||||
symbolTable, symbolHash, stringTable, symbolCount,
|
||||
symbolTableEntrySize, textDelta, swappedByteOrder);
|
||||
}
|
||||
|
||||
if (lookup == NULL)
|
||||
|
@ -20,12 +20,15 @@ public:
|
||||
|
||||
|
||||
class ElfSymbolLookup {
|
||||
public:
|
||||
static const uint32 kGetSymbolCountFromHash = ~(uint32)0;
|
||||
|
||||
public:
|
||||
virtual ~ElfSymbolLookup();
|
||||
|
||||
static status_t Create(ElfSymbolLookupSource* source,
|
||||
uint64 symbolTable, uint64 symbolHash,
|
||||
uint64 stringTable,
|
||||
uint64 stringTable, uint32 symbolCount,
|
||||
uint32 symbolTableEntrySize,
|
||||
uint64 textDelta, bool is64Bit,
|
||||
bool swappedByteOrder, bool cacheSource,
|
||||
|
Loading…
Reference in New Issue
Block a user