gdb/amd-dbgaapi-lib: Add set style commands for diagnostic messages
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
The diagnostic messages produced by the amd-dbgapi library (controlled
with "set debug amd-dbgapi-lib log-level") are styled by default, but
the style cannot be edited by the user.
This patch adds the following commands to inspect and control the style
of diagnostic messages produced by amd-dbgapi:
- set style amd-dbgapi-lib fatal_error
- show style amd-dbgapi-lib fatal_error
- set style amd-dbgapi-lib trace_message
- show style amd-dbgapi-lib trace_message
- set style amd-dbgapi-lib warning_message
- show style amd-dbgapi-lib warning_message
Those commands work similarly to other "set/show style" commands already
available in GDB.
Change-Id: I89c30515ef69846ce53429d9f104cc86301a1256
---
gdb/NEWS | 9 +++++++++
gdb/amd-dbgapi-target.c | 42 +++++++++++++++++++++++++++++++++++------
gdb/doc/gdb.texinfo | 20 ++++++++++++++++++++
3 files changed, 65 insertions(+), 6 deletions(-)
base-commit: 5266f5c25b20ed6411b263952f52032afafd280d
Comments
>>>>> "Lancelot" == Lancelot SIX <lancelot.six@amd.com> writes:
Lancelot> This patch adds the following commands to inspect and control the style
Lancelot> of diagnostic messages produced by amd-dbgapi:
Lancelot> - set style amd-dbgapi-lib fatal_error
Lancelot> - show style amd-dbgapi-lib fatal_error
Lancelot> - set style amd-dbgapi-lib trace_message
Lancelot> - show style amd-dbgapi-lib trace_message
Lancelot> - set style amd-dbgapi-lib warning_message
Lancelot> - show style amd-dbgapi-lib warning_message
I think it's more gdb-ish to use "-" rather than "_" to separate words.
Tom
@@ -47,6 +47,15 @@ set remote thread-options-packet
show remote thread-options-packet
Set/show the use of the thread options packet.
+set style amd-dbgapi-lib fatal_error
+show style amd-dbgapi-lib fatal_error
+set style amd-dbgapi-lib trace_message
+show style amd-dbgapi-lib trace_message
+set style amd-dbgapi-lib warning_message
+show style amd-dbgapi-lib warning_message
+ If AMDGPU support is enabled, those settings control the style of the
+ diagnostic messages emitted by the amd-dbgapi library.
+
* New features in the GDB remote stub, GDBserver
** The --remote-debug and --event-loop-debug command line options
@@ -25,6 +25,7 @@
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-style.h"
+#include "gdbcmd.h"
#include "inf-loop.h"
#include "inferior.h"
#include "objfiles.h"
@@ -2086,14 +2087,13 @@ location may not be accurate. See \"show amdgpu precise-memory\".\n"));
/* Style for some kinds of messages. */
-static cli_style_option fatal_error_style
- ("amd_dbgapi_fatal_error", ui_file_style::RED);
-static cli_style_option warning_style
- ("amd_dbgapi_warning", ui_file_style::YELLOW);
+static cli_style_option fatal_error_style ("fatal_error", ui_file_style::RED);
+static cli_style_option warning_style ("warning_message",
+ ui_file_style::YELLOW);
/* BLACK + BOLD means dark gray. */
-static cli_style_option trace_style
- ("amd_dbgapi_trace", ui_file_style::BLACK, ui_file_style::BOLD);
+static cli_style_option trace_style ("trace_message", ui_file_style::BLACK,
+ ui_file_style::BOLD);
/* log_message callback. */
@@ -2201,6 +2201,10 @@ struct cmd_list_element *show_amdgpu_list;
struct cmd_list_element *set_debug_amd_dbgapi_lib_list;
struct cmd_list_element *show_debug_amd_dbgapi_lib_list;
+/* List of set/show style amd-dbgapi-lib commands. */
+struct cmd_list_element *set_style_amd_dbgapi_lib_list;
+struct cmd_list_element *show_style_amd_dbgapi_lib_list;
+
/* Mapping from amd-dbgapi log level enum values to text. */
static constexpr const char *debug_amd_dbgapi_lib_log_level_enums[] =
@@ -2363,6 +2367,32 @@ If off (default), precise memory reporting is disabled."),
&set_debug_amd_dbgapi_lib_list,
&show_debug_amd_dbgapi_lib_list);
+ add_basic_prefix_cmd ("amd-dbgapi-lib", no_class,
+ _("Generic command for setting amd-dbgapi library "
+ "logging styles."), &set_style_amd_dbgapi_lib_list,
+ 0, &style_set_list);
+
+ add_basic_prefix_cmd ("amd-dbgapi-lib", no_class,
+ _("Generic command for showing amd-dbgapi library "
+ "logging styles."), &show_style_amd_dbgapi_lib_list,
+ 0, &style_show_list);
+
+ fatal_error_style.add_setshow_commands (no_class, _("\
+Configure amd-dbgapi-lib fatal errors styling."),
+ &set_style_amd_dbgapi_lib_list,
+ &show_style_amd_dbgapi_lib_list,
+ false);
+
+ warning_style.add_setshow_commands (no_class, _("\
+Configure amd-dbgapi-lib warning messages styling."),
+ &set_style_amd_dbgapi_lib_list,
+ &show_style_amd_dbgapi_lib_list, false);
+
+ trace_style.add_setshow_commands (no_class, _("\
+Configure amd-dbgapi-lib trace messages styling."),
+ &set_style_amd_dbgapi_lib_list,
+ &show_style_amd_dbgapi_lib_list, false);
+
add_setshow_boolean_cmd ("amd-dbgapi", class_maintenance,
&debug_amd_dbgapi,
_("Set debugging of amd-dbgapi target."),
@@ -27859,6 +27859,26 @@ family of commands. This style is only used when @value{GDBN} is
styling using its builtin disassembler library. By default, this style's
foreground color is red.
+@item amd-dbgapi-lib fatal_error
+Control the style of fatal-error diagnostic messages generated by
+amd-dbgapi-lib. These are managed with the @code{set style
+amd-dbgapi-lib fatal_error} family of commands. This style is only used
+if @value{GDBN} is compiled with amdgpu support (see @ref{AMD GPU}).
+
+@item amd-dbgapi-lib trace_message
+Control the style of trace diagnostic messages generated by
+amd-dbgapi-lib. These are managed with the @code{set style
+amd-dbgapi-lib trace_message} family of commands. This style is only
+used if @value{GDBN} is compiled with amdgpu support (see @ref{AMD
+GPU}).
+
+@item amd-dbgapi-lib warning_message
+Control the style of warning diagnostic messages generated by
+amd-dbgapi-lib. These are managed with the @code{set style
+amd-dbgapi-lib warning_message} family of commands. This style is only
+used if @value{GDBN} is compiled with amdgpu support (see @ref{AMD
+GPU}).
+
@end table
@node Numbers