if ((isAArch64 && (DI >= array_lengthof(Ring64))) ||
(!isAArch64 && (DI >= array_lengthof(Ring)))) {
SW.startLine() << format("0x%02x ; Bad opcode!\n",
- Opcodes.data()[Offset]);
+ Opcodes.data()[OI]);
++OI;
break;
}
SW.printNumber("EpilogueStartIndex",
isAArch64 ? ES.EpilogueStartIndexAArch64()
: ES.EpilogueStartIndexARM());
+ if (ES.ES & ~0xffc3ffff)
+ SW.printNumber("ReservedBits", (ES.ES >> 18) & 0xF);
ListScope Opcodes(SW, "Opcodes");
decodeOpcodes(XData.UnwindByteCode(),
+ (XData.E() ? 0 : XData.EpilogueCount())
+ XData.CodeWords();
- ErrorOr<SymbolRef> Symbol =
- getRelocatedSymbol(COFF, Section, HandlerOffset * sizeof(uint32_t));
+ ErrorOr<SymbolRef> Symbol = getRelocatedSymbol(
+ COFF, Section, Offset + HandlerOffset * sizeof(uint32_t));
if (!Symbol)
Symbol = getSymbol(COFF, Address, /*FunctionOnly=*/true);
+ if (!Symbol) {
+ ListScope EHS(SW, "ExceptionHandler");
+ SW.printString("Routine", "(null)");
+ return true;
+ }
Expected<StringRef> Name = Symbol->getName();
if (!Name) {
}
FunctionAddress = *FunctionAddressOrErr;
} else {
- const pe32_header *PEHeader;
- if (COFF.getPE32Header(PEHeader))
- return false;
- FunctionAddress = PEHeader->ImageBase + RF.BeginAddress;
+ FunctionAddress = COFF.getImageBase() + RF.BeginAddress;
}
SW.printString("Function", formatSymbol(FunctionName, FunctionAddress));
}
section_iterator SI = *SIOrErr;
- return dumpXDataRecord(COFF, *SI, FunctionAddress, Address);
+ // FIXME: Do we need to add an offset from the relocation?
+ return dumpXDataRecord(COFF, *SI, FunctionAddress,
+ RF.ExceptionInformationRVA());
} else {
- const pe32_header *PEHeader;
- if (COFF.getPE32Header(PEHeader))
- return false;
-
- uint64_t Address = PEHeader->ImageBase + RF.ExceptionInformationRVA();
+ uint64_t Address = COFF.getImageBase() + RF.ExceptionInformationRVA();
SW.printString("ExceptionRecord", formatSymbol("", Address));
- ErrorOr<SectionRef> Section =
- getSectionContaining(COFF, RF.ExceptionInformationRVA());
+ ErrorOr<SectionRef> Section = getSectionContaining(COFF, Address);
if (!Section)
return false;
- return dumpXDataRecord(COFF, *Section, FunctionAddress,
- RF.ExceptionInformationRVA());
+ return dumpXDataRecord(COFF, *Section, FunctionAddress, Address);
}
}
if (Entry.Flag() == RuntimeFunctionFlag::RFF_Unpacked)
return dumpUnpackedEntry(COFF, Section, Offset, Index, Entry);
if (isAArch64) {
- llvm::errs() << "Packed unwind data not yet supported for ARM64\n";
- return false;
+ SW.startLine() << "Packed unwind data not yet supported for ARM64\n";
+ return true;
}
return dumpPackedEntry(COFF, Section, Offset, Index, Entry);
}