From patchwork Sun Jan 21 16:44:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lancelot SIX X-Patchwork-Id: 84521 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E63FC3858409 for ; Sun, 21 Jan 2024 16:45:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by sourceware.org (Postfix) with ESMTPS id 003333858D32 for ; Sun, 21 Jan 2024 16:44:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 003333858D32 Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 003333858D32 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.94.65 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705855481; cv=pass; b=I5O5uMlcrunGK1P3ZK/YEJ5X4jJPaYzaxhN8go8H0YNwu0qJtbiAekjr8xufnKm8G3uU029Bc3qFCN2t64UVh2FlmqAOJy/E3ykK+DIPXI36RWAtCLLjMuLAbT6iATMdE0UjyZyueDMMGu9Azg735fTR2Aj45AZDWHCCNz7a+DY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705855481; c=relaxed/simple; bh=Es1VAbvfdbL6knyJRExmnefBTi+FRscWdRz+zo2fuCo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Jm/61H440/UZvhoulv5EkUrmBdkCo7cbB7eKg/X3d51TqwRHp/Xe3uBVMIC2YjrZdLsdDEKqVKJczFg0DrMqrJMYzyv/L9ryvFi31QpuSU9nFVmtLZP6fIEFU9QDaX7pI5UB8I6tK3AxDPcKDTdeAo2ACH8LkzLL4bRcTIP2IOY= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ShDNEKQfScvs14aSfzYVYB5x5eHOacQERmr1a+PI/A+D1bKIzhhBptFLv2iukMFEsAm9S0rPpvUBndRU+cOLH0eTwt6EqZuZJulob/oHf/bkwUyJ0bWI37jyTaj5a5f5OGhcS3CCgF2ORYZBHBU0wDjpr+LVNsxOFSOO2ZQj4MBmXfMTJ/0rZwRRz23TOFw/nuPK1x6Bx4laGZ/1KKkcb8Bw8x/OuvNrnXdaRBTHhDurIS+EWXZcv5b1YnZvu8it9W4uYZYP9soN+TU7YHmDbcEqDRKJDDKMV72EBhJebSCQFlzClOroRp7s+zXrsILCecUoFB8pSvF1TftJxVigUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=po3NOIEtADfkZelg6lnITwf6TdO3omqcHR/cfNOm70I=; b=FPhuK2yOg0H19/TbP6f6ITL9vH0j0jf0p14rreabOALs4g8S02mVu4t7kt5+lYJ+Kg/DUNt+tsnCu+M4+nRn2BqwpGqdzPzPNyEYVkkNR+nHLc3T5ooeTk67TJ0d1nNYExmrpJ+FXTuQXrmtgedxWcPCEIlUqPoBRo/dmxtIRpSKMd8SccWnsRPlH86k3bldUD68N8Mk2AY5TgbQVpRDFp+fh+fJkd0uH+u2JZPP8MnLi/KGKVkPCgAVjk2YwiLPCLyBT5shM4MQrqapQ48Ndu0rlf4dAR+m4OsLqJfG4gzIbag3KPrlSeMRa0X+pSvLqY6DmXTMLOTWo0bLx5Bqbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=po3NOIEtADfkZelg6lnITwf6TdO3omqcHR/cfNOm70I=; b=VsRQtThlQ8tZ8p/HakjtAOXdZUTM2LM88Fi3q/LGBtgYEtdZKnlqgjWMVMDtJeJtYrYM/lRvMgK6UFBM9ePKSPdxDDV4uDRqQvu4fytrMKkxQGqZfBBME7RJunOVItHqvfSNxDzkbB8Ugqiu+Q/Ixo/aPvFGDYlMHjMKGrPXNig= Received: from BYAPR08CA0060.namprd08.prod.outlook.com (2603:10b6:a03:117::37) by CYYPR12MB8729.namprd12.prod.outlook.com (2603:10b6:930:c2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.29; Sun, 21 Jan 2024 16:44:34 +0000 Received: from CO1PEPF000042AE.namprd03.prod.outlook.com (2603:10b6:a03:117:cafe::fe) by BYAPR08CA0060.outlook.office365.com (2603:10b6:a03:117::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.31 via Frontend Transport; Sun, 21 Jan 2024 16:44:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000042AE.mail.protection.outlook.com (10.167.243.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Sun, 21 Jan 2024 16:44:34 +0000 Received: from khazad-dum.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Sun, 21 Jan 2024 10:44:33 -0600 From: Lancelot SIX To: CC: , Lancelot SIX Subject: [PATCH] gdb/amd-dbgaapi-lib: Add set style commands for diagnostic messages Date: Sun, 21 Jan 2024 16:44:16 +0000 Message-ID: <20240121164416.1399667-1-lancelot.six@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AE:EE_|CYYPR12MB8729:EE_ X-MS-Office365-Filtering-Correlation-Id: c78230b4-170e-4141-c998-08dc1aa03fd0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4OdGU+4VdeDcCyHmZppPjbZUNdpO8t3dakhdmGnrYmdLYEpjv8VWgF89E/OET9PSNe8+Vk1KRJMDX0ZHJenIPcXV+qEeVCc39PZ6l+uAXqpfAB1WXMsbzfLrsAwbx50yRSIdPfMUOxwrS33bgsjS+b9h0IV1x7Wh1MXgUaQBbaXkhRq3RMqjewPXmWHEwz7b/espJIghqEVTz6fePJweVFzuIeyrz4rscrpepoAfzL0HwisZAuU5X7olUwp948tMhtBwFg445Z20BxcsZ76eYtH6vXry61rHHMMX48Fhk+9NkJD2c3s09Oce//729EbWVhXIB3FarGHfJc6DuBjteorBPMxZMuTyO5lYrmBLxJV/S6DBmGEuseEfrGzGMYudGA13ccVz1dUP/1gbGnabTGKOhKkw+xIAqPtHcpziDkO47T7+3PFAPhG/ISfPIp+shlsTOH/qKcZrRd+jkXbsPgrBI2leoesmt7R3UnGplhPZ2vG2iZWVlRGHDBFqMpQ+FmQyjbEX/9NsP/+PM1xYhqltN0LNE2kabYcgC9CYgH5QSleagNZjNxtkUToZS+6LA2WxCV+x290ny+c0GVJ3MTQ2MCSgfxpSBZ09G0tRtFlbIG2wRMCdoGn1/jW2Ay/B6xOcoW1UDQw9LH2QEW20g2j8pmZ7M+5V1ufHh0cZ1VS44lqlTHUCAgJxm/GIPFjOqCKrA5qT6BGG5isPlcXG5ipelIbdxl3Ilf4ko4hlvyVO8j2o12uWyPiIiTh/c3XL8Q0a7XA+YJn31fOaDbG3VjeCdI9e3lj/V0Qo68943GsifXchSRNupVrOqZpAAw2Z X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(346002)(376002)(396003)(39860400002)(230273577357003)(230173577357003)(230922051799003)(64100799003)(451199024)(82310400011)(1800799012)(186009)(40470700004)(46966006)(36840700001)(36860700001)(47076005)(36756003)(41300700001)(86362001)(82740400003)(356005)(81166007)(83380400001)(7696005)(478600001)(6666004)(4326008)(8676002)(8936002)(316002)(15650500001)(6916009)(54906003)(70586007)(70206006)(2906002)(16526019)(5660300002)(26005)(1076003)(2616005)(426003)(336012)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2024 16:44:34.6098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c78230b4-170e-4141-c998-08dc1aa03fd0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8729 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 diff --git a/gdb/NEWS b/gdb/NEWS index bab300e36b8..6e172e38d3a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -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 diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c index ae8c1ea14e3..3a743a35e9d 100644 --- a/gdb/amd-dbgapi-target.c +++ b/gdb/amd-dbgapi-target.c @@ -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."), diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e98c15242bc..8a9cf2de341 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -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