mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
llvm-objdump/COFF: Print SEH table addresses.
SEH table addresses are VA in COFF file. In this patch we convert VA to RVA before printing it, because dumpbin prints them as RVAs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -381,15 +381,21 @@ error_code COFFObjectFile::initSymbolTablePtr() {
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
// Returns the file offset for the given VA.
|
||||
error_code COFFObjectFile::getVaPtr(uint32_t Addr, uintptr_t &Res) const {
|
||||
uint32_t ImageBase = PE32Header ? PE32Header->ImageBase : PE32PlusHeader->ImageBase;
|
||||
return getRvaPtr(Addr - ImageBase, Res);
|
||||
}
|
||||
|
||||
// Returns the file offset for the given RVA.
|
||||
error_code COFFObjectFile::getRvaPtr(uint32_t Rva, uintptr_t &Res) const {
|
||||
error_code COFFObjectFile::getRvaPtr(uint32_t Addr, uintptr_t &Res) const {
|
||||
for (section_iterator I = section_begin(), E = section_end(); I != E;
|
||||
++I) {
|
||||
const coff_section *Section = getCOFFSection(I);
|
||||
uint32_t SectionStart = Section->VirtualAddress;
|
||||
uint32_t SectionEnd = Section->VirtualAddress + Section->VirtualSize;
|
||||
if (SectionStart <= Rva && Rva < SectionEnd) {
|
||||
uint32_t Offset = Rva - SectionStart;
|
||||
if (SectionStart <= Addr && Addr < SectionEnd) {
|
||||
uint32_t Offset = Addr - SectionStart;
|
||||
Res = uintptr_t(base()) + Section->PointerToRawData + Offset;
|
||||
return object_error::success;
|
||||
}
|
||||
|
Reference in New Issue
Block a user