* [RFA] cli-out.c new function
@ 2002-11-05 15:26 Elena Zannoni
2002-11-05 19:25 ` Daniel Jacobowitz
2002-11-05 23:00 ` Eli Zaretskii
0 siblings, 2 replies; 7+ messages in thread
From: Elena Zannoni @ 2002-11-05 15:26 UTC (permalink / raw)
To: fnasser, gdb-patches
This function sets the stream of the uiout file to the given
parameter. It is used in the interpreter work. Maybe Keith or JimI
can explain this a bit better, but switching interpreters can change
the gdb_sdout.
/* gdb_stdout could change between the time cli_uiout was initialized
and now. Since we're probably using a different interpreter which has
a new ui_file for gdb_stdout, use that one instead of the default.
It is important that it gets reset everytime, since the user could
set gdb to use a different interpreter. */
old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
Elena
2002-11-05 Elena Zannoni <ezannoni@redhat.com>
From Jim Ingham <jingham@apple.com> and
Keith Seitz <keiths@redhat.com>:
* cli-out.h (cli_out_set_stream): Export.
* cli-out.c (cli_out_set_stream): New function.
Index: cli-out.c
===================================================================
RCS file: /cvs/uberbaum/gdb/cli-out.c,v
retrieving revision 1.14
diff -u -p -r1.14 cli-out.c
--- cli-out.c 19 Mar 2002 02:51:04 -0000 1.14
+++ cli-out.c 5 Nov 2002 23:24:34 -0000
@@ -365,6 +365,16 @@ cli_out_new (struct ui_file *stream)
return ui_out_new (&cli_ui_out_impl, data, flags);
}
+/* Set the stream for UIOUT to the given ui_file STREAM. */
+struct ui_file *
+cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
+{
+ struct ui_out_data *data = ui_out_data (uiout);
+ struct ui_file *old = data->stream;
+ data->stream = stream;
+ return old;
+}
+
/* standard gdb initialization hook */
void
_initialize_cli_out (void)
Index: cli-out.h
===================================================================
RCS file: /cvs/uberbaum/gdb/cli-out.h,v
retrieving revision 1.2
diff -u -p -r1.2 cli-out.h
--- cli-out.h 6 Mar 2001 08:21:06 -0000 1.2
+++ cli-out.h 5 Nov 2002 23:24:34 -0000
@@ -23,5 +23,7 @@
#define CLI_OUT_H
extern struct ui_out *cli_out_new (struct ui_file *stream);
+extern struct ui_file *cli_out_set_stream (struct ui_out *uiout,
+ struct ui_file *stream);
#endif
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-05 15:26 [RFA] cli-out.c new function Elena Zannoni
@ 2002-11-05 19:25 ` Daniel Jacobowitz
2002-11-06 1:08 ` Pierre Muller
2002-11-05 23:00 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2002-11-05 19:25 UTC (permalink / raw)
To: Elena Zannoni; +Cc: fnasser, gdb-patches
On Tue, Nov 05, 2002 at 06:22:37PM -0500, Elena Zannoni wrote:
>
> This function sets the stream of the uiout file to the given
> parameter. It is used in the interpreter work. Maybe Keith or JimI
> can explain this a bit better, but switching interpreters can change
> the gdb_sdout.
>
>
> /* gdb_stdout could change between the time cli_uiout was initialized
> and now. Since we're probably using a different interpreter which has
> a new ui_file for gdb_stdout, use that one instead of the default.
>
> It is important that it gets reset everytime, since the user could
> set gdb to use a different interpreter. */
> old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
Something (two things actually) very much like this were discussed and
we never reached agreement on them. See my patch for a `tee' command
and file redirection; and something similar from Pierre. A couple of
months ago now.
The current version is kind of hokey, since it only works with the CLI.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-05 15:26 [RFA] cli-out.c new function Elena Zannoni
2002-11-05 19:25 ` Daniel Jacobowitz
@ 2002-11-05 23:00 ` Eli Zaretskii
2002-11-06 11:26 ` Elena Zannoni
1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2002-11-05 23:00 UTC (permalink / raw)
To: Elena Zannoni; +Cc: fnasser, gdb-patches
On Tue, 5 Nov 2002, Elena Zannoni wrote:
> This function sets the stream of the uiout file to the given
> parameter.
Should it be mentioned in gdbint.texinfo?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-05 19:25 ` Daniel Jacobowitz
@ 2002-11-06 1:08 ` Pierre Muller
2002-11-06 10:16 ` Elena Zannoni
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Muller @ 2002-11-06 1:08 UTC (permalink / raw)
To: Daniel Jacobowitz, Elena Zannoni, Andrew Cagney; +Cc: fnasser, gdb-patches
At 04:26 06/11/2002, Daniel Jacobowitz wrote:
>On Tue, Nov 05, 2002 at 06:22:37PM -0500, Elena Zannoni wrote:
>>
>> This function sets the stream of the uiout file to the given
>> parameter. It is used in the interpreter work. Maybe Keith or JimI
>> can explain this a bit better, but switching interpreters can change
>> the gdb_sdout.
>>
>>
>> /* gdb_stdout could change between the time cli_uiout was initialized
>> and now. Since we're probably using a different interpreter which has
>> a new ui_file for gdb_stdout, use that one instead of the default.
>>
>> It is important that it gets reset everytime, since the user could
>> set gdb to use a different interpreter. */
>> old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
>
>Something (two things actually) very much like this were discussed and
>we never reached agreement on them. See my patch for a `tee' command
>and file redirection; and something similar from Pierre. A couple of
>months ago now.
See the following threads:
[RFC/RFA] avoid spurious Watchpoint X output on cygwin native target.
http://sources.redhat.com/ml/gdb-patches/2002-07/msg00323.html
and
RFA: Make cli-out follow gdb_stdout
http://sources.redhat.com/ml/gdb-patches/2002-07/msg00366.html
as well as
(which is a different thread, probably because I didn't use Relpy...)
http://sources.redhat.com/ml/gdb-patches/2002-08/msg00549.html
But honestly, I don't know if the this new function solves the
problem...
IMHO, standard gdb sources should not have to worry at all about
the possible fact that an interpreter is present...
The fact that standard gdb code redirects gdb_stdout (or gdb_stderr)
should be respected by any interpreter, no?
Thus I still think that the best solution is the double pointer one...
but Andrew is stronly opposed to that solution....
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-06 1:08 ` Pierre Muller
@ 2002-11-06 10:16 ` Elena Zannoni
2002-11-06 11:16 ` Elena Zannoni
0 siblings, 1 reply; 7+ messages in thread
From: Elena Zannoni @ 2002-11-06 10:16 UTC (permalink / raw)
To: Pierre Muller
Cc: Daniel Jacobowitz, Elena Zannoni, Andrew Cagney, fnasser, gdb-patches
Pierre Muller writes:
> At 04:26 06/11/2002, Daniel Jacobowitz wrote:
> >On Tue, Nov 05, 2002 at 06:22:37PM -0500, Elena Zannoni wrote:
> >>
> >> This function sets the stream of the uiout file to the given
> >> parameter. It is used in the interpreter work. Maybe Keith or JimI
> >> can explain this a bit better, but switching interpreters can change
> >> the gdb_sdout.
> >>
> >>
> >> /* gdb_stdout could change between the time cli_uiout was initialized
> >> and now. Since we're probably using a different interpreter which has
> >> a new ui_file for gdb_stdout, use that one instead of the default.
> >>
> >> It is important that it gets reset everytime, since the user could
> >> set gdb to use a different interpreter. */
> >> old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
> >
> >Something (two things actually) very much like this were discussed and
> >we never reached agreement on them. See my patch for a `tee' command
> >and file redirection; and something similar from Pierre. A couple of
> >months ago now.
>
> See the following threads:
> [RFC/RFA] avoid spurious Watchpoint X output on cygwin native target.
> http://sources.redhat.com/ml/gdb-patches/2002-07/msg00323.html
>
> and
> RFA: Make cli-out follow gdb_stdout
> http://sources.redhat.com/ml/gdb-patches/2002-07/msg00366.html
> as well as
> (which is a different thread, probably because I didn't use Relpy...)
> http://sources.redhat.com/ml/gdb-patches/2002-08/msg00549.html
>
> But honestly, I don't know if the this new function solves the
> problem...
Ulgh, we seem to have hit a wall. I see that the same concerns about
your solutions apply to this one. I guess that in my case using
catch_exception should work, because the current code does this:
old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
result = safe_execute_command (cli_uiout, command_str, 1);
cli_out_set_stream (cli_uiout, old_stream);
I could change that into a catch_exceptions call. In fact,
safe_execute_command *IS* a wrapper around catch_exceptions already.
The general problem is not solved, however.
Elena
> IMHO, standard gdb sources should not have to worry at all about
> the possible fact that an interpreter is present...
> The fact that standard gdb code redirects gdb_stdout (or gdb_stderr)
> should be respected by any interpreter, no?
> Thus I still think that the best solution is the double pointer one...
> but Andrew is stronly opposed to that solution....
>
>
> Pierre Muller
> Institut Charles Sadron
> 6,rue Boussingault
> F 67083 STRASBOURG CEDEX (France)
> mailto:muller@ics.u-strasbg.fr
> Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-06 10:16 ` Elena Zannoni
@ 2002-11-06 11:16 ` Elena Zannoni
0 siblings, 0 replies; 7+ messages in thread
From: Elena Zannoni @ 2002-11-06 11:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Pierre Muller, Daniel Jacobowitz, Andrew Cagney, fnasser
Elena Zannoni writes:
> >
> > See the following threads:
> > [RFC/RFA] avoid spurious Watchpoint X output on cygwin native target.
> > http://sources.redhat.com/ml/gdb-patches/2002-07/msg00323.html
> >
> > and
> > RFA: Make cli-out follow gdb_stdout
> > http://sources.redhat.com/ml/gdb-patches/2002-07/msg00366.html
> > as well as
> > (which is a different thread, probably because I didn't use Relpy...)
> > http://sources.redhat.com/ml/gdb-patches/2002-08/msg00549.html
> >
> > But honestly, I don't know if the this new function solves the
> > problem...
>
> Ulgh, we seem to have hit a wall. I see that the same concerns about
> your solutions apply to this one. I guess that in my case using
> catch_exception should work, because the current code does this:
>
> old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
> result = safe_execute_command (cli_uiout, command_str, 1);
> cli_out_set_stream (cli_uiout, old_stream);
>
> I could change that into a catch_exceptions call. In fact,
> safe_execute_command *IS* a wrapper around catch_exceptions already.
>
> The general problem is not solved, however.
>
> Elena
OK, I think I figured out how to solve the problem in my case.
BTW, is there a cli_out_free kind of function?
Elena
Index: cli-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/Attic/cli-interp.c,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 cli-interp.c
--- cli-interp.c 4 Nov 2002 23:27:31 -0000 1.1.2.10
+++ cli-interp.c 6 Nov 2002 19:10:31 -0000
@@ -39,8 +39,7 @@ static struct gdb_interpreter *cli_inter
/* Longjmp-safe wrapper for "execute_command" */
static int do_captured_execute_command (struct ui_out *uiout, void *data);
-static enum gdb_rc safe_execute_command (struct ui_out *uiout, char *command,
- int from_tty);
+static enum gdb_rc safe_execute_command (char *command, int from_tty);
struct captured_execute_command_args
{
char *command;
@@ -83,19 +82,7 @@ cli_interpreter_display_prompt_p (void)
static int
cli_interpreter_exec (void *data, char *command_str)
{
- int result;
- struct ui_file *old_stream;
-
- /* gdb_stdout could change between the time cli_uiout was initialized
- and now. Since we're probably using a different interpreter which has
- a new ui_file for gdb_stdout, use that one instead of the default.
-
- It is important that it gets reset everytime, since the user could
- set gdb to use a different interpreter. */
- old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
- result = safe_execute_command (cli_uiout, command_str, 1);
- cli_out_set_stream (cli_uiout, old_stream);
- return result;
+ return safe_execute_command (command_str, 1);
}
static int
@@ -108,12 +95,20 @@ do_captured_execute_command (struct ui_o
}
static enum gdb_rc
-safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
+safe_execute_command (char *command, int from_tty)
{
+ /* gdb_stdout could change between the time cli_uiout was
+ initialized and now. Since we're probably using a different
+ interpreter which has a new ui_file for gdb_stdout, use that one
+ instead of the default. Catch exception will execute with
+ command_uiout as output stream. It is important that it gets
+ reset everytime, since the user could set gdb to use a different
+ interpreter. */
+ struct ui_out *command_uiout = cli_out_new (gdb_stdout);
struct captured_execute_command_args args;
args.command = command;
args.from_tty = from_tty;
- return catch_exceptions (uiout, do_captured_execute_command, &args,
+ return catch_exceptions (command_uiout, do_captured_execute_command, &args,
NULL, RETURN_MASK_ALL);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] cli-out.c new function
2002-11-05 23:00 ` Eli Zaretskii
@ 2002-11-06 11:26 ` Elena Zannoni
0 siblings, 0 replies; 7+ messages in thread
From: Elena Zannoni @ 2002-11-06 11:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Elena Zannoni, fnasser, gdb-patches
Eli Zaretskii writes:
>
> On Tue, 5 Nov 2002, Elena Zannoni wrote:
>
> > This function sets the stream of the uiout file to the given
> > parameter.
>
> Should it be mentioned in gdbint.texinfo?
Hmmm I think that the patch will be withdrawn....
Elena
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-11-06 19:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05 15:26 [RFA] cli-out.c new function Elena Zannoni
2002-11-05 19:25 ` Daniel Jacobowitz
2002-11-06 1:08 ` Pierre Muller
2002-11-06 10:16 ` Elena Zannoni
2002-11-06 11:16 ` Elena Zannoni
2002-11-05 23:00 ` Eli Zaretskii
2002-11-06 11:26 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox