diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -1187,7 +1187,8 @@ uint64_t Offset = 0, const BinaryFunction *Function = nullptr, bool PrintMCInst = false, bool PrintMemData = false, - bool PrintRelocations = false) const; + bool PrintRelocations = false, + StringRef Endl = "\n") const; /// Print a range of instructions. template @@ -1195,10 +1196,11 @@ printInstructions(raw_ostream &OS, Itr Begin, Itr End, uint64_t Offset = 0, const BinaryFunction *Function = nullptr, bool PrintMCInst = false, bool PrintMemData = false, - bool PrintRelocations = false) const { + bool PrintRelocations = false, + StringRef Endl = "\n") const { while (Begin != End) { printInstruction(OS, *Begin, Offset, Function, PrintMCInst, PrintMemData, - PrintRelocations); + PrintRelocations, Endl); Offset += computeCodeSize(Begin, Begin + 1); ++Begin; } diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -1643,9 +1643,10 @@ uint64_t Offset, const BinaryFunction *Function, bool PrintMCInst, bool PrintMemData, - bool PrintRelocations) const { + bool PrintRelocations, + StringRef Endl) const { if (MIB->isEHLabel(Instruction)) { - OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << '\n'; + OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << Endl; return; } OS << format(" %08" PRIx64 ": ", Offset); @@ -1654,7 +1655,7 @@ OS << "\t!CFI\t$" << Offset << "\t; "; if (Function) printCFI(OS, *Function->getCFIFor(Instruction)); - OS << "\n"; + OS << Endl; return; } InstPrinter->printInst(&Instruction, 0, "", *STI, OS); @@ -1718,11 +1719,11 @@ Function->printRelocations(OS, Offset, Size); } - OS << "\n"; + OS << Endl; if (PrintMCInst) { Instruction.dump_pretty(OS, InstPrinter.get()); - OS << "\n"; + OS << Endl; } }