From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
tromey@redhat.com, pedro@codesourcery.com,
gdb-patches@sourceware.org, jan.kratochvil@redhat.com
Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell.
Date: Mon, 08 Aug 2011 11:15:00 -0000 [thread overview]
Message-ID: <CAOhZP9zn21eqYyDB-1Zp4CQ9Ej9texidgErf_KWHE0YPqyyGEw@mail.gmail.com> (raw)
In-Reply-To: <CAOhZP9y2ZA7QXiURPrsm6sp_EH2-Z6cQK_Ze-YF-tHf7ku_k5g@mail.gmail.com>
On Mon, Aug 8, 2011 at 3:30 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> On Sun, Aug 7, 2011 at 3:50 AM, Sergio Durigan Junior
> <sergiodj@redhat.com> wrote:
>> Hi Abhijit,
>>
>> Some minor nits (again).
>>
>> Abhijit Halder <abhijit.k.halder@gmail.com> writes:
>>
>>> +struct pipe_obj
>>> +{
>>> + /* The delimiter to separate out gdb-command and shell-command. This can be
>> ^^
> Sorry, here I am not clear. Do you mean to say I should remove - in
> between gdb and command?
>>
>> Two spaces after the period.
>>
>>> + /* The pex object use to create pipeline between gdb and shell. */
>>
> Here I guess I have put 2 space character between . (period) and */.
>> Some typos:
>>
>> "/*The pex object used to create a pipeline between GDB and shell. */"
>>
>>> + if (*p != '\0') *p++ = '\0';
>>
>> I'm not found of this style. Please, put the assignment on the next
>> line:
> Yes a slip. I am modifying it.
>>
>> if (*p != '\0')
>> *p++ = '\0';
>>
>>
>>> + for (pipe->shell_cmd = "";
>>
>> Sorry, I didn't understand this line. Is this needed? If so, I think
>> it's better if you do `pipe->shell_cmd = NULL'.
>>
>>> + int mismatch = memcmp (p, pipe->dlim, (separator-p));
>>
>> Space between `separator', `-' and `p'. If you want, you can put this
>> `memcmp' call directly on the `if' condition, and then you wouldn't need
>> the braces on the `for'.
>>
> Modifying this part.
>>> +/* Run execute_command for P and FROM_TTY. Write output to the pipe, do not
>> ^^
>> Two spaces after period.
>>
>>> + if (pipe->handle == NULL)
>>> + error (_("Failed to create pipe"));
>>> +
>>> + {
>>> + int status;
>>> + const char *err
>>> + = pex_run (pipe->pex,
>>> + PEX_SEARCH | PEX_LAST | PEX_STDERR_TO_STDOUT,
>>> + argv[0], argv,
>>> + NULL, NULL,
>>> + &status);
>>> + if (err)
>>> + error (_("Failed to execute %s"), argv[0]);
>>> +
>>> + do_cleanups (cleanup);
>>> + }
>>
>> Why the braces?
> Since pex_run returns a const char * I have to assign err at declaration time.
>>
>>> + if (pipe->pex)
>>> + {
>>> + int status;
>>> +
>>> + pex_get_status (pipe->pex, 1, &status);
>>> + pex_free (pipe->pex);
>>
>> Do you really need to call `pex_get_status' here? I'm really asking,
>> because I don't know about pex.
> I tried without using pex_get_status, but pex_free is killing the child
> process without calling waitpid (or equivalent). This is causing an
> immediate exit of shell command. I may be missing something. Let me
> dig out further inside code.
Probably I got the answer here. In pex_free we close the std
descriptors before calling pex_get_status_and_time, hence we do not
get any output. I think we have to call pex_get_status before calling
pex_free.
>>
>> Thanks for your work on this patch.
>>
>> Regards,
>>
>> Sergio.
>>
>
> Finally thank you all for your valuable time, showing me directions
> and through review of the code. Shortly I will come back with
> suggested modifications.
>
> Regards,
> Abhijit Halder
>
next prev parent reply other threads:[~2011-08-08 11:15 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 13:59 Abhijit Halder
2011-07-29 15:29 ` Abhijit Halder
2011-08-02 3:52 ` Sergio Durigan Junior
2011-08-02 6:54 ` Jan Kratochvil
2011-08-02 8:52 ` Abhijit Halder
2011-08-02 15:45 ` Jan Kratochvil
2011-08-02 23:40 ` Sergio Durigan Junior
2011-08-03 7:06 ` Abhijit Halder
2011-08-03 17:46 ` Sergio Durigan Junior
2011-08-04 7:51 ` Abhijit Halder
2011-08-04 8:43 ` Jan Kratochvil
2011-08-05 8:44 ` Abhijit Halder
2011-08-04 9:29 ` Pedro Alves
2011-08-04 14:21 ` Tom Tromey
2011-08-05 15:05 ` Abhijit Halder
2011-08-05 15:08 ` Abhijit Halder
2011-08-05 15:15 ` Eli Zaretskii
2011-08-05 21:11 ` Abhijit Halder
2011-08-06 9:58 ` Abhijit Halder
2011-08-06 22:21 ` Sergio Durigan Junior
2011-08-08 10:01 ` Abhijit Halder
2011-08-08 11:15 ` Abhijit Halder [this message]
2011-08-09 3:03 ` Sergio Durigan Junior
2011-08-09 10:42 ` Abhijit Halder
2011-08-10 17:54 ` Sergio Durigan Junior
2011-08-11 2:51 ` Abhijit Halder
2011-08-11 17:44 ` Sergio Durigan Junior
2011-08-13 20:51 ` Jan Kratochvil
2011-08-13 23:17 ` Abhijit Halder
2011-08-13 23:18 ` Abhijit Halder
2011-08-14 12:14 ` [PATCH] An implementation of pipe to make I/O communication between gdb and shell. [MinGW question] Jan Kratochvil
2011-08-14 14:08 ` Eli Zaretskii
2011-08-14 17:02 ` Jan Kratochvil
2011-08-14 19:42 ` Eli Zaretskii
2011-08-14 19:55 ` Jan Kratochvil
2011-08-16 12:45 ` Abhijit Halder
2011-08-16 13:38 ` Eli Zaretskii
2011-08-16 14:10 ` Abhijit Halder
2011-08-16 17:25 ` Abhijit Halder
2011-08-16 17:30 ` Jan Kratochvil
2011-08-17 8:26 ` Abhijit Halder
2011-08-20 18:52 ` Jan Kratochvil
2011-08-20 19:16 ` Jan Kratochvil
2011-08-23 6:26 ` Abhijit Halder
2011-08-05 7:59 ` [PATCH] An implementation of pipe to make I/O communication between gdb and shell Abhijit Halder
2011-08-05 8:30 ` Jan Kratochvil
2011-08-05 8:52 ` Pedro Alves
2011-08-05 9:09 ` Jan Kratochvil
2011-08-05 9:41 ` Abhijit Halder
2011-08-05 9:45 ` Jan Kratochvil
2011-08-05 10:19 ` Abhijit Halder
2011-08-05 9:57 ` Pedro Alves
2011-08-05 10:25 ` Abhijit Halder
2011-08-05 10:33 ` Abhijit Halder
2011-08-05 10:36 ` Pedro Alves
2011-08-05 10:51 ` Abhijit Halder
2011-08-13 17:24 ` Jan Kratochvil
2011-08-13 18:10 ` Abhijit Halder
2011-08-13 20:58 ` Jan Kratochvil
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=CAOhZP9zn21eqYyDB-1Zp4CQ9Ej9texidgErf_KWHE0YPqyyGEw@mail.gmail.com \
--to=abhijit.k.halder@gmail.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=pedro@codesourcery.com \
--cc=sergiodj@redhat.com \
--cc=tromey@redhat.com \
/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