1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Added some debugging support via Linker::dumpSymbols().

This commit is contained in:
Markus F.X.J. Oberhumer 2006-10-03 23:48:19 +02:00
parent 8f7f1135df
commit a61457b422
3 changed files with 15 additions and 0 deletions

View File

@ -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
{
assert(frozen);

View File

@ -86,6 +86,7 @@ public:
virtual void relocate();
virtual void defineSymbol(const char *name, unsigned value);
virtual unsigned getSymbolOffset(const char *) const;
virtual void dumpSymbols(FILE *fp=NULL) const;
void alignWithByte(unsigned len, upx_byte b);
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }

View File

@ -603,6 +603,7 @@ PackLinuxElf64amd::defineSymbols(Filter const *)
#undef PAGE_SIZE
#undef PAGE_MASK
linker->dumpSymbols();
}
static const