llvm-readobj: Print out address table when dumping COFF delay-import table

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2014-11-13 03:22:54 +00:00
parent 7880ed5d21
commit 08f70b58cb
4 changed files with 53 additions and 5 deletions

View File

@ -1258,6 +1258,20 @@ getDelayImportTable(const delay_import_directory_table_entry *&Result) const {
return object_error::success;
}
std::error_code DelayImportDirectoryEntryRef::
getImportAddress(int AddrIndex, uint64_t &Result) const {
uint32_t RVA = Table[Index].DelayImportAddressTable +
AddrIndex * (OwningObject->is64() ? 8 : 4);
uintptr_t IntPtr = 0;
if (std::error_code EC = OwningObject->getRvaPtr(RVA, IntPtr))
return EC;
if (OwningObject->is64())
Result = *reinterpret_cast<const uint64_t *>(IntPtr);
else
Result = *reinterpret_cast<const uint32_t *>(IntPtr);
return object_error::success;
}
bool ExportDirectoryEntryRef::
operator==(const ExportDirectoryEntryRef &Other) const {
return ExportTable == Other.ExportTable && Index == Other.Index;