summaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2010-06-26 06:44:46 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2010-06-26 06:44:46 +0000
commit21877d889fab20d373169bd4aa79001e28e793a0 (patch)
tree7a6f55dd808bcf0bff18d0a8ae503c9d112c4f6a /gdb/defs.h
parent1063b4f43e24d344806244852745336c3014183f (diff)
downloadgdb-21877d889fab20d373169bd4aa79001e28e793a0.tar.gz
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/defs.h')
-rw-r--r--gdb/defs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index a727a4b7ca6..9b2decd879e 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -307,6 +307,10 @@ extern int subset_compare (char *, char *);
extern char *safe_strerror (int);
+extern void set_display_time (int);
+
+extern void set_display_space (int);
+
#define ALL_CLEANUPS ((struct cleanup *)0)
extern void do_cleanups (struct cleanup *);
@@ -369,6 +373,8 @@ extern void free_current_contents (void *);
extern void null_cleanup (void *);
+extern struct cleanup *make_command_stats_cleanup (int);
+
extern int myread (int, char *, int);
extern int query (const char *, ...) ATTRIBUTE_PRINTF (1, 2);