Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
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, 02 Oct 2011 08:14:00 -0000	[thread overview]
Message-ID: <CAOhZP9wi+uB80QyjN4Fv9W2ksX19ScBf1Z+Y15LQq0-oq8A0qA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 361 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 chopped off and being
considered as part of file-name. This behavior is inconsistent across
similar set commands like `set logging file' etc. My patch will fix
that problem. Please review this patch and put your comments.

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: application/octet-stream, Size: 2034 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	29 Sep 2011 07:39:45 -0000
@@ -177,15 +177,18 @@ do_setshow_command (char *arg, int from_
 	  }
 	  break;
 	case var_string_noescape:
-	  if (arg == NULL)
-	    arg = "";
-	  if (*(char **) c->var != NULL)
-	    xfree (*(char **) c->var);
-	  *(char **) c->var = xstrdup (arg);
-	  break;
 	case var_optional_filename:
 	  if (arg == NULL)
 	    arg = "";
+	  else
+	    {
+	      /* Clear trailing whitespace.  */
+	      char *ptr = arg + strlen (arg) - 1;
+
+	      while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
+		ptr--;
+	      *(ptr + 1) = '\0';
+	    }
 	  if (*(char **) c->var != NULL)
 	    xfree (*(char **) c->var);
 	  *(char **) c->var = xstrdup (arg);
@@ -193,16 +196,17 @@ do_setshow_command (char *arg, int from_
 	case var_filename:
 	  if (arg == NULL)
 	    error_no_arg (_("filename to set it to."));
+	  else
+	    {
+	      /* Clear trailing whitespace.  */
+	      char *ptr = arg + strlen (arg) - 1;
+
+	      while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
+		ptr--;
+	      *(ptr + 1) = '\0';
+	    }
 	  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 = tilde_expand (arg);
 	  break;
 	case var_boolean:
@@ -419,7 +423,7 @@ cmd_show_list (struct cmd_list_element *
   for (; list != NULL; list = list->next)
     {
       /* If we find a prefix, run its list, prefixing our output by its
-         prefix (with "show " skipped).  */
+	 prefix (with "show " skipped).  */
       if (list->prefixlist && !list->abbrev_flag)
 	{
 	  struct cleanup *optionlist_chain

             reply	other threads:[~2011-10-02  8:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02  8:14 Abhijit Halder [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2011-09-25 10:18 [PATCH] PR-10034 Bad space handling in set remote exec-file command Abhijit Halder
2011-09-26  5:41 ` Abhijit Halder
2011-09-26 16:01   ` Abhijit Halder
2011-09-29  8:27     ` 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=CAOhZP9wi+uB80QyjN4Fv9W2ksX19ScBf1Z+Y15LQq0-oq8A0qA@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