llvm-vtabledump: Dump catch/throw exception structures for MS ABI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230713 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-02-27 00:43:58 +00:00
parent 9656d2d2bc
commit a72314cd80
3 changed files with 365 additions and 2 deletions

Binary file not shown.

View File

@ -0,0 +1,258 @@
RUN: llvm-vtabledump %p/Inputs/eh.obj.coff-i386 \
RUN: | FileCheck %s --check-prefix=COFF-I386
COFF-I386: ??_R0?AUA@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AUA@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AUA@@@8[MangledName]: .?AUA@@
COFF-I386: ??_R0?AUB@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AUB@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AUB@@@8[MangledName]: .?AUB@@
COFF-I386: ??_R0?AUC@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AUC@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AUC@@@8[MangledName]: .?AUC@@
COFF-I386: ??_R0?AUM@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AUM@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AUM@@@8[MangledName]: .?AUM@@
COFF-I386: ??_R0?AUS@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AUS@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AUS@@@8[MangledName]: .?AUS@@
COFF-I386: ??_R0?AW4E@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0?AW4E@@@8[AlwaysZero]: 0
COFF-I386: ??_R0?AW4E@@@8[MangledName]: .?AW4E@@
COFF-I386: ??_R0PAUA@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PAUA@@@8[AlwaysZero]: 0
COFF-I386: ??_R0PAUA@@@8[MangledName]: .PAUA@@
COFF-I386: ??_R0PAUC@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PAUC@@@8[AlwaysZero]: 0
COFF-I386: ??_R0PAUC@@@8[MangledName]: .PAUC@@
COFF-I386: ??_R0PAUS@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PAUS@@@8[AlwaysZero]: 0
COFF-I386: ??_R0PAUS@@@8[MangledName]: .PAUS@@
COFF-I386: ??_R0PAW4E@@@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PAW4E@@@8[AlwaysZero]: 0
COFF-I386: ??_R0PAW4E@@@8[MangledName]: .PAW4E@@
COFF-I386: ??_R0PAX@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PAX@8[AlwaysZero]: 0
COFF-I386: ??_R0PAX@8[MangledName]: .PAX
COFF-I386: ??_R0PQS@@H@8[VFPtr]: ??_7type_info@@6B@
COFF-I386: ??_R0PQS@@H@8[AlwaysZero]: 0
COFF-I386: ??_R0PQS@@H@8[MangledName]: .PQS@@H
COFF-I386: __TI1?AW4E@@[Flags]: 0
COFF-I386: __TI1?AW4E@@[Flags.Const]: false
COFF-I386: __TI1?AW4E@@[Flags.Volatile]: false
COFF-I386: __TI1?AW4E@@[CleanupFn]: null
COFF-I386: __TI1?AW4E@@[ForwardCompat]: null
COFF-I386: __TI1?AW4E@@[CatchableTypeArray]: __CTA1?AW4E@@
COFF-I386: __TI1PQS@@H[Flags]: 0
COFF-I386: __TI1PQS@@H[Flags.Const]: false
COFF-I386: __TI1PQS@@H[Flags.Volatile]: false
COFF-I386: __TI1PQS@@H[CleanupFn]: null
COFF-I386: __TI1PQS@@H[ForwardCompat]: null
COFF-I386: __TI1PQS@@H[CatchableTypeArray]: __CTA1PQS@@H
COFF-I386: __TI2CPAW4E@@[Flags]: 1
COFF-I386: __TI2CPAW4E@@[Flags.Const]: true
COFF-I386: __TI2CPAW4E@@[Flags.Volatile]: false
COFF-I386: __TI2CPAW4E@@[CleanupFn]: null
COFF-I386: __TI2CPAW4E@@[ForwardCompat]: null
COFF-I386: __TI2CPAW4E@@[CatchableTypeArray]: __CTA2PAW4E@@
COFF-I386: __TI2CVPAW4E@@[Flags]: 3
COFF-I386: __TI2CVPAW4E@@[Flags.Const]: true
COFF-I386: __TI2CVPAW4E@@[Flags.Volatile]: true
COFF-I386: __TI2CVPAW4E@@[CleanupFn]: null
COFF-I386: __TI2CVPAW4E@@[ForwardCompat]: null
COFF-I386: __TI2CVPAW4E@@[CatchableTypeArray]: __CTA2PAW4E@@
COFF-I386: __TI2PAW4E@@[Flags]: 0
COFF-I386: __TI2PAW4E@@[Flags.Const]: false
COFF-I386: __TI2PAW4E@@[Flags.Volatile]: false
COFF-I386: __TI2PAW4E@@[CleanupFn]: null
COFF-I386: __TI2PAW4E@@[ForwardCompat]: null
COFF-I386: __TI2PAW4E@@[CatchableTypeArray]: __CTA2PAW4E@@
COFF-I386: __TI2PAX[Flags]: 0
COFF-I386: __TI2PAX[Flags.Const]: false
COFF-I386: __TI2PAX[Flags.Volatile]: false
COFF-I386: __TI2PAX[CleanupFn]: null
COFF-I386: __TI2PAX[ForwardCompat]: null
COFF-I386: __TI2PAX[CatchableTypeArray]: __CTA2PAX
COFF-I386: __TI2VPAW4E@@[Flags]: 2
COFF-I386: __TI2VPAW4E@@[Flags.Const]: false
COFF-I386: __TI2VPAW4E@@[Flags.Volatile]: true
COFF-I386: __TI2VPAW4E@@[CleanupFn]: null
COFF-I386: __TI2VPAW4E@@[ForwardCompat]: null
COFF-I386: __TI2VPAW4E@@[CatchableTypeArray]: __CTA2PAW4E@@
COFF-I386: __TI3?AUM@@[Flags]: 0
COFF-I386: __TI3?AUM@@[Flags.Const]: false
COFF-I386: __TI3?AUM@@[Flags.Volatile]: false
COFF-I386: __TI3?AUM@@[CleanupFn]: null
COFF-I386: __TI3?AUM@@[ForwardCompat]: null
COFF-I386: __TI3?AUM@@[CatchableTypeArray]: __CTA3?AUM@@
COFF-I386: __TI3?AUS@@[Flags]: 0
COFF-I386: __TI3?AUS@@[Flags.Const]: false
COFF-I386: __TI3?AUS@@[Flags.Volatile]: false
COFF-I386: __TI3?AUS@@[CleanupFn]: ??1S@@UAE@XZ
COFF-I386: __TI3?AUS@@[ForwardCompat]: null
COFF-I386: __TI3?AUS@@[CatchableTypeArray]: __CTA3?AUS@@
COFF-I386: __TI4CPAUS@@[Flags]: 1
COFF-I386: __TI4CPAUS@@[Flags.Const]: true
COFF-I386: __TI4CPAUS@@[Flags.Volatile]: false
COFF-I386: __TI4CPAUS@@[CleanupFn]: null
COFF-I386: __TI4CPAUS@@[ForwardCompat]: null
COFF-I386: __TI4CPAUS@@[CatchableTypeArray]: __CTA4PAUS@@
COFF-I386: __TI4CVPAUS@@[Flags]: 3
COFF-I386: __TI4CVPAUS@@[Flags.Const]: true
COFF-I386: __TI4CVPAUS@@[Flags.Volatile]: true
COFF-I386: __TI4CVPAUS@@[CleanupFn]: null
COFF-I386: __TI4CVPAUS@@[ForwardCompat]: null
COFF-I386: __TI4CVPAUS@@[CatchableTypeArray]: __CTA4PAUS@@
COFF-I386: __TI4PAUS@@[Flags]: 0
COFF-I386: __TI4PAUS@@[Flags.Const]: false
COFF-I386: __TI4PAUS@@[Flags.Volatile]: false
COFF-I386: __TI4PAUS@@[CleanupFn]: null
COFF-I386: __TI4PAUS@@[ForwardCompat]: null
COFF-I386: __TI4PAUS@@[CatchableTypeArray]: __CTA4PAUS@@
COFF-I386: __TI4VPAUS@@[Flags]: 2
COFF-I386: __TI4VPAUS@@[Flags.Const]: false
COFF-I386: __TI4VPAUS@@[Flags.Volatile]: true
COFF-I386: __TI4VPAUS@@[CleanupFn]: null
COFF-I386: __TI4VPAUS@@[ForwardCompat]: null
COFF-I386: __TI4VPAUS@@[CatchableTypeArray]: __CTA4PAUS@@
COFF-I386: __CTA1?AW4E@@[NumEntries]: 1
COFF-I386: __CTA1?AW4E@@[0]: __CT??_R0?AW4E@@@84
COFF-I386: __CTA1PQS@@H[NumEntries]: 1
COFF-I386: __CTA1PQS@@H[0]: __CT??_R0PQS@@H@88
COFF-I386: __CTA2PAW4E@@[NumEntries]: 2
COFF-I386: __CTA2PAW4E@@[0]: __CT??_R0PAW4E@@@84
COFF-I386: __CTA2PAW4E@@[1]: __CT??_R0PAX@84
COFF-I386: __CTA2PAX[NumEntries]: 2
COFF-I386: __CTA2PAX[0]: __CT??_R0PAX@84
COFF-I386: __CTA2PAX[1]: __CT??_R0PAX@84
COFF-I386: __CTA3?AUM@@[NumEntries]: 3
COFF-I386: __CTA3?AUM@@[0]: __CT??_R0?AUM@@@88
COFF-I386: __CTA3?AUM@@[1]: __CT??_R0?AUA@@@84
COFF-I386: __CTA3?AUM@@[2]: __CT??_R0?AUB@@@844
COFF-I386: __CTA3?AUS@@[NumEntries]: 3
COFF-I386: __CTA3?AUS@@[0]: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16
COFF-I386: __CTA3?AUS@@[1]: __CT??_R0?AUA@@@84044
COFF-I386: __CTA3?AUS@@[2]: __CT??_R0?AUC@@@84048
COFF-I386: __CTA4PAUS@@[NumEntries]: 4
COFF-I386: __CTA4PAUS@@[0]: __CT??_R0PAUS@@@84
COFF-I386: __CTA4PAUS@@[1]: __CT??_R0PAUA@@@84044
COFF-I386: __CTA4PAUS@@[2]: __CT??_R0PAUC@@@84048
COFF-I386: __CTA4PAUS@@[3]: __CT??_R0PAX@84
COFF-I386: __CT??_R0?AUA@@@84[Flags]: 0
COFF-I386: __CT??_R0?AUA@@@84[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUA@@@84[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AUA@@@84[TypeDescriptor]: ??_R0?AUA@@@8
COFF-I386: __CT??_R0?AUA@@@84[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUA@@@84[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0?AUA@@@84[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUA@@@84[SizeOrOffset]: 4
COFF-I386: __CT??_R0?AUA@@@84[CopyCtor]: null
COFF-I386: __CT??_R0?AUA@@@84044[Flags]: 0
COFF-I386: __CT??_R0?AUA@@@84044[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUA@@@84044[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AUA@@@84044[TypeDescriptor]: ??_R0?AUA@@@8
COFF-I386: __CT??_R0?AUA@@@84044[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUA@@@84044[VirtualBasePointerOffset]: 4
COFF-I386: __CT??_R0?AUA@@@84044[VirtualBaseAdjustmentOffset]: 4
COFF-I386: __CT??_R0?AUA@@@84044[SizeOrOffset]: 4
COFF-I386: __CT??_R0?AUA@@@84044[CopyCtor]: null
COFF-I386: __CT??_R0?AUB@@@844[Flags]: 0
COFF-I386: __CT??_R0?AUB@@@844[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUB@@@844[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AUB@@@844[TypeDescriptor]: ??_R0?AUB@@@8
COFF-I386: __CT??_R0?AUB@@@844[NonVirtualBaseAdjustmentOffset]: 4
COFF-I386: __CT??_R0?AUB@@@844[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0?AUB@@@844[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUB@@@844[SizeOrOffset]: 4
COFF-I386: __CT??_R0?AUB@@@844[CopyCtor]: null
COFF-I386: __CT??_R0?AUC@@@84048[Flags]: 0
COFF-I386: __CT??_R0?AUC@@@84048[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUC@@@84048[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AUC@@@84048[TypeDescriptor]: ??_R0?AUC@@@8
COFF-I386: __CT??_R0?AUC@@@84048[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUC@@@84048[VirtualBasePointerOffset]: 4
COFF-I386: __CT??_R0?AUC@@@84048[VirtualBaseAdjustmentOffset]: 8
COFF-I386: __CT??_R0?AUC@@@84048[SizeOrOffset]: 4
COFF-I386: __CT??_R0?AUC@@@84048[CopyCtor]: null
COFF-I386: __CT??_R0?AUM@@@88[Flags]: 0
COFF-I386: __CT??_R0?AUM@@@88[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUM@@@88[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AUM@@@88[TypeDescriptor]: ??_R0?AUM@@@8
COFF-I386: __CT??_R0?AUM@@@88[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUM@@@88[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0?AUM@@@88[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUM@@@88[SizeOrOffset]: 8
COFF-I386: __CT??_R0?AUM@@@88[CopyCtor]: null
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[Flags]: 4
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[Flags.ScalarType]: false
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[Flags.VirtualInheritance]: true
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[TypeDescriptor]: ??_R0?AUS@@@8
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[SizeOrOffset]: 16
COFF-I386: __CT??_R0?AUS@@@8??0S@@QAE@ABU0@@Z16[CopyCtor]: ??0S@@QAE@ABU0@@Z
COFF-I386: __CT??_R0?AW4E@@@84[Flags]: 1
COFF-I386: __CT??_R0?AW4E@@@84[Flags.ScalarType]: true
COFF-I386: __CT??_R0?AW4E@@@84[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0?AW4E@@@84[TypeDescriptor]: ??_R0?AW4E@@@8
COFF-I386: __CT??_R0?AW4E@@@84[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AW4E@@@84[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0?AW4E@@@84[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0?AW4E@@@84[SizeOrOffset]: 4
COFF-I386: __CT??_R0?AW4E@@@84[CopyCtor]: null
COFF-I386: __CT??_R0PAUA@@@84044[Flags]: 1
COFF-I386: __CT??_R0PAUA@@@84044[Flags.ScalarType]: true
COFF-I386: __CT??_R0PAUA@@@84044[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0PAUA@@@84044[TypeDescriptor]: ??_R0PAUA@@@8
COFF-I386: __CT??_R0PAUA@@@84044[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAUA@@@84044[VirtualBasePointerOffset]: 4
COFF-I386: __CT??_R0PAUA@@@84044[VirtualBaseAdjustmentOffset]: 4
COFF-I386: __CT??_R0PAUA@@@84044[SizeOrOffset]: 4
COFF-I386: __CT??_R0PAUA@@@84044[CopyCtor]: null
COFF-I386: __CT??_R0PAUC@@@84048[Flags]: 1
COFF-I386: __CT??_R0PAUC@@@84048[Flags.ScalarType]: true
COFF-I386: __CT??_R0PAUC@@@84048[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0PAUC@@@84048[TypeDescriptor]: ??_R0PAUC@@@8
COFF-I386: __CT??_R0PAUC@@@84048[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAUC@@@84048[VirtualBasePointerOffset]: 4
COFF-I386: __CT??_R0PAUC@@@84048[VirtualBaseAdjustmentOffset]: 8
COFF-I386: __CT??_R0PAUC@@@84048[SizeOrOffset]: 4
COFF-I386: __CT??_R0PAUC@@@84048[CopyCtor]: null
COFF-I386: __CT??_R0PAUS@@@84[Flags]: 5
COFF-I386: __CT??_R0PAUS@@@84[Flags.ScalarType]: true
COFF-I386: __CT??_R0PAUS@@@84[Flags.VirtualInheritance]: true
COFF-I386: __CT??_R0PAUS@@@84[TypeDescriptor]: ??_R0PAUS@@@8
COFF-I386: __CT??_R0PAUS@@@84[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAUS@@@84[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0PAUS@@@84[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAUS@@@84[SizeOrOffset]: 4
COFF-I386: __CT??_R0PAUS@@@84[CopyCtor]: null
COFF-I386: __CT??_R0PAW4E@@@84[Flags]: 1
COFF-I386: __CT??_R0PAW4E@@@84[Flags.ScalarType]: true
COFF-I386: __CT??_R0PAW4E@@@84[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0PAW4E@@@84[TypeDescriptor]: ??_R0PAW4E@@@8
COFF-I386: __CT??_R0PAW4E@@@84[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAW4E@@@84[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0PAW4E@@@84[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAW4E@@@84[SizeOrOffset]: 4
COFF-I386: __CT??_R0PAW4E@@@84[CopyCtor]: null
COFF-I386: __CT??_R0PAX@84[Flags]: 1
COFF-I386: __CT??_R0PAX@84[Flags.ScalarType]: true
COFF-I386: __CT??_R0PAX@84[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0PAX@84[TypeDescriptor]: ??_R0PAX@8
COFF-I386: __CT??_R0PAX@84[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAX@84[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0PAX@84[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PAX@84[SizeOrOffset]: 4
COFF-I386: __CT??_R0PAX@84[CopyCtor]: null
COFF-I386: __CT??_R0PQS@@H@88[Flags]: 1
COFF-I386: __CT??_R0PQS@@H@88[Flags.ScalarType]: true
COFF-I386: __CT??_R0PQS@@H@88[Flags.VirtualInheritance]: false
COFF-I386: __CT??_R0PQS@@H@88[TypeDescriptor]: ??_R0PQS@@H@8
COFF-I386: __CT??_R0PQS@@H@88[NonVirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PQS@@H@88[VirtualBasePointerOffset]: -1
COFF-I386: __CT??_R0PQS@@H@88[VirtualBaseAdjustmentOffset]: 0
COFF-I386: __CT??_R0PQS@@H@88[SizeOrOffset]: 8
COFF-I386: __CT??_R0PQS@@H@88[CopyCtor]: null

View File

@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// Dumps VTables resident in object files and archives. Note, it currently only
// supports MS-ABI style object files.
// Dumps VTables resident in object files and archives.
//
//===----------------------------------------------------------------------===//
@ -153,13 +152,32 @@ static void dumpVTables(const ObjectFile *Obj) {
uint64_t AlwaysZero;
StringRef MangledName;
};
struct ThrowInfo {
uint32_t Flags;
};
struct CatchableTypeArray {
uint32_t NumEntries;
};
struct CatchableType {
uint32_t Flags;
uint32_t NonVirtualBaseAdjustmentOffset;
int32_t VirtualBasePointerOffset;
uint32_t VirtualBaseAdjustmentOffset;
uint32_t SizeOrOffset;
StringRef Symbols[2];
};
std::map<std::pair<StringRef, uint64_t>, StringRef> VFTableEntries;
std::map<std::pair<StringRef, uint64_t>, StringRef> TIEntries;
std::map<std::pair<StringRef, uint64_t>, StringRef> CTAEntries;
std::map<StringRef, ArrayRef<little32_t>> VBTables;
std::map<StringRef, CompleteObjectLocator> COLs;
std::map<StringRef, ClassHierarchyDescriptor> CHDs;
std::map<std::pair<StringRef, uint64_t>, StringRef> BCAEntries;
std::map<StringRef, BaseClassDescriptor> BCDs;
std::map<StringRef, TypeDescriptor> TDs;
std::map<StringRef, ThrowInfo> TIs;
std::map<StringRef, CatchableTypeArray> CTAs;
std::map<StringRef, CatchableType> CTs;
std::map<std::pair<StringRef, uint64_t>, StringRef> VTableSymEntries;
std::map<std::pair<StringRef, uint64_t>, int64_t> VTableDataEntries;
@ -265,6 +283,39 @@ static void dumpVTables(const ObjectFile *Obj) {
return;
TDs[SymName] = TD;
}
// Throw descriptors in the MS-ABI start with '_TI'
else if (SymName.startswith("_TI") || SymName.startswith("__TI")) {
ThrowInfo TI;
TI.Flags = *reinterpret_cast<const little32_t *>(SymContents.data());
collectRelocationOffsets(Obj, Sec, SecAddress, SymAddress, SymSize,
SymName, TIEntries);
TIs[SymName] = TI;
}
// Catchable type arrays in the MS-ABI start with _CTA or __CTA.
else if (SymName.startswith("_CTA") || SymName.startswith("__CTA")) {
CatchableTypeArray CTA;
CTA.NumEntries =
*reinterpret_cast<const little32_t *>(SymContents.data());
collectRelocationOffsets(Obj, Sec, SecAddress, SymAddress, SymSize,
SymName, CTAEntries);
CTAs[SymName] = CTA;
}
// Catchable types in the MS-ABI start with _CT or __CT.
else if (SymName.startswith("_CT") || SymName.startswith("__CT")) {
const little32_t *DataPtr =
reinterpret_cast<const little32_t *>(SymContents.data());
CatchableType CT;
CT.Flags = DataPtr[0];
CT.NonVirtualBaseAdjustmentOffset = DataPtr[2];
CT.VirtualBasePointerOffset = DataPtr[3];
CT.VirtualBaseAdjustmentOffset = DataPtr[4];
CT.SizeOrOffset = DataPtr[5];
StringRef *I = std::begin(CT.Symbols), *E = std::end(CT.Symbols);
if (collectRelocatedSymbols(Obj, Sec, SecAddress, SymAddress, SymSize, I,
E))
return;
CTs[SymName] = CT;
}
// Construction vtables in the Itanium ABI start with '_ZTT' or '__ZTT'.
else if (SymName.startswith("_ZTT") || SymName.startswith("__ZTT")) {
collectRelocationOffsets(Obj, Sec, SecAddress, SymAddress, SymSize,
@ -356,6 +407,60 @@ static void dumpVTables(const ObjectFile *Obj) {
/*UseHexEscapes=*/true)
<< '\n';
}
for (const std::pair<StringRef, ThrowInfo> &TIPair : TIs) {
StringRef TIName = TIPair.first;
const ThrowInfo &TI = TIPair.second;
auto dumpThrowInfoFlag = [&](const char *Name, uint32_t Flag) {
outs() << TIName << "[Flags." << Name
<< "]: " << (TI.Flags & Flag ? "true" : "false") << '\n';
};
auto dumpThrowInfoSymbol = [&](const char *Name, int Offset) {
outs() << TIName << '[' << Name << "]: ";
auto Entry = TIEntries.find(std::make_pair(TIName, Offset));
outs() << (Entry == TIEntries.end() ? "null" : Entry->second) << '\n';
};
outs() << TIName << "[Flags]: " << TI.Flags << '\n';
dumpThrowInfoFlag("Const", 1);
dumpThrowInfoFlag("Volatile", 2);
dumpThrowInfoSymbol("CleanupFn", 4);
dumpThrowInfoSymbol("ForwardCompat", 8);
dumpThrowInfoSymbol("CatchableTypeArray", 12);
}
for (const std::pair<StringRef, CatchableTypeArray> &CTAPair : CTAs) {
StringRef CTAName = CTAPair.first;
const CatchableTypeArray &CTA = CTAPair.second;
outs() << CTAName << "[NumEntries]: " << CTA.NumEntries << '\n';
unsigned Idx = 0;
for (auto I = CTAEntries.lower_bound(std::make_pair(CTAName, 0)),
E = CTAEntries.upper_bound(std::make_pair(CTAName, UINT64_MAX));
I != E; ++I)
outs() << CTAName << '[' << Idx++ << "]: " << I->second << '\n';
}
for (const std::pair<StringRef, CatchableType> &CTPair : CTs) {
StringRef CTName = CTPair.first;
const CatchableType &CT = CTPair.second;
auto dumpCatchableTypeFlag = [&](const char *Name, uint32_t Flag) {
outs() << CTName << "[Flags." << Name
<< "]: " << (CT.Flags & Flag ? "true" : "false") << '\n';
};
outs() << CTName << "[Flags]: " << CT.Flags << '\n';
dumpCatchableTypeFlag("ScalarType", 1);
dumpCatchableTypeFlag("VirtualInheritance", 4);
outs() << CTName << "[TypeDescriptor]: " << CT.Symbols[0] << '\n';
outs() << CTName << "[NonVirtualBaseAdjustmentOffset]: "
<< CT.NonVirtualBaseAdjustmentOffset << '\n';
outs() << CTName
<< "[VirtualBasePointerOffset]: " << CT.VirtualBasePointerOffset
<< '\n';
outs() << CTName << "[VirtualBaseAdjustmentOffset]: "
<< CT.VirtualBaseAdjustmentOffset << '\n';
outs() << CTName << "[SizeOrOffset]: " << CT.SizeOrOffset << '\n';
outs() << CTName
<< "[CopyCtor]: " << (CT.Symbols[1].empty() ? "null" : CT.Symbols[1])
<< '\n';
}
for (const std::pair<std::pair<StringRef, uint64_t>, StringRef> &VTTPair :
VTTEntries) {
StringRef VTTName = VTTPair.first.first;