From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Pedro Alves <pedro@codesourcery.com>,
gdb-patches@sourceware.org,
Sergio Durigan Junior <sergiodj@redhat.com>,
Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell.
Date: Sat, 13 Aug 2011 18:10:00 -0000 [thread overview]
Message-ID: <CAOhZP9xtKxZPgG68vTZOVnR3SORnu7aiZ_f_C7npOGASKFesfQ@mail.gmail.com> (raw)
In-Reply-To: <20110813172342.GA22058@host1.jankratochvil.net>
On Sat, Aug 13, 2011 at 10:53 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Fri, 05 Aug 2011 11:41:09 +0200, Abhijit Halder wrote:
>> On Fri, Aug 5, 2011 at 1:59 PM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
>> > I would prefer to also redirect gdb_stderr, gdb_stdlog, gdb_stdtarg and
>> > gdb_stdtargerr like set_logging_redirect does. This is like if one
>> > uses |& instead of | . I understand someone may have a different opinion.
>> > In such case there even may be some option of the command pipe for it.
>> I understand your point here, but this will break out very basic
>> assumption that delimiter is single character.
>> Can we skip this at this point? Or simply we can redirect gdb_stderror
>> to pipe as in most of the cases that will be equivalent to gdb_stdout.
>> (My understanding was that the error from gdb can be captured anyway
>> by error logging mechanism, the use-case of using pipe, I believe, is
>> when the gdb output is huge and one wants to process that huge
>> output.) Please suggest.
>
> The reason for redirecting also errors I find that when you type:
>
> $ ls /tmp bar|less
>
> you happilly see the content of /tmp but the message
>
> ls: cannot access bar: No such file or directory
>
> gets completely lost. This is why I find |& safer for normal use cases.
>
> (One can argue also the other way, that standard shell pipe | also does not
> automatically redirect stderr, though.)
>
I have also redirected the gdb_stderr to pipe.
+ fp = stdio_fileopen (pipe->handle);
+ make_cleanup_ui_file_delete (fp);
+ make_cleanup_restore_ui_file (&gdb_stdout);
+ make_cleanup_restore_ui_file (&gdb_stderr);
+ make_cleanup_restore_ui_file (&gdb_stdlog);
+ make_cleanup_restore_ui_file (&gdb_stdtarg);
+ make_cleanup_restore_ui_file (&gdb_stdtargerr);
+
+ if (ui_out_redirect (uiout, fp) < 0)
+ warning (_("Current output protocol does not support redirection"));
+ else
+ make_cleanup_ui_out_redirect_pop (uiout);
+
+ gdb_stdout = fp;
+ gdb_stderr = fp;
+ gdb_stdlog = fp;
+ gdb_stdtarg = fp;
+ gdb_stdtargerr = fp;
+ execute_command (pipe->gdb_cmd, from_tty);
But the error is still coming on screen.
(gdb) pipe | print xxx | vim -
Vim: Reading from stdin...
No symbol table is loaded. Use the "file" command.
(gdb) pipe | print 2 | vim -
Vim: Reading from stdin...
(gdb)
>
> Thanks,
> Jan
>
next prev parent reply other threads:[~2011-08-13 18:10 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
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 [this message]
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=CAOhZP9xtKxZPgG68vTZOVnR3SORnu7aiZ_f_C7npOGASKFesfQ@mail.gmail.com \
--to=abhijit.k.halder@gmail.com \
--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