[llvm] r362277 - [codeview] Revert inline line table change of r362264

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 15:55:03 PDT 2019


Author: rnk
Date: Fri May 31 15:55:03 2019
New Revision: 362277

URL: http://llvm.org/viewvc/llvm-project?rev=362277&view=rev
Log:
[codeview] Revert inline line table change of r362264

Testing with debuggers shows that our previous behavior was correct.
The reason I thought MSVC did things differently is that MSVC prefers to
use the 0xB combined code offset and code length update opcode when
inline sites are discontiguous.

Keep the test changes, and update the llvm-pdbutil inline line table
dumper to account for this new interpretation of the opcodes.

Modified:
    llvm/trunk/lib/MC/MCCodeView.cpp
    llvm/trunk/test/MC/COFF/cv-inline-linetable-unlikely.s
    llvm/trunk/test/MC/COFF/cv-loc-unreachable-2.s
    llvm/trunk/test/MC/COFF/cv-loc-unreachable.s
    llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp

Modified: llvm/trunk/lib/MC/MCCodeView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCCodeView.cpp?rev=362277&r1=362276&r2=362277&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCCodeView.cpp (original)
+++ llvm/trunk/lib/MC/MCCodeView.cpp Fri May 31 15:55:03 2019
@@ -535,6 +535,7 @@ void CodeViewContext::encodeInlineLineTa
           unsigned Length = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
           compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
           compressAnnotation(Length, Buffer);
+          LastLabel = Loc.getLabel();
         }
         HaveOpenRange = false;
         continue;

Modified: llvm/trunk/test/MC/COFF/cv-inline-linetable-unlikely.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/cv-inline-linetable-unlikely.s?rev=362277&r1=362276&r2=362277&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/cv-inline-linetable-unlikely.s (original)
+++ llvm/trunk/test/MC/COFF/cv-inline-linetable-unlikely.s Fri May 31 15:55:03 2019
@@ -36,12 +36,11 @@
 # ASM-NEXT:       2b: 0f 0b                         ud2
 #  End inline loc
 
-# CODEVIEW:      S_INLINESITE [size = 26]
+# CODEVIEW:      S_INLINESITE [size = 24]
 # CODEVIEW-NEXT: inlinee = 0x1002 (f), parent = 0, end = 0
 # CODEVIEW-NEXT:   0B2E      code 0xE (+0xE) line 1 (+1)
 # CODEVIEW-NEXT:   0409      code end 0x17 (+0x9)
-# CODEVIEW-NEXT:   0602      line 2 (+1)
-# CODEVIEW-NEXT:   0318      code 0x26 (+0x18)
+# CODEVIEW-NEXT:   0B2F      code 0x26 (+0xF) line 2 (+1)
 # CODEVIEW-NEXT:   0407      code end 0x2D (+0x7)
 
 	.text

Modified: llvm/trunk/test/MC/COFF/cv-loc-unreachable-2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/cv-loc-unreachable-2.s?rev=362277&r1=362276&r2=362277&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/cv-loc-unreachable-2.s (original)
+++ llvm/trunk/test/MC/COFF/cv-loc-unreachable-2.s Fri May 31 15:55:03 2019
@@ -25,7 +25,7 @@
 # CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0
 # CODEVIEW-NEXT:   0602      line 1 (+1)
 # CODEVIEW-NEXT:   0409      code end 0x9 (+0x9)
-# CODEVIEW-NEXT:   0B2A      code 0xA (+0xA) line 2 (+1)
+# CODEVIEW-NEXT:   0B21      code 0xA (+0x1) line 2 (+1)
 # CODEVIEW-NEXT:   0B28      code 0x12 (+0x8) line 3 (+1)
 # CODEVIEW-NEXT:   0400      code end 0x12 (+0x0)
 

Modified: llvm/trunk/test/MC/COFF/cv-loc-unreachable.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/cv-loc-unreachable.s?rev=362277&r1=362276&r2=362277&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/cv-loc-unreachable.s (original)
+++ llvm/trunk/test/MC/COFF/cv-loc-unreachable.s Fri May 31 15:55:03 2019
@@ -36,7 +36,7 @@
 # CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0
 # CODEVIEW-NEXT:   0602      line 1 (+1)
 # CODEVIEW-NEXT:   0409      code end 0x9 (+0x9)
-# CODEVIEW-NEXT:   0B2A      code 0xA (+0xA) line 2 (+1)
+# CODEVIEW-NEXT:   0B21      code 0xA (+0x1) line 2 (+1)
 # CODEVIEW-NEXT:   0B28      code 0x12 (+0x8) line 3 (+1)
 # CODEVIEW-NEXT:   0400      code end 0x12 (+0x0)
 

Modified: llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp?rev=362277&r1=362276&r2=362277&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp Fri May 31 15:55:03 2019
@@ -689,6 +689,10 @@ Error MinimalSymbolDumper::visitKnownRec
       break;
     case BinaryAnnotationsOpCode::ChangeCodeLength:
       formatCodeLength(Annot.U1);
+      // Apparently this annotation updates the code offset. It's hard to make
+      // MSVC produce this opcode, but clang uses it, and debuggers seem to use
+      // this interpretation.
+      CodeOffset += Annot.U1;
       break;
     case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
       formatCodeOffset(Annot.U1);




More information about the llvm-commits mailing list