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.