From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7896) id 929163858011; Tue, 6 Sep 2022 08:28:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 929163858011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662452901; bh=OlfijQAbezm5yikxA49kzqGGQNIpimb2xg80miDC5kY=; h=From:To:Subject:Date:From; b=HvPPFS/+D1jZplNBMTdc+Hnz+nKdSKAwvxQgZsjyWzCOHTatEmEteU88ASrzhKhla aZJ1IM/gaNYc/rcy2WiykkFGQs37UUD35xy30+O5cQjnXr7Wse2ZD2HuxWWY1x2gV5 2JOBWfaxWrTfCpT+theRTIBHEPamBJn3UIwwS2no= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tsukasa OI To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: Add non-enum disassembler options X-Act-Checkin: binutils-gdb X-Git-Author: Tsukasa OI X-Git-Refname: refs/heads/master X-Git-Oldrev: d878bb39e417fa23b8dc62fed916708e776a9b71 X-Git-Newrev: f2028892699ded3276246ddec602d6b9f3e7295d Message-Id: <20220906082821.929163858011@sourceware.org> Date: Tue, 6 Sep 2022 08:28:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df2028892699d= ed3276246ddec602d6b9f3e7295d commit f2028892699ded3276246ddec602d6b9f3e7295d Author: Tsukasa OI Date: Tue Aug 30 12:21:13 2022 +0000 gdb: Add non-enum disassembler options =20 This is paired with "opcodes: Add non-enum disassembler options". =20 There is a portable mechanism for disassembler options and used on some architectures: =20 - ARC - Arm - MIPS - PowerPC - RISC-V - S/390 =20 However, it only supports following forms: =20 - [NAME] - [NAME]=3D[ENUM_VALUE] =20 Valid values for [ENUM_VALUE] must be predefined in disasm_option_arg_t.values. For instance, for -M cpu=3D[CPU] in ARC architecture, opcodes/arc-dis.c builds valid CPU model list from include/elf/arc-cpu.def. =20 In this commit, it adds following format: =20 - [NAME]=3D[ARBITRARY_VALUE] (cannot contain "," though) =20 This is identified by NULL value of disasm_option_arg_t.values (normally, this is a non-NULL pointer to a NULL-terminated list). =20 gdb/ChangeLog: =20 * gdb/disasm.c (set_disassembler_options): Add support for non-enum disassembler options. (show_disassembler_options_sfunc): Likewise. Diff: --- 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_opt= ions) if (memcmp (opt, valid_options->name[i], len) !=3D 0) continue; arg =3D opt + len; + if (valid_options->arg[i]->values =3D=3D NULL) + break; for (j =3D 0; valid_options->arg[i]->values[j] !=3D NULL; j++) if (disassembler_options_cmp (arg, valid_options->arg[i]->values[j]) =3D=3D 0) @@ -1391,6 +1393,8 @@ The following disassembler options are supported for = use with the\n\ =20 for (i =3D 0; valid_args[i].name !=3D NULL; i++) { + if (valid_args[i].values =3D=3D NULL) + continue; gdb_printf (file, _("\n\ For the options above, the following values are supported for \"%s\":\n = "), valid_args[i].name);