[Lldb-commits] [lldb] [lldb][gdb-remote] Forward client terminal size to lldb-server (PR #201141)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 3 02:42:54 PDT 2026
================
@@ -963,6 +966,38 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDERR(
return SendErrorResponse(17);
}
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerCommon::Handle_QSetSTDIOWindowSize(
+ StringExtractorGDBRemote &packet) {
+ // Format: "QSetSTDIOWindowSize:cols=N;rows=N"
+ packet.SetFilePos(::strlen("QSetSTDIOWindowSize:"));
+ llvm::StringRef body = packet.GetStringRef().substr(packet.GetFilePos());
+
+ uint16_t cols = 0;
+ uint16_t rows = 0;
+ llvm::SmallVector<llvm::StringRef, 2> fields;
+ body.split(fields, ';');
+ for (llvm::StringRef field : fields) {
+ auto [key, value] = field.split('=');
+ uint16_t *dest;
+ if (key == "cols")
+ dest = &cols;
+ else if (key == "rows")
+ dest = &rows;
+ else
+ continue;
+ unsigned parsed = 0;
+ if (value.empty() || value.getAsInteger(10, parsed) || parsed > UINT16_MAX)
+ continue;
+ *dest = static_cast<uint16_t>(parsed);
+ }
+ if (cols == 0 || rows == 0)
+ return SendErrorResponse(28);
+
+ m_process_launch_info.SetSTDIOWindowSize(cols, rows);
+ return SendOKResponse();
----------------
DavidSpickett wrote:
Oh I see now, the response to this packet is sent before we try to use the dimensions. So the most we can say about an ok response is that the server will try to use it.
You can ignore most of what I said above then. Though I think you should make it doubly clear that it's setting dimensions to be used later.
https://github.com/llvm/llvm-project/pull/201141
More information about the lldb-commits
mailing list