qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Yonggang Luo" <luoyonggang@gmail.com>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	qemu-arm@nongnu.org, qemu-s390x@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Matheus Tavares Bernardino" <quic_mathbern@quicinc.com>
Subject: [PATCH 7/8] gdbstub: more fixes for client Ctrl-C handling
Date: Thu, 10 Aug 2023 16:36:39 +0100	[thread overview]
Message-ID: <20230810153640.1879717-8-alex.bennee@linaro.org> (raw)
In-Reply-To: <20230810153640.1879717-1-alex.bennee@linaro.org>

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 <quic_mathbern@quicinc.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_mathbern@quicinc.com>
---
 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..b383bf8d29 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 (%c) 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 ""
-- 
2.39.2



  parent reply	other threads:[~2023-08-10 15:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 15:36 [PATCH 0/8] some testing and gdbstub fixes Alex Bennée
2023-08-10 15:36 ` [PATCH 1/8] gitlab: enable ccache for many build jobs Alex Bennée
2023-08-10 15:36 ` [PATCH 2/8] tests/docker: cleanup non-verbose output Alex Bennée
2023-08-14  7:59   ` Thomas Huth
2023-08-10 15:36 ` [PATCH 3/8] tests/tcg: remove quoting for info output Alex Bennée
2023-08-10 15:36 ` [PATCH 4/8] tests: remove test-gdbstub.py Alex Bennée
2023-08-10 17:10   ` Richard Henderson
2023-08-10 15:36 ` [PATCH 5/8] tests/tcg: clean-up gdb confirm/pagination settings Alex Bennée
2023-08-10 15:47   ` Philippe Mathieu-Daudé
2023-08-10 17:08   ` Richard Henderson
2023-08-10 15:36 ` [PATCH 6/8] tests/tcg: ensure system-mode gdb tests start stopped Alex Bennée
2023-08-10 15:48   ` Philippe Mathieu-Daudé
2023-08-10 17:08   ` Richard Henderson
2023-08-10 15:36 ` Alex Bennée [this message]
2023-08-10 15:56   ` [PATCH 7/8] gdbstub: more fixes for client Ctrl-C handling Philippe Mathieu-Daudé
2023-08-10 16:26   ` Richard Henderson
2023-08-10 15:36 ` [PATCH 8/8] gdbstub: don't complain about preemptive ACK chars Alex Bennée
2023-08-10 15:50   ` Philippe Mathieu-Daudé
2023-08-10 15:58 ` [PATCH 0/8] some testing and gdbstub fixes Peter Maydell
2023-08-10 16:35   ` Alex Bennée
2023-08-10 16:43     ` Richard Henderson
2023-08-10 17:33       ` Richard Henderson
2023-08-10 16:35   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230810153640.1879717-8-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=bleal@redhat.com \
    --cc=david@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=luoyonggang@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=quic_mathbern@quicinc.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).