From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 269BE3858C55 for ; Fri, 2 Sep 2022 10:00:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 269BE3858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662112806; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qqzHKidli0TjtRxoHPWP+I2xFAW0vPzApD93E1BeEdo=; b=hnpFIgPpm7FYXmLnsZqU+6ZqymgGp297YSbfBWi6u/+ew1UDiawTbfT9QRAEF8In7Dsgp9 VD0hxx0PfGyiWW5ceKEEqxgK3DqIjnVTLPgW6nMjxsSJhxXsw6M8lcgrp9cm1qgD1TY0+s C/8G44vgQtOQQ1ema9h1vt+A7CEtYpY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-607-RJ6UAG9XON-pXlMn5dJCcg-1; Fri, 02 Sep 2022 06:00:05 -0400 X-MC-Unique: RJ6UAG9XON-pXlMn5dJCcg-1 Received: by mail-wm1-f71.google.com with SMTP id j3-20020a05600c1c0300b003a5e72421c2so3587694wms.1 for ; Fri, 02 Sep 2022 03:00:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=qqzHKidli0TjtRxoHPWP+I2xFAW0vPzApD93E1BeEdo=; b=7odwq+89VvOYV0NbWEbzIMWHg4aATx0pGIz0e2JNz2aiTioBh1XxplF25SS1dV8YUz pBEyZoKZFGZ/eoJ+V1W01BxHHqYDEvK+8eQ1c50AveE7K7CmdCPYxerXQ3U//Opfnpu2 1gxR3jZTd6Drwej73CJx9DtRFHe3iVwk1PeoZbuKHYwLgUIrfRSbrcOloRmEORM1rZCj dHB5GF+hu864Be8fNzMZgjDmIO0wlhobK3eFEjHvL5y4hyrG3slio/lxQmYi59A4Yf06 0v2mBGIVMVuNG6zeiGF+rhMjdxYZYDdJdgpk8xEjXChMRvE7us8l/5EBGez62rqxzyXq M9EA== X-Gm-Message-State: ACgBeo3M6fpBT5h227oeh94beB0uxeInGMIvYaZmdKOnG0uSQ9o+Milf 2GYWQf1uTDRG7bQ9PmAptidAdNIa84ZUQ6rfvlbshnYduCT/yQ1rj7medRVOJ9x0efF3Ox78r3h hKknauqVxFEHZhLzyjg== X-Received: by 2002:a5d:6605:0:b0:226:dbe6:c326 with SMTP id n5-20020a5d6605000000b00226dbe6c326mr13795216wru.658.1662112804247; Fri, 02 Sep 2022 03:00:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7BrLrUHnNZehVuCpJc7mZh56lMKhTF+tngBA9ev1CqV/Z2t/oCP3A+lqPtIYmr2tkfBwODSw== X-Received: by 2002:a5d:6605:0:b0:226:dbe6:c326 with SMTP id n5-20020a5d6605000000b00226dbe6c326mr13795196wru.658.1662112803984; Fri, 02 Sep 2022 03:00:03 -0700 (PDT) Received: from localhost ([31.111.84.229]) by smtp.gmail.com with ESMTPSA id o21-20020a05600c4fd500b003a32297598csm8734139wmq.43.2022.09.02.03.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:00:03 -0700 (PDT) From: Andrew Burgess To: Tsukasa OI , Tsukasa OI , Palmer Dabbelt , Claudiu Zissulescu , Chenghua Xu , Nelson Chu Cc: binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] gdb: Add non-enum disassembler options In-Reply-To: References: Date: Fri, 02 Sep 2022 11:00:02 +0100 Message-ID: <87ilm6cd0d.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_MANYTO,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,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 List-Id: Tsukasa OI writes: > 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(+) The GDB parts are OK. Thanks, Andrew > > 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