diff options
Diffstat (limited to 'gdb/cli/cli-option.h')
-rw-r--r-- | gdb/cli/cli-option.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h index 1bfbfce..a26b52f 100644 --- a/gdb/cli/cli-option.h +++ b/gdb/cli/cli-option.h @@ -86,6 +86,7 @@ public: unsigned int *(*uinteger) (const option_def &, void *ctx); int *(*integer) (const option_def &, void *ctx); const char **(*enumeration) (const option_def &, void *ctx); + char **(*string) (const option_def &, void *ctx); } var_address; @@ -261,6 +262,26 @@ struct enum_option_def : option_def } }; +/* A var_string command line option. */ + +template<typename Context> +struct string_option_def : option_def +{ + string_option_def (const char *long_option_, + char **(*get_var_address_cb_) (Context *), + show_value_ftype *show_cmd_cb_, + const char *set_doc_, + const char *show_doc_ = nullptr, + const char *help_doc_ = nullptr) + : option_def (long_option_, var_string, + (erased_get_var_address_ftype *) get_var_address_cb_, + show_cmd_cb_, + set_doc_, show_doc_, help_doc_) + { + var_address.enumeration = detail::get_var_address<const char *, Context>; + } +}; + /* A group of options that all share the same context pointer to pass to the options' get-current-value callbacks. */ struct option_def_group |