aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-09-24 21:10:45 -0600
committerTom Tromey <tom@tromey.com>2016-10-21 14:17:35 -0600
commit1e3b796d58ac3c4396e1739f44a0a41de6335eef (patch)
tree110d08e5fa5cab3124dc0d6eb2864ad7675d9563 /gdb/event-top.c
parent6fc31fc73b577fce960730d87ead9a25df6c2653 (diff)
downloadgdb-1e3b796d58ac3c4396e1739f44a0a41de6335eef.zip
gdb-1e3b796d58ac3c4396e1739f44a0a41de6335eef.tar.gz
gdb-1e3b796d58ac3c4396e1739f44a0a41de6335eef.tar.bz2
Change command stats reporting to use class
This removes make_command_stats_cleanup in favor of an RAII class. The patch is reasonably straightforward, but keeping the same semantics without excessive reindentation required splitting captured_main in two. 2016-10-21 Tom Tromey <tom@tromey.com> * maint.h (scoped_command_stats): New class. (make_command_stats_cleanup): Don't declare. * maint.c (struct cmd_stats): Remove. (~scoped_command_stats): Rename from report_command_stats. Now a destructor. (scoped_command_stats): Rename from make_command_stats_cleanup. Now a constructor. * main.c (captured_main_1): New function. Use scoped_command_stats. (captured_main): Call captured_main_1. * event-top.c (command_handler): Use scoped_command_stats.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 9b0ccbc..acf8474 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -562,13 +562,12 @@ void
command_handler (char *command)
{
struct ui *ui = current_ui;
- struct cleanup *stat_chain;
char *c;
if (ui->instream == ui->stdin_stream)
reinitialize_more_filter ();
- stat_chain = make_command_stats_cleanup (1);
+ scoped_command_stats stat_reporter (true);
/* Do not execute commented lines. */
for (c = command; *c == ' ' || *c == '\t'; c++)
@@ -580,8 +579,6 @@ command_handler (char *command)
/* Do any commands attached to breakpoint we stopped at. */
bpstat_do_actions ();
}
-
- do_cleanups (stat_chain);
}
/* Append RL, an input line returned by readline or one of its