From patchwork Tue Mar 14 13:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66365 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35C8E38582BC for ; Tue, 14 Mar 2023 13:05:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35C8E38582BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678799158; bh=yxZAzzp77GfbO4/HrSkurbyKxgrbGYvuVSRLgl2o9n4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nUYbu7rub4P/2jYe0zy8Cw/MLpOkraxYzDMzRUiB7e91jDnltB4iyXxfIVLCdKeQC xKIJFHqUBpwPrRuV40cd+UoHJ92YraJ4n3ISnmiiuLlqgm4gWX6X8cB7Nf7SX2hihd NqRi+6Dder0m150njArdkxf7FJxMdOW7OiDi7F2Y= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id E6C393858D39 for ; Tue, 14 Mar 2023 13:05:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6C393858D39 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EDA67219C6; Tue, 14 Mar 2023 13:05:34 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D7D5313A1B; Tue, 14 Mar 2023 13:05:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sNe8Mx5xEGQibAAAMHmgww (envelope-from ); Tue, 14 Mar 2023 13:05:34 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 2/3] [gdb/dap] Allow Content-Length on separate line Date: Tue, 14 Mar 2023 14:05:34 +0100 Message-Id: <20230314130535.6369-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230314130535.6369-1-tdevries@suse.de> References: <20230314130535.6369-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Currently this DAP input is accepted: ... Content-Length: 54 {"seq": 1, ...}Content-Length: 163 {"seq": 2, ...}Content-Length: 136 ... Also allow: ... Content-Length: 54 {"seq": 1, ...} Content-Length: 163 {"seq": 2, ...} Content-Length: 136 ... which makes command files a bit easier to read. --- gdb/python/lib/gdb/dap/io.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py index 28f4d93ba46..fd9953a7aaa 100644 --- a/gdb/python/lib/gdb/dap/io.py +++ b/gdb/python/lib/gdb/dap/io.py @@ -28,7 +28,10 @@ def read_json(stream): line = stream.readline() line = line.strip() if line == b"": - break + if content_length != None: + break + else: + continue if line.startswith(b"Content-Length:"): line = line[15:].strip() content_length = int(line)