From patchwork Thu Aug 10 18:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 712371 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:baf:b0:129:c516:61db with SMTP id gf47csp810911rwb; Thu, 10 Aug 2023 11:10:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGt7CWrALYPZF1SZtFb1bI2HJyl4N10CdvxCVN861ZI/uaZWzSy/g5LI9R6H8wdluiLUMI8 X-Received: by 2002:a05:620a:d95:b0:767:2ccf:1e2f with SMTP id q21-20020a05620a0d9500b007672ccf1e2fmr3571592qkl.57.1691691004404; Thu, 10 Aug 2023 11:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691691004; cv=none; d=google.com; s=arc-20160816; b=G76YlnT9x3WQky5D6gLdEW6p7HvtrjXcVCEZIWeZxMSpO2uPpr3dioU5/IFDZvd+iw gAjHQpdLqP5Za1Mam/ZOpsV6pQVK4sIyesE9i6Be5iq+OWvmj4bS8JMD8c6y1Bk4pox6 Olh7UuLfVn7/XzHa0RbH23IuJbQ8irT6NWGhbqVR34/OD9EBkGkhcTO52XgJAMRwhiFz wlXvMYE6eJfPMIEf08A7n5SwLSe2PLLfJ0IpmkCX2qkUPkVKifpZ0Ryg6Q+or0nIj/qi q1JoiqU/lI2N1tzTGkxWm1oTsEhPNeg1HZLDt1WastB8oRIEQlhdZRKPa5X1RcKNeOfX Z3lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; fh=fMjFW0U4ix2DqWRTPDBe5AEjoihyZppANpjzrkWv1Uw=; b=W9vh5O0wDQsYWa4BmaV6GOaO1kD9wJqHwg3oBgCcHfWmoi2pKZcka/fWs+iMGEOLEG DgqeodNp7qSj8E0GUXpNgAgJ+r5fNr2dB+ajMzGIpcob5E2lANZoPME6fvSaA2fq3ybz TsSj5kSTlI9rlg8P13J71r/jVeL8ey7eaD42GzKCkwAX7MqsiNdxtit+vIZk456vjCod RrgaB93fxjBv3ZnlTn4PoaabCoryuy5LAgCqjvV1Y5TBv287g6SoUbj2sYUSbNHSY9fG EplX0v53fYeB+CVPbBGM/sSZkQHFHYFVt07TiP9/plJ0B49DaAwrmaLH468Oy1QT83Vl WcSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uyUazPTw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bq44-20020a05620a46ac00b0076ca3f71248si1276076qkb.338.2023.08.10.11.10.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Aug 2023 11:10:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uyUazPTw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUA6A-00021Y-8p; Thu, 10 Aug 2023 14:09:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUA5q-0001xh-62 for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:07 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUA5m-0001yG-Dx for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:05 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bc0d39b52cso8858595ad.2 for ; Thu, 10 Aug 2023 11:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691690937; x=1692295737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; b=uyUazPTwX+ezXYgxtT14sMXI1T3E0DmaYURCuQNjnLKkbsnOXNw+VQtuhzqFqsZ/kU XKynZ9YAX4w4ArelbeOZOhrpfWgpNOiWtgm327pnXgn5+E82AXq788s8z9BqERKZTpxf UGhRnwkQulqdRcb2vL/EG5h9ArKIKdT2ysSwpVCB0SQzSm2EqFCKhMdqYfx/HhQd+eJe br/4NetyfZdtQTLGWG/vqQYiPsN4dyBDkZ2+5pdKcXchoPCxww0Qo/QJ6IaAxKETgMpd lmM4l47gN1mYA4fBU0Bh8qh1b0p51+IeUazo6HLsTqS9GFuVDo9BRCalv5AswzjiXnmj Ly+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691690937; x=1692295737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; b=dwxkBpbwvxSyjPVUGsOnoSmHOGFqVkfKZA9ZeNRXHCESerpLRaQyfhiNxLPwvV4O4Q OuQHy83nE0S8McGJUIIs1DSe8y824MUcs28IfpcES+Qj2sjehxo67Q/8gePwwaw1PWu2 Zmg6HQq9hCS+HSlcgoSbhiZZGrmEGsAY9w5bkrQMs+zRoCnLGT3a33Bn3KXwq3jp3fNb VUPlPge6Ao3MzhclNd24C1LM5W+xlMdQzw6DffZm+Na/L7e17ek1Ff9y5KgLswOn1gFj VoVegp1USK8AmeOMoDnQhpnGJpMTEnynhZteFi8zRjCN3UXFqc4aHwQQycgXJnPfuGKV vtvg== X-Gm-Message-State: AOJu0YxfAU/+GQ3I+XUgIIN+6TuufxtOJBPbczX9M54u7sCc6RWOY7Fc 2yzXB0fRxUiKEisbCiPRqOi2vLC/FmxcuhZBXcA= X-Received: by 2002:a17:903:26d2:b0:1b8:6e2e:78cd with SMTP id jg18-20020a17090326d200b001b86e2e78cdmr2774317plb.40.1691690937362; Thu, 10 Aug 2023 11:08:57 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:9e4d:b830:d4fd:9164]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001bd41b70b65sm2085212pls.49.2023.08.10.11.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:08:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Matheus Tavares Bernardino , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] gdbstub: more fixes for client Ctrl-C handling Date: Thu, 10 Aug 2023 11:08:51 -0700 Message-Id: <20230810180852.54477-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810180852.54477-1-richard.henderson@linaro.org> References: <20230810180852.54477-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée The original fix caused problems with spurious characters on other system emulation. So: - instead of spamming output make the warning a trace point - ensure we only allow a stop reply if it was 0x3 Suggested-by: Matheus Tavares Bernardino Signed-off-by: Alex Bennée Message-Id: <456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_mathbern@quicinc.com> Reviewed-by: Richard Henderson Tested-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230810153640.1879717-8-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- gdbstub/gdbstub.c | 5 +++-- gdbstub/trace-events | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index e74ecc78cc..20b6fe03fb 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -2059,9 +2059,10 @@ void gdb_read_byte(uint8_t ch) * here, but it does expect a stop reply. */ if (ch != 0x03) { - warn_report("gdbstub: client sent packet while target running\n"); + trace_gdbstub_err_unexpected_runpkt(ch); + } else { + gdbserver_state.allow_stop_reply = true; } - gdbserver_state.allow_stop_reply = true; vm_stop(RUN_STATE_PAUSED); } else #endif diff --git a/gdbstub/trace-events b/gdbstub/trace-events index 0c18a4d70a..7bc79a73c4 100644 --- a/gdbstub/trace-events +++ b/gdbstub/trace-events @@ -26,6 +26,7 @@ gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x" gdbstub_err_invalid_rle(void) "got invalid RLE sequence" gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x" gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x" +gdbstub_err_unexpected_runpkt(uint8_t ch) "unexpected packet (0x%02x) while target running" # softmmu.c gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 ""