Added some debugging support via Linker::dumpSymbols().
This commit is contained in:
@@ -443,6 +443,19 @@ void ElfLinker::defineSymbol(const char *name, unsigned value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debugging support
|
||||||
|
void ElfLinker::dumpSymbols(FILE *fp) const
|
||||||
|
{
|
||||||
|
if (fp == NULL)
|
||||||
|
fp = stdout;
|
||||||
|
for (unsigned ic = 0; ic < nsymbols; ic++)
|
||||||
|
{
|
||||||
|
Symbol *symbol = symbols[ic];
|
||||||
|
fprintf(fp, "%-20s 0x%08lx | %-20s 0x%08lx\n",
|
||||||
|
symbol->name, symbol->offset, symbol->section->name, symbol->section->offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned ElfLinker::getSymbolOffset(const char *name) const
|
unsigned ElfLinker::getSymbolOffset(const char *name) const
|
||||||
{
|
{
|
||||||
assert(frozen);
|
assert(frozen);
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public:
|
|||||||
virtual void relocate();
|
virtual void relocate();
|
||||||
virtual void defineSymbol(const char *name, unsigned value);
|
virtual void defineSymbol(const char *name, unsigned value);
|
||||||
virtual unsigned getSymbolOffset(const char *) const;
|
virtual unsigned getSymbolOffset(const char *) const;
|
||||||
|
virtual void dumpSymbols(FILE *fp=NULL) const;
|
||||||
|
|
||||||
void alignWithByte(unsigned len, upx_byte b);
|
void alignWithByte(unsigned len, upx_byte b);
|
||||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
||||||
|
|||||||
@@ -603,6 +603,7 @@ PackLinuxElf64amd::defineSymbols(Filter const *)
|
|||||||
#undef PAGE_SIZE
|
#undef PAGE_SIZE
|
||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
|
|
||||||
|
linker->dumpSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const
|
static const
|
||||||
|
|||||||
Reference in New Issue
Block a user