diff options
author | Pedro Alves <palves@redhat.com> | 2019-07-03 16:57:48 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-07-03 16:58:30 +0100 |
commit | 41fc454c915057d9c5536617370c5eb2a5f71323 (patch) | |
tree | e4c833f477121ca24ce4b069c857374eb2603437 /gdb/testsuite/ChangeLog | |
parent | b2b2a2159876fa8db57ce017b949cafc6f1a32df (diff) | |
download | gdb-41fc454c915057d9c5536617370c5eb2a5f71323.zip gdb-41fc454c915057d9c5536617370c5eb2a5f71323.tar.gz gdb-41fc454c915057d9c5536617370c5eb2a5f71323.tar.bz2 |
Make gdb::option::complete_options save processed arguments too
Currently, gdb::option::complete_options just discards any processed
option argument, because no completer needs that data.
When completing "pipe -d XXX gdbcmd XXX" however, the completer needs
to know about -d's argument (XXX), in order to know where input is
already past the gdb command and the delimiter.
In this commit, the fix for that is the factoring out of the
save_option_value_in_ctx function and calling it in complete_options.
For testing, this makes "maint show test-options-completion-result"
show the processed options too, like what the "maint test-options"
subcommands output when run. Then, of course, gdb.base/options.exp is
adjusted.
Doing this exposed a couple latent bugs, which is what the other gdb
changes in the patch are for:
- in the var_enum case, without the change, we'd end up with a null
enum argument, and print:
"-enum (null)"
- The get_ulongest change is necessary to avoid advancing PP in a
case where we end up throwing an error, e.g., when parsing "11x".
Without the change the operand pointer shown by "maint show
test-options-completion-result" would be left pointing at "x"
instead of "11x".
gdb/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* cli/cli-option.c (parse_option) <var_enum>: Don't return an
option_value with a null enumeration.
(complete_options): Save the option values in the context.
(save_option_value_in_ctx): New, factored out from ...
(process_options): ... here.
* cli/cli-utils.c (get_ulongest): Don't advance PP until the end
of the function.
* maint-test-options.c (test_options_opts::dump): New, factored
out from ...
(maintenance_test_options_command_mode): ... here.
(maintenance_test_options_command_completion_result): Delete.
(maintenance_test_options_command_completion_text): Update
comment.
(maintenance_show_test_options_completion_result): Change
prototype. Just print
maintenance_test_options_command_completion_text.
(save_completion_result): New.
(maintenance_test_options_completer_mode): Pass options context to
complete_options, and then save a dump.
(_initialize_maint_test_options): Use add_cmd to install "maint
show test-options-completion-result".
gdb/testsuite/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* gdb.base/options.exp (test-misc, test-flag, test-boolean)
(test-uinteger, test-enum): Adjust res_test_gdb_... calls to pass
the expected output in the success.
Diffstat (limited to 'gdb/testsuite/ChangeLog')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6e22349..209f15f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2019-07-03 Pedro Alves <palves@redhat.com> + * gdb.base/options.exp (test-misc, test-flag, test-boolean) + (test-uinteger, test-enum): Adjust res_test_gdb_... calls to pass + the expected output in the success. + +2019-07-03 Pedro Alves <palves@redhat.com> + * lib/completion-support.exp (test_gdb_complete_tab_multiple): Split one gdb_test_multiple call in two to avoid a race. |