Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Abhijit Halder <abhijit.k.halder@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb output pipelining to shell
Date: Sat, 16 Jul 2011 14:49:00 -0000	[thread overview]
Message-ID: <834o2my2uj.fsf@gnu.org> (raw)
In-Reply-To: <CAOhZP9yENbwxY5e_VTwtWffqbZztCxemayS+eU7YH8hYQwPrDA@mail.gmail.com>

> Date: Sat, 16 Jul 2011 14:12:35 +0530
> From: Abhijit Halder <abhijit.k.halder@gmail.com>
> 
> I have implemented a feature which will allow one to pass the output
> of any gdb command to the shell for further processing.

Thanks.

If this is accepted, we will need a corresponding addition to the
manual.

> +      for (cpos = spos; (cpos = memchr (cpos, '"', (sh_cmd-cpos))) != NULL; cpos++)
> +        quote_cnt++;
> +      spos = (sh_cmd + 1);
> +      if ((quote_cnt % 2) == 0 || (sh_cmd = strchr (spos, '|')) == NULL)
> +        break;

I'm not sure I understand this (comments would be helpful).  Are you
assuming that quote characters `"' in shell commands cannot be
escaped, e.g. with a backslash?  And what about quoting with a single
quote character ("'")?

> +    if (*cpos != '{')
> +      return NULL;
> +
> +    *cpos = ' ';
> +
> +    cpos = epos;
> +    while (isspace(*cpos))
> +      cpos--;
> +
> +    if (*cpos != '}')
> +      return NULL;

What is this magic about {...} that you are removing?  Again, comments
could help.

> +
> +    *cpos = ' ';
> +    }
> +
> +  if (sh_cmd)
> +    *sh_cmd++ = '\0';
> +
> +  return sh_cmd;

This butchers the string passed to execute_command.  Are you sure all
the callers of execute_command can safely deal with that?  What if the
string is a constant string, for example?


  reply	other threads:[~2011-07-16  9:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-16 10:09 Abhijit Halder
2011-07-16 14:49 ` Eli Zaretskii [this message]
2011-07-16 18:06   ` Abhijit Halder
2011-07-17 20:26     ` Abhijit Halder
2011-07-18 18:23       ` Abhijit Halder
2011-07-18 20:15         ` Abhijit Halder
2011-07-19  8:50           ` Abhijit Halder
2011-07-19 10:31             ` Abhijit Halder
     [not found]               ` <CAOhZP9yZ01y8KY9BEjWvtXnJw1jEjTZxPcTNK6h+A9dn-WZWwQ@mail.gmail.com>
2011-07-20 13:17                 ` 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=834o2my2uj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=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