aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli-out.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-12-16 18:18:40 +0100
committerTom de Vries <tdevries@suse.de>2020-12-16 18:18:40 +0100
commit2f2287318b33ddf855a692fcc191f6b25caf4644 (patch)
treea4ed9af701499455d0eb659a29e912117b565a1e /gdb/cli-out.h
parent1e61189d0ab0905178002120eb0a380858ed6dc0 (diff)
downloadgdb-2f2287318b33ddf855a692fcc191f6b25caf4644.zip
gdb-2f2287318b33ddf855a692fcc191f6b25caf4644.tar.gz
gdb-2f2287318b33ddf855a692fcc191f6b25caf4644.tar.bz2
[gdb/cli] Add a progress meter
Add a progress meter. It's not used anywhere yet. gdb/ChangeLog: 2020-12-16 Tom Tromey <tom@tromey.com> Tom Tromey <tromey@redhat.com> Tom de Vries <tdevries@suse.de> * utils.h (get_chars_per_line): Declare. * utils.c (get_chars_per_line): New function. (fputs_maybe_filtered): Handle '\r'. * ui-out.h (ui_out::progress_meter): New class. (ui_out::progress, ui_out::do_progress_start) (ui_out::do_progress_notify, ui_out::do_progress_end): New methods. * ui-out.c (do_progress_end) (make_cleanup_ui_out_progress_begin_end, ui_out_progress): New functions. * mi/mi-out.h (mi_ui_out::do_progress_start) (mi_ui_out::do_progress_notify, mi_ui_out::do_progress_end): New methods. * cli-out.h (struct cli_ui_out) <do_progress_start, do_progress_notify, do_progress_end>: New methods. <enum meter_stat, struct cli_progress_info>: New. <m_meters>: New member. * cli-out.c (cli_ui_out::do_progress_start) (cli_ui_out::do_progress_notify, cli_ui_out::do_progress_end): New methods.
Diffstat (limited to 'gdb/cli-out.h')
-rw-r--r--gdb/cli-out.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index 84e957c..5f55554 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -71,6 +71,10 @@ protected:
virtual void do_flush () override;
virtual void do_redirect (struct ui_file *outstream) override;
+ virtual void do_progress_start (const std::string &, bool) override;
+ virtual void do_progress_notify (double) override;
+ virtual void do_progress_end () override;
+
bool suppress_output ()
{ return m_suppress_output; }
@@ -80,6 +84,33 @@ private:
std::vector<ui_file *> m_streams;
bool m_suppress_output;
+
+ /* Represents the printing state of a progress meter. */
+ enum meter_state
+ {
+ /* Printing will start with the next output. */
+ START,
+ /* Printing has already started. */
+ WORKING,
+ /* Progress printing has already started. */
+ PROGRESS,
+ /* Printing should not be done. */
+ NO_PRINT
+ };
+
+ /* The state of a recent progress meter. */
+ struct cli_progress_info
+ {
+ /* The current state. */
+ enum meter_state printing;
+ /* The name to print. */
+ std::string name;
+ /* The last notification value. */
+ double last_value;
+ };
+
+ /* Stack of progress meters. */
+ std::vector<cli_progress_info> m_meters;
};
extern cli_ui_out *cli_out_new (struct ui_file *stream);