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

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 24 10:23:49 PDT 2016


Author: rnk
Date: Fri Jun 24 12:23:49 2016
New Revision: 273691

URL: http://llvm.org/viewvc/llvm-project?rev=273691&view=rev
Log:
[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.

Modified:
    llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
    llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
    llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
    llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
    llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h?rev=273691&r1=273690&r2=273691&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h Fri Jun 24 12:23:49 2016
@@ -465,7 +465,7 @@ enum class BinaryAnnotationsOpCode : uin
 };
 
 // Corresponds to CV_cookietype_e enum.
-enum class FrameCookieKind : uint32_t {
+enum class FrameCookieKind : uint8_t {
   Copy,
   XorStackPointer,
   XorFramePointer,

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h?rev=273691&r1=273690&r2=273691&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h Fri Jun 24 12:23:49 2016
@@ -23,7 +23,7 @@ ArrayRef<EnumEntry<SymbolKind>> getSymbo
 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();

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h?rev=273691&r1=273690&r2=273691&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h Fri Jun 24 12:23:49 2016
@@ -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)

Modified: llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp?rev=273691&r1=273690&r2=273691&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp Fri Jun 24 12:23:49 2016
@@ -101,7 +101,7 @@ static const EnumEntry<uint16_t> LocalFl
     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>> getProcSymF
 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() {

Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=273691&r1=273690&r2=273691&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp Fri Jun 24 12:23:49 2016
@@ -396,6 +396,7 @@ void CVSymbolDumperImpl::visitFrameCooki
   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,




More information about the llvm-commits mailing list