[Lldb-commits] [lldb] [lldb-dap] Refactoring IOStream into Transport handler. (PR #130026)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 10 14:47:47 PDT 2025
================
@@ -838,19 +775,16 @@ llvm::Error DAP::Loop() {
StopEventHandlers();
});
while (!disconnecting) {
- llvm::json::Object object;
- lldb_dap::PacketStatus status = GetNextObject(object);
-
- if (status == lldb_dap::PacketStatus::EndOfFile) {
- break;
- }
-
- if (status != lldb_dap::PacketStatus::Success) {
- return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "failed to send packet");
+ auto next = transport.Read(log);
+ if (auto Err = next.takeError()) {
+ // On EOF, simply break out of the loop.
+ std::error_code ec = llvm::errorToErrorCode(std::move(Err));
+ if (ec == Transport::kEOF)
+ break;
+ return llvm::errorCodeToError(ec);
}
----------------
ashgti wrote:
I tweaked the `Transport` class to log any errors it encounters and return `std::nullopt` whenever there is a problem, including EOF.
https://github.com/llvm/llvm-project/pull/130026
More information about the lldb-commits
mailing list