aboutsummaryrefslogtreecommitdiff
path: root/gdb/maint.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2010-06-26 06:44:47 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2010-06-26 06:44:47 +0000
commit0f3bb72eb70f61f3154fd51eaac173bd6486f3d6 (patch)
tree6e84fe05cdf4fa6017e2b838db95d5f8aae34a80 /gdb/maint.c
parent3c1b3731d34376550c72a8593f9489bb78d2e445 (diff)
downloadgdb-0f3bb72eb70f61f3154fd51eaac173bd6486f3d6.zip
gdb-0f3bb72eb70f61f3154fd51eaac173bd6486f3d6.tar.gz
gdb-0f3bb72eb70f61f3154fd51eaac173bd6486f3d6.tar.bz2
Refactor 'maint time' command statistics.
Consolidate code for displaying per-command time and space statistics to avoid duplication. Piggyback on cleanups so that statistics get printed even when commands terminate as a result of an error. Changelog * gdb/defs.h (make_command_stats_cleanup): Declare. (set_display_time): Declare. (set_display_space): Declare. * gdb/event-top.c (command_handler): Use make_command_stats_cleanup. * gdb/main.c (display_time, display_space): Move definitions to utils.c. (captured_main): Use make_command_stats_cleanup to get start-up statistics. Use set_display_time and set_display_space for processing OPT_STATISTICS case. * gdb/maint.c (maintenance_time_display): Use set_display_time. (maintenance_space_display): Use set_display_space. * gdb/top.c (execute_command): Remove obsolete 'maint time' code. (command_loop): Use make_command_stats_cleanup. * gdb/utils.c (struct cmd_stats): Structure for storing initial time and space usage. (display_time, display_space): Move definitions here from utils.c. (set_display_time): New function. (set_display_space): New function. (make_command_stats_cleanup): New function. (report_command_stats): New auxiliary function for make_command_stats_cleanup. * gdb/testsuite/gdb.gdb/selftest.exp: Adjust expected message for capturing start-up runtime.
Diffstat (limited to 'gdb/maint.c')
-rw-r--r--gdb/maint.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index 1673e93..bdcf900 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -171,23 +171,19 @@ maintenance_demangle (char *args, int from_tty)
static void
maintenance_time_display (char *args, int from_tty)
{
- extern int display_time;
-
if (args == NULL || *args == '\0')
printf_unfiltered (_("\"maintenance time\" takes a numeric argument.\n"));
else
- display_time = strtol (args, NULL, 10);
+ set_display_time (strtol (args, NULL, 10));
}
static void
maintenance_space_display (char *args, int from_tty)
{
- extern int display_space;
-
if (args == NULL || *args == '\0')
printf_unfiltered ("\"maintenance space\" takes a numeric argument.\n");
else
- display_space = strtol (args, NULL, 10);
+ set_display_space (strtol (args, NULL, 10));
}
/* The "maintenance info" command is defined as a prefix, with