[codeview] Use one byte for S_FRAMECOOKIE CookieKind and add flags byte

We bailed out while printing codeview for an MSVC compiled
SemaExprCXX.cpp that used this record. The MS reference headers look
incorrect here, which is probably why we had this bug. They use a 32-bit
enum as the field type, but the actual record appears to use one byte
for the cookie kind followed by a flags byte.

llvm-svn: 273691
This commit is contained in:
Reid Kleckner 2016-06-24 17:23:49 +00:00
parent e2185fda8f
commit 33848faa5e
5 changed files with 7 additions and 5 deletions

View File

@ -465,7 +465,7 @@ enum class BinaryAnnotationsOpCode : uint32_t {
};
// Corresponds to CV_cookietype_e enum.
enum class FrameCookieKind : uint32_t {
enum class FrameCookieKind : uint8_t {
Copy,
XorStackPointer,
XorFramePointer,

View File

@ -23,7 +23,7 @@ ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames();
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames();
ArrayRef<EnumEntry<uint32_t>> getFrameCookieKindNames();
ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames();
ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames();
ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames();
ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames();

View File

@ -1213,7 +1213,8 @@ public:
struct Hdr {
ulittle32_t CodeOffset;
ulittle16_t Register;
ulittle32_t CookieKind;
uint8_t CookieKind;
uint8_t Flags;
};
FrameCookieSym(uint32_t RecordOffset, const Hdr *H)

View File

@ -101,7 +101,7 @@ static const EnumEntry<uint16_t> LocalFlags[] = {
CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic),
};
static const EnumEntry<uint32_t> FrameCookieKinds[] = {
static const EnumEntry<uint8_t> FrameCookieKinds[] = {
CV_ENUM_CLASS_ENT(FrameCookieKind, Copy),
CV_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer),
CV_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer),
@ -334,7 +334,7 @@ ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() {
return makeArrayRef(LocalFlags);
}
ArrayRef<EnumEntry<uint32_t>> getFrameCookieKindNames() {
ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() {
return makeArrayRef(FrameCookieKinds);
}
ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() {

View File

@ -396,6 +396,7 @@ void CVSymbolDumperImpl::visitFrameCookieSym(SymbolKind Kind,
W.printHex("Register", FrameCookie.Header.Register);
W.printEnum("CookieKind", uint16_t(FrameCookie.Header.CookieKind),
getFrameCookieKindNames());
W.printHex("Flags", FrameCookie.Header.Flags);
}
void CVSymbolDumperImpl::visitFrameProcSym(SymbolKind Kind,