gdb: update command completion for watch, awatch, and rwatch
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 16 Nov 2020 16:50:03 +0000 (16:50 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 19 Nov 2020 10:15:04 +0000 (10:15 +0000)
commita15a5258b5b422645faca888c1279f249903512e
tree0c5a1b562fb89e7c3ed0768a90465e62778a3645
parent2e362716fc7df641de0405dbef16a52be5dea2d1
gdb: update command completion for watch, awatch, and rwatch

Switch over to using new option processing mechanism for watch,
awatch, and rwatch commands.  Add command completion function.

This means that expression completion now works correctly when the
-location flag is used.  So previously:

  (gdb) watch var.<TAB><TAB>
  .... list fields of var ....

But,

  (gdb) watch -location var.<TAB><TAB>
  .... list all symbols ....

After this commit only the fields of 'var' are listed even when
'-location' is passed.

Another benefit of this change is that '-location' will now complete.

One thing to note is that previous these commands accepted both
'-location' or '-l' (these being synonyms).  The new option scheme
doesn't really allow for official short form flags, however, it does
allow for non-ambiguous sub-strings to be used.  What this means is
that currently (as these commands only have the '-location' flag) the
user can still use '-l', so there's no change there.

The interactive help text for these commands now emphasises
'-location' as the real option, but does mention that '-l' can also be
used.

gdb/ChangeLog:

* breakpoint.c (struct watch_options): New struct.
(watch_option_defs): New static global.
(make_watch_options_def_group): New function.
(watch_maybe_just_location): Convert option parsing.
(watch_command_completer): New function.
(_initialize_breakpoint): Build help text using options mechanism.

gdb/testsuite/ChangeLog:

* gdb.base/completion.exp: Add new completion tests.
gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/completion.exp
This page took 0.025762 seconds and 4 git commands to generate.