From: Stefan Hajnoczi <stefanha@gmail.com>
To: Doug Gale <doug16k@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] gdbstub: implement remote debugging protocol escapes for command receive
Date: Mon, 8 May 2017 10:01:10 +0100 [thread overview]
Message-ID: <CAJSP0QV++8rKxPrAXv1GWrwtiK4CNZCv+QoSzYkG-1LYF2SEgw@mail.gmail.com> (raw)
In-Reply-To: <CAEfK_44TpSJVi7JULXMRLftM5BFUJs=vHSxKG3h=YOUjQz1t+g@mail.gmail.com>
On Sun, May 7, 2017 at 4:26 PM, Doug Gale <doug16k@gmail.com> wrote:
> On Fri, May 5, 2017 at 10:45 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Tue, May 02, 2017 at 10:32:40AM -0400, Doug Gale wrote:
>>> + } else {
>>> + /* decode repeat length */
>>> + int repeat = (unsigned char)ch - ' ' + 3;
>>> + if (s->line_buf_index + repeat >= sizeof(s->line_buf) - 1) {
>>> + /* that many repeats would overrun the command buffer */
>>> +#ifdef DEBUG_GDB
>>> + printf("gdbstub command buffer overrun,"
>>> + " dropping command\n");
>>> +#endif
>>> + s->state = RS_IDLE;
>>> + } else if (s->line_buf_index <= 2) {
>>
>> Why s->line_buf_index <= 2? I expected s->line_buf_index < 1 since we
>> just need 1 character to clone for run-length decoding.
>
> Yes, on second thought, <= 2 is off by one. [0] would be the '$', [1]
> would be the repeated character, and [2] would be the '*'.
'$' and '*' are not placed into line_buf[] and do not increment
line_buf_index. They don't count.
I think the correct condition is line_buf_index < 1 so that the
following input from the GDB documentation parses: "$0* " -> "0000".
https://sourceware.org/gdb/onlinedocs/gdb/Overview.html
next prev parent reply other threads:[~2017-05-08 9:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-01 17:16 [Qemu-devel] [PATCH] gdbstub: implement remote debugging protocol escapes for command receive Doug Gale
2017-05-02 14:22 ` Stefan Hajnoczi
2017-05-02 14:32 ` Doug Gale
2017-05-05 14:45 ` Stefan Hajnoczi
2017-05-07 15:27 ` Doug Gale
2017-05-07 18:59 ` Doug Gale
[not found] ` <CAEfK_44TpSJVi7JULXMRLftM5BFUJs=vHSxKG3h=YOUjQz1t+g@mail.gmail.com>
2017-05-08 9:01 ` Stefan Hajnoczi [this message]
2017-05-08 13:16 ` Doug Gale
2017-05-08 13:32 ` Stefan Hajnoczi
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=CAJSP0QV++8rKxPrAXv1GWrwtiK4CNZCv+QoSzYkG-1LYF2SEgw@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=doug16k@gmail.com \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).