public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* ui-out question
@ 2003-05-30 17:48 Kris Warkentin
  2003-05-31 11:31 ` Kris Warkentin
  2003-06-01 17:42 ` Andrew Cagney
  0 siblings, 2 replies; 5+ messages in thread
From: Kris Warkentin @ 2003-05-30 17:48 UTC (permalink / raw)
  To: Gdb@Sources.Redhat.Com

I'm seeing that much of the generated text in gdb is using ui-out routines
rather that printf_unfiltered, etc.  Is this the 'state of the art' that
should be used at all times?  That is, should I be converting my output
routines to use that?

The question that arises from that is the whole 'from_tty' argument that
gets passed around everywhere.  Would it make more sense, if we're using the
ui-out routines anyway, to just let them make the decision about whether or
not to display stuff?  Or am I misreading the purpose of from_tty.  If
false, does it mean, "Do NO output", or does it mean, "Be less verbose."?

I'm thinking that the from_tty might be useful for functions that want to
silently call other functions regardless of the overall setting.  Something
like ui_out_push_output_state(0), ui_out_pop_output_state() would work for
temporarily shutting down output in this case which I believe is somewhat
rare.

cheers,

Kris


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ui-out question
  2003-05-30 17:48 ui-out question Kris Warkentin
@ 2003-05-31 11:31 ` Kris Warkentin
  2003-06-01 17:42 ` Andrew Cagney
  1 sibling, 0 replies; 5+ messages in thread
From: Kris Warkentin @ 2003-05-31 11:31 UTC (permalink / raw)
  To: Gdb@Sources.Redhat.Com

> I'm thinking that the from_tty might be useful for functions that want to
> silently call other functions regardless of the overall setting.
Something
> like ui_out_push_output_state(0), ui_out_pop_output_state() would work for
> temporarily shutting down output in this case which I believe is somewhat
> rare.

In re-reading this, I realize that it's not clear what I meant.  The only
time one might need from_tty to be different from what has been used
throughout that session would be if a function had a specific desire to make
a silent call.  Since I believe this to be a rare case (correct me if I'm
wrong), the push/pop thing would shut off the output temporarily,
eliminating the need for passing from_tty about.

cheers,

Kris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ui-out question
  2003-05-30 17:48 ui-out question Kris Warkentin
  2003-05-31 11:31 ` Kris Warkentin
@ 2003-06-01 17:42 ` Andrew Cagney
  2003-06-03 11:35   ` Kris Warkentin
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-06-01 17:42 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: Gdb@Sources.Redhat.Com

> I'm seeing that much of the generated text in gdb is using ui-out routines
> rather that printf_unfiltered, etc.  Is this the 'state of the art' that
> should be used at all times?  That is, should I be converting my output
> routines to use that?

Code should use fprintf_*, or ui_out*.  Which is used is a judgment 
call.  If a routine is just pumping info out to the console than 
fprintf_* are fine.  If the intent is to build up something for an mi 
operation then the ui_out* is best.

> The question that arises from that is the whole 'from_tty' argument that
> gets passed around everywhere.  Would it make more sense, if we're using the
> ui-out routines anyway, to just let them make the decision about whether or
> not to display stuff?  Or am I misreading the purpose of from_tty.  If
> false, does it mean, "Do NO output", or does it mean, "Be less verbose."?

I _think_ from_tty is disabled when --batch (look for "batch" in 
main.c).  It's effect is to modify (supress) the CLI output when in 
batch mode.

> I'm thinking that the from_tty might be useful for functions that want to
> silently call other functions regardless of the overall setting.  Something
> like ui_out_push_output_state(0), ui_out_pop_output_state() would work for
> temporarily shutting down output in this case which I believe is somewhat
> rare.

It could.  Do you have more details of the problem at hand.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ui-out question
  2003-06-01 17:42 ` Andrew Cagney
@ 2003-06-03 11:35   ` Kris Warkentin
  2003-06-22 15:13     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Kris Warkentin @ 2003-06-03 11:35 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Gdb@Sources.Redhat.Com

> > I'm thinking that the from_tty might be useful for functions that want
to
> > silently call other functions regardless of the overall setting.
Something
> > like ui_out_push_output_state(0), ui_out_pop_output_state() would work
for
> > temporarily shutting down output in this case which I believe is
somewhat
> > rare.
>
> It could.  Do you have more details of the problem at hand.

It's not that big of a problem but it's inconvenient.  I'm monkeying around
with our target_create_inferior hook so that it will load a different
executable (set by the user) when the run command is issued.  I'd like to
report that to the user along the lines of:

Starting program: /cygdrive/k/test/float.x86
Remote: /home/kewarken/61/test/float.x86

The only problem is that targ_create_inf doesn't take a from_tty argument so
my only option is just to print it blindly.  I thought it would be nice if
the ui_out functions would automatically censor themselves if need be.

cheers,

Kris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ui-out question
  2003-06-03 11:35   ` Kris Warkentin
@ 2003-06-22 15:13     ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-06-22 15:13 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: Gdb@Sources.Redhat.Com


> It's not that big of a problem but it's inconvenient.  I'm monkeying around
> with our target_create_inferior hook so that it will load a different
> executable (set by the user) when the run command is issued.  I'd like to
> report that to the user along the lines of:
> 
> Starting program: /cygdrive/k/test/float.x86
> Remote: /home/kewarken/61/test/float.x86
> 
> The only problem is that targ_create_inf doesn't take a from_tty argument so
> my only option is just to print it blindly.  I thought it would be nice if
> the ui_out functions would automatically censor themselves if need be.

For the moment, just send it to gdb_stdout using ui_file.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-06-22 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-30 17:48 ui-out question Kris Warkentin
2003-05-31 11:31 ` Kris Warkentin
2003-06-01 17:42 ` Andrew Cagney
2003-06-03 11:35   ` Kris Warkentin
2003-06-22 15:13     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).