]> granicus.if.org Git - llvm/commitdiff
[codeview] Revert inline line table change of r362264
authorReid Kleckner <rnk@google.com>
Fri, 31 May 2019 22:55:03 +0000 (22:55 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 31 May 2019 22:55:03 +0000 (22:55 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362277 91177308-0d34-0410-b5e6-96231b3b80d8

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

index b2983c11e3423c0fc72cf659e1eb41f6f727f5dc..1a71b542bd06d075ae3ecdf5a2475688952a88c2 100644 (file)
@@ -535,6 +535,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
           unsigned Length = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
           compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
           compressAnnotation(Length, Buffer);
+          LastLabel = Loc.getLabel();
         }
         HaveOpenRange = false;
         continue;
index 3f693ee63294bda346ffb7b6b847e4c3ac0e6b32..a12f6d32ad26427cef487322c727f22b7f15aaac 100644 (file)
 # 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
index e13ad84a8142c896d11975214b252ec673dbd64a..66e8da4fa140d225af3130a2bc436d384140b2de 100644 (file)
@@ -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)
 
index bd6f8f75a8cf6475fd3c59f2febc8f9e40bb6a0a..7a14a2d6002f521173eb5249647304d07dfdc066 100644 (file)
@@ -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)
 
index d3c3f3da9c0696eef46ef239d073ad56610484fa..720d7396601d40bd33af10859286dc59e37d8e6c 100644 (file)
@@ -689,6 +689,10 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, InlineSiteSym &IS) {
       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);