From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [pushed] gdbserver: Fixup previous patch
Date: Mon, 21 Mar 2022 17:04:05 +0000 [thread overview]
Message-ID: <1769096a-48a6-f85a-436c-c9826a729933@palves.net> (raw)
In-Reply-To: <20220321164840.2073311-1-pedro@palves.net>
On 2022-03-21 16:48, Pedro Alves wrote:
> @@ -1140,11 +1141,11 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
> An 'S' stop packet always looks like 'Sxx', so all we do
> here is convert the buffer from a T packet to an S packet
> and the avoid adding any extra content by breaking out. */
> - gdb_assert (*buf == 'T');
> - gdb_assert (isxdigit (*(buf + 1)));
> - gdb_assert (isxdigit (*(buf + 2)));
> + gdb_assert (buf_start[0] == 'T');
> + gdb_assert (isxdigit (buf_start[1]));
> + gdb_assert (isxdigit (buf_start[2]));
> *buf = 'S';
> - *(buf + 3) = '\0';
> + buf_start[3] = '\0';
> break;
> }
>
Whoops, the '*buf = 'S';' line is also incorrect, of course. Fixed by this follow up patch.
Pushed to master.
From 4414150d33212f5f395c3bf8a940bccf80ffc508 Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Mon, 21 Mar 2022 16:58:23 +0000
Subject: [PATCH] gdbserver: Fixup previous patch
The previous prepare_resume_reply change missed updating the 'buf'
reference that overwrites the 'T', so if 'buf' was advanced, we'd
still overwrite the wrong character. This fixes it.
Change-Id: Ia8ce433366b85af4e268c1c49e7b447da3130a4d
---
gdbserver/remote-utils.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 0599cc9c4f1..db9b2a66f3c 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -1144,7 +1144,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
gdb_assert (buf_start[0] == 'T');
gdb_assert (isxdigit (buf_start[1]));
gdb_assert (isxdigit (buf_start[2]));
- *buf = 'S';
+ buf_start[0] = 'S';
buf_start[3] = '\0';
break;
}
base-commit: 04f0c03a22135c7eefa47ed99c03e5b3dc9a34e2
--
2.26.2
prev parent reply other threads:[~2022-03-21 17:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 16:48 [ob/pushed] gdbserver: Fix incorrect assertion Pedro Alves
2022-03-21 17:04 ` Pedro Alves [this message]
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=1769096a-48a6-f85a-436c-c9826a729933@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).