From dbd26fe0b6ac8b33067817ef770d82afbe268c05 Mon Sep 17 00:00:00 2001 From: James Henderson Date: Tue, 26 May 2020 11:53:24 +0100 Subject: [DebugInfo] Print non-verbose output at some point as verbose output Verbose and non-verbose parsing of .debug_line produced their output at different points in the program. The most obvious impact of this was that error messages were produced at different times, but it also potentially reduced what clients could do by customising the stream or warning/error handlers. This change makes the two variants consistent by printing non-verbose output inline, the same as verbose output. Testing of the error messages has been modified to check the messages always appear in the same location to illustrate the behaviour. Reviewed by: JDevlieghere, dblaikie, MaskRay, labath Differential Revision: https://reviews.llvm.org/D80989 --- llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp') diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index 3dad185..c73b04d 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -1271,7 +1271,8 @@ TEST_F(DebugLineBasicFixture, ParserPrintsStandardOpcodesWhenRequested) { DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); std::string Output; raw_string_ostream OS(Output); - Parser.parseNext(RecordRecoverable, RecordUnrecoverable, &OS); + Parser.parseNext(RecordRecoverable, RecordUnrecoverable, &OS, + /*Verbose=*/true); OS.flush(); EXPECT_FALSE(Recoverable); @@ -1323,13 +1324,16 @@ struct TruncatedExtendedOpcodeFixture DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); std::string Output; raw_string_ostream OS(Output); - Parser.parseNext(RecordRecoverable, RecordUnrecoverable, &OS); + Parser.parseNext(RecordRecoverable, RecordUnrecoverable, &OS, + /*Verbose=*/true); OS.flush(); StringRef LinePrefix = "0x0000002e: 00 "; StringRef OutputRef(Output); StringRef OutputToCheck = OutputRef.split(LinePrefix).second; - EXPECT_EQ((ExpectedOutput + "\n").str(), OutputToCheck); + // Each extended opcode ends with a new line and then the table ends with an + // additional blank line. + EXPECT_EQ((ExpectedOutput + "\n\n").str(), OutputToCheck); EXPECT_THAT_ERROR(std::move(Recoverable), FailedWithMessage(ExpectedErr.str())); } -- cgit v1.1