public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Luis Machado <luisgpm@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix qRcmd error code parsing Date: Tue, 5 Apr 2022 07:44:38 +0000 (GMT) [thread overview] Message-ID: <20220405074438.635043858D37@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d5ce6f2dcacf9809fb7a29a69c4b98e0320c3c94 commit d5ce6f2dcacf9809fb7a29a69c4b98e0320c3c94 Author: Luis Machado <luis.machado@arm.com> Date: Thu Mar 31 16:45:53 2022 +0100 Fix qRcmd error code parsing Someone at IRC spotted a bug in qRcmd handling. This looks like an oversight or it is that way for historical reasons. The code in gdb/remote.c:remote_target::rcmd uses isdigit instead of isxdigit. One could argue that we are expecting decimal numbers, but further below we use fromhex (). Update the function to use isxdigit instead and also update the documentation. I see there are lots of other cases of undocumented number format for error messages, mostly described as NN instead of nn. For now I'll just update this particular function. Diff: --- gdb/doc/gdb.texinfo | 3 ++- gdb/remote.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index b7da5e1173b..e50618fe9ab 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -42157,7 +42157,8 @@ A command response with no output. @item @var{OUTPUT} A command response with the hex encoded output string @var{OUTPUT}. @item E @var{NN} -Indicate a badly formed request. +Indicate a badly formed request. The error number @var{NN} is given as +hex digits. @item @w{} An empty reply indicates that @samp{qRcmd} is not recognized. @end table diff --git a/gdb/remote.c b/gdb/remote.c index 122f204fe12..b002f041734 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11565,7 +11565,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf) if (strcmp (buf, "OK") == 0) break; if (strlen (buf) == 3 && buf[0] == 'E' - && isdigit (buf[1]) && isdigit (buf[2])) + && isxdigit (buf[1]) && isxdigit (buf[2])) { error (_("Protocol error with Rcmd")); }
reply other threads:[~2022-04-05 7:44 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220405074438.635043858D37@sourceware.org \ --to=luisgpm@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).