From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id BF28C3857BB0; Sun, 4 Sep 2022 08:03:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF28C3857BB0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id EC708300089; Sun, 4 Sep 2022 08:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1662278632; bh=M1hyGXKGAF5AdelIAI+Z05HXKCvmciX+IWvpmticm7w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=gMvdI+oso7pMW7uQHBZwoYUqUj2baExv3Y54lo6gECtl8Vo0wbmyRakxyrcPgu8KM DARPHDjKz6vyz4/HvjMmwfYKGicsrp5CqR8NWlGYEvCIzy98GF1b9MU/oCTrCHEKQn +z84Lq1xpyafFpRKI5INAChY3q1RpSdJeaoUbPY0= From: Tsukasa OI To: Tsukasa OI , Nick Clifton , Andrew Burgess Cc: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH v2 2/2] gdb: Add non-enum disassembler options Date: Sun, 4 Sep 2022 08:03:20 +0000 Message-Id: <267b045177d14bf936e5ba94cf204acd10f91ff5.1662278591.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,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 List-Id: This is paired with "opcodes: Add non-enum disassembler options". There is a portable mechanism for disassembler options and used on some architectures: - ARC - Arm - MIPS - PowerPC - RISC-V - S/390 However, it only supports following forms: - [NAME] - [NAME]=[ENUM_VALUE] Valid values for [ENUM_VALUE] must be predefined in disasm_option_arg_t.values. For instance, for -M cpu=[CPU] in ARC architecture, opcodes/arc-dis.c builds valid CPU model list from include/elf/arc-cpu.def. In this commit, it adds following format: - [NAME]=[ARBITRARY_VALUE] (cannot contain "," though) This is identified by NULL value of disasm_option_arg_t.values (normally, this is a non-NULL pointer to a NULL-terminated list). gdb/ChangeLog: * gdb/disasm.c (set_disassembler_options): Add support for non-enum disassembler options. (show_disassembler_options_sfunc): Likewise. --- gdb/disasm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/disasm.c b/gdb/disasm.c index db6724757ac..fe4eed2d524 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -1270,6 +1270,8 @@ set_disassembler_options (const char *prospective_options) if (memcmp (opt, valid_options->name[i], len) != 0) continue; arg = opt + len; + if (valid_options->arg[i]->values == NULL) + break; for (j = 0; valid_options->arg[i]->values[j] != NULL; j++) if (disassembler_options_cmp (arg, valid_options->arg[i]->values[j]) == 0) @@ -1391,6 +1393,8 @@ The following disassembler options are supported for use with the\n\ for (i = 0; valid_args[i].name != NULL; i++) { + if (valid_args[i].values == NULL) + continue; gdb_printf (file, _("\n\ For the options above, the following values are supported for \"%s\":\n "), valid_args[i].name); -- 2.34.1