]> granicus.if.org Git - llvm/commitdiff
[llvm-readobj] flush output before crash
authorYuanfang Chen <yuanfang.chen@sony.com>
Fri, 20 Sep 2019 06:33:03 +0000 (06:33 +0000)
committerYuanfang Chen <yuanfang.chen@sony.com>
Fri, 20 Sep 2019 06:33:03 +0000 (06:33 +0000)
Otherwise the output could be lost.

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

tools/llvm-readobj/ARMWinEHPrinter.cpp

index 140a3510a3de39b8ffe27e8aa2b1b19b7203e355..3e026f58871b88f9e64f943251a2f343325a63b6 100644 (file)
@@ -842,8 +842,10 @@ bool Decoder::dumpXDataRecord(const COFFObjectFile &COFF,
 
   if ((int64_t)(Contents.size() - Offset - 4 * HeaderWords(XData) -
                 (XData.E() ? 0 : XData.EpilogueCount() * 4) -
-                (XData.X() ? 8 : 0)) < (int64_t)ByteCodeLength)
+                (XData.X() ? 8 : 0)) < (int64_t)ByteCodeLength) {
+    SW.flush();
     report_fatal_error("Malformed unwind data");
+  }
 
   if (XData.E()) {
     ArrayRef<uint8_t> UC = XData.UnwindByteCode();