From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: [PATCH] PR-10034 Bad space handling in set remote exec-file command
Date: Sun, 25 Sep 2011 10:18:00 -0000 [thread overview]
Message-ID: <CAOhZP9zCT7iSs9Owi1+eBVHDrGLO8fPj4m62LSwa6FV-g-3FhA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 710 bytes --]
Hi,
In the set remote exec-file command if we provide space at the end of
the file-name the space is not being cleared. This behaviour is
inconsistent across similar set commands like set logging file etc. My
patch will fix that behaviour. Please review this patch.
Further, I have found that there is a function in cli/cli-utils.c
called remove_trailing_whitespace that never used. In many times we
have removed trailing spaces and for that inline code is written. In
my next patch I am planning to modify the remove_trailing_whitespace
function and use it whenever possible in that. Since that patch will
be relevant to current fix I am proposing, I have mentioned here that
point.
Thanks,
Abhijit Halder
[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 181 bytes --]
2011-09-13 Abhijit Halder <abhijit.k.halder@gmail.com>
Fix PR remote/10034:
* cli/cli-setshow.c (do_setshow_command): Clear trailing whitespace
from command argument strings.
[-- Attachment #3: gdb-space-issue.patch --]
[-- Type: text/x-patch, Size: 1167 bytes --]
Index: gdb/cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.46
diff -a -p -u -r1.46 cli-setshow.c
--- gdb/cli/cli-setshow.c 4 Aug 2011 19:10:13 -0000 1.46
+++ gdb/cli/cli-setshow.c 25 Sep 2011 08:28:52 -0000
@@ -181,6 +181,14 @@ do_setshow_command (char *arg, int from_
arg = "";
if (*(char **) c->var != NULL)
xfree (*(char **) c->var);
+ {
+ /* Clear trailing whitespace of string. */
+ char *ptr = arg + strlen (arg) - 1;
+
+ while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
+ ptr--;
+ *(ptr + 1) = '\0';
+ }
*(char **) c->var = xstrdup (arg);
break;
case var_optional_filename:
@@ -188,6 +196,14 @@ do_setshow_command (char *arg, int from_
arg = "";
if (*(char **) c->var != NULL)
xfree (*(char **) c->var);
+ {
+ /* Clear trailing whitespace of filename. */
+ char *ptr = arg + strlen (arg) - 1;
+
+ while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
+ ptr--;
+ *(ptr + 1) = '\0';
+ }
*(char **) c->var = xstrdup (arg);
break;
case var_filename:
next reply other threads:[~2011-09-25 8:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-25 10:18 Abhijit Halder [this message]
2011-09-26 5:41 ` Abhijit Halder
2011-09-26 16:01 ` Abhijit Halder
2011-09-29 8:27 ` Abhijit Halder
2011-10-02 8:14 [PATCH] PR-10034 Bad space handling in `set remote exec-file' command Abhijit Halder
2011-10-04 15:51 ` Tom Tromey
2011-10-05 4:19 ` Abhijit Halder
2011-10-05 14:01 ` Tom Tromey
2011-10-14 9:53 ` Abhijit Halder
2011-10-14 11:47 ` Abhijit Halder
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=CAOhZP9zCT7iSs9Owi1+eBVHDrGLO8fPj4m62LSwa6FV-g-3FhA@mail.gmail.com \
--to=abhijit.k.halder@gmail.com \
--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