================ @@ -311,10 +309,22 @@ void DAP::SendOutput(OutputType o, const llvm::StringRef output) { category = "telemetry"; break; } - body.try_emplace("category", category); - EmplaceSafeString(body, "output", output.str()); - event.try_emplace("body", std::move(body)); - SendJSON(llvm::json::Value(std::move(event))); + + // Send each line of output as an individual event, including the newline if + // present. + ::size_t idx = 0; + do { + ::size_t end = output.find('\n', idx); + if (end == llvm::StringRef::npos) + end = output.size() - 1; + llvm::json::Object event(CreateEventObject("output")); + llvm::json::Object body; + body.try_emplace("category", category); + EmplaceSafeString(body, "output", output.slice(idx, end + 1).str()); + event.try_emplace("body", std::move(body)); + SendJSON(llvm::json::Value(std::move(event))); + idx = end + 1; + } while (idx < output.size()); ---------------- walter-erquinigo wrote:
What about increasing the buffers in https://github.com/llvm/llvm-project/issues/105444 and https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/lldb-dap.cpp#L402 to a really big number, like 10k bytes? That wouldn't really affect the footprint of the debugger but for sure will prevent issues with split lines in 99.999% of the cases without having to rewrite the functionalities behind these buffeers. https://github.com/llvm/llvm-project/pull/105456 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits