diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2018-12-31 14:37:09 +0100 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-01-12 21:56:58 +0100 |
commit | d73cff189ddc3725697e614d4d247819f754f096 (patch) | |
tree | 65ffa0063199581de0f877d0ab7f5dab47b414df /gdb/cli/cli-style.h | |
parent | 4ce8c66d19abec8a768add7f6102e856157a3952 (diff) | |
download | gdb-d73cff189ddc3725697e614d4d247819f754f096.zip gdb-d73cff189ddc3725697e614d4d247819f754f096.tar.gz gdb-d73cff189ddc3725697e614d4d247819f754f096.tar.bz2 |
Implement help/show values for 'set|show style'.
Currently, the behaviour is:
(gdb) show style
(gdb) set style
(gdb) show style address
(gdb) set style address
(gdb)
With this patch, the behaviour is:
(gdb) show style
style address background: The "address" background color is: none
style address foreground: The "address" foreground color is: blue
style address intensity: The "address" display intensity is: normal
enabled: CLI output styling is enabled.
style filename background: The "filename" background color is: none
style filename foreground: The "filename" foreground color is: green
style filename intensity: The "filename" display intensity is: normal
style function background: The "function" background color is: none
style function foreground: The "function" foreground color is: yellow
style function intensity: The "function" display intensity is: normal
style variable background: The "variable" background color is: none
style variable foreground: The "variable" foreground color is: cyan
style variable intensity: The "variable" display intensity is: normal
(gdb) set style
"set style" must be followed by an appropriate subcommand.
List of set style subcommands:
set style address -- Address display styling
set style enabled -- Set whether CLI styling is enabled
set style filename -- Filename display styling
set style function -- Function name display styling
set style variable -- Variable name display styling
Type "help set style" followed by set style subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) show style address
background: The "filename" background color is: none
foreground: The "filename" foreground color is: green
intensity: The "filename" display intensity is: normal
(gdb) set style address
List of set style address subcommands:
set style address background -- Set the background color for this property
set style address foreground -- Set the foreground color for this property
set style address intensity -- Set the display intensity color for this property
Type "help set style address" followed by set style address subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb)
gdb/ChangeLog
* cli/cli-style.h (class cli_style_option): <add_setshow_commands>
Remove arg prefixname, add do_set and do_show.
Add member functions set_list and show_list.
* cli/cli-style.c (class cli_style_option): Update accordingly.
(style_set_list): Move to file scope.
(style_show_list): Likewise.
(set_style): Call help_list.
(show_style): Call cmd_show_list.
(_initialize_cli_style): New macro STYLE_ADD_SETSHOW_COMMANDS.
Update to use the new macro.
Diffstat (limited to 'gdb/cli/cli-style.h')
-rw-r--r-- | gdb/cli/cli-style.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index 85df034..07830f9 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -38,9 +38,17 @@ public: void add_setshow_commands (const char *name, enum command_class theclass, const char *prefix_doc, - const char *prefixname, struct cmd_list_element **set_list, - struct cmd_list_element **show_list); + void (*do_set) (const char *args, int from_tty), + struct cmd_list_element **show_list, + void (*do_show) (const char *args, int from_tty)); + + /* Return the 'set style NAME' command list, that can be used + to build a lambda DO_SET to call add_setshow_commands. */ + struct cmd_list_element *set_list () { return m_set_list; }; + + /* Same as SET_LIST but for the show command list. */ + struct cmd_list_element *show_list () { return m_show_list; }; private: @@ -59,10 +67,6 @@ private: struct cmd_list_element *m_set_list = nullptr; struct cmd_list_element *m_show_list = nullptr; - /* Callback to set a value. */ - static void do_set (const char *args, int from_tty); - /* Callback to show a value. */ - static void do_show (const char *args, int from_tty); /* Callback to show the foreground. */ static void do_show_foreground (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, |