diff options
author | Doug Evans <dje@google.com> | 2013-03-21 17:37:29 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2013-03-21 17:37:29 +0000 |
commit | 1666412afbfb0047bf0fb2f7e5789494eeed44f8 (patch) | |
tree | 0ec6d427ab940bacc4ef28304ff85cde9e064935 /gdb/cli/cli-setshow.c | |
parent | f9ac4527d2df88424339547974ccd98f555eabd0 (diff) | |
download | gdb-1666412afbfb0047bf0fb2f7e5789494eeed44f8.tar.gz |
New commands "mt set per-command {space,time,symtab} {on,off}".
* NEWS: Add entry.
* event-top.c: #include "maint.h".
* main.c: #include "maint.h".
* maint.c: #include <sys/time.h>, <time.h>, block.h, top.h,
timeval-utils.h, maint.h, cli/cli-setshow.h.
(per_command_time, per_command_space): New static globals.
(per_command_symtab): New static global.
(per_command_setlist, per_command_showlist): New static globals.
(struct cmd_stats): Move here from utils.c.
(set_per_command_time): Renamed from set_display_time in utils.c
and moved here. All callers updated.
(set_per_command_space): Renamed from set_display_space in utils.c
and moved here. All callers updated.
(count_symtabs_and_blocks): New function.
(report_command_stats): Moved here from utils.c. Add support for
printing symtab stats. Only print data if enabled before command
executed.
(make_command_stats_cleanup): Ditto.
(sert_per_command_cmd, show_per_command_cmd): New functions.
(_initialize_maint_cmds): Add new commands
mt set per-command {space,time,symtab} {on,off}.
* maint.h: New file.
* top.c: #include "maint.h".
* utils.c (reset_prompt_for_continue_wait_time): New function.
(get_prompt_for_continue_wait_time): New function.
* utils.h (reset_prompt_for_continue_wait_time): Declare
(get_prompt_for_continue_wait_time): Declare.
(make_command_stats_cleanup): Moved to maint.h.
(set_display_time, set_display_space): Moved to maint.h and renamed
to set_per_command_time, set_per_command_space.
* cli/cli-setshow.c (parse_cli_boolean_value): Renamed from
parse_binary_operation and made non-static. Don't call error,
just return an error marker. All callers updated.
* cli/cli-setshow.h (parse_cli_boolean_value): Declare.
doc/
* gdb.texinfo (Maintenance Commands): Add docs for
"mt set per-command {space,time,symtab} {on,off}".
testsuite/
* gdb.base/maint.exp: Update tests for per-command stats.
Diffstat (limited to 'gdb/cli/cli-setshow.c')
-rw-r--r-- | gdb/cli/cli-setshow.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 3a0e978cadf..95ebbe7b65d 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -29,10 +29,6 @@ #include "cli/cli-cmds.h" #include "cli/cli-setshow.h" -/* Prototypes for local functions. */ - -static int parse_binary_operation (char *); - /* Return true if the change of command parameter should be notified. */ static int @@ -76,8 +72,10 @@ parse_auto_binary_operation (const char *arg) return AUTO_BOOLEAN_AUTO; /* Pacify GCC. */ } -static int -parse_binary_operation (char *arg) +/* See cli-setshow.h. */ + +int +parse_cli_boolean_value (char *arg) { int length; @@ -100,10 +98,7 @@ parse_binary_operation (char *arg) || strncmp (arg, "disable", length) == 0) return 0; else - { - error (_("\"on\" or \"off\" expected.")); - return 0; - } + return -1; } void @@ -248,8 +243,10 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) break; case var_boolean: { - int val = parse_binary_operation (arg); + int val = parse_cli_boolean_value (arg); + if (val < 0) + error (_("\"on\" or \"off\" expected.")); if (val != *(int *) c->var) { *(int *) c->var = val; |