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.133.124]) by sourceware.org (Postfix) with ESMTPS id C03B13858C74 for ; Fri, 2 Sep 2022 10:00:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C03B13858C74 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-342-UBP-yQt6PjK1mT5Ti8pixg-1; Fri, 02 Sep 2022 06:00:05 -0400 X-MC-Unique: UBP-yQt6PjK1mT5Ti8pixg-1 Received: by mail-wm1-f71.google.com with SMTP id a17-20020a05600c349100b003a545125f6eso2729765wmq.4 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=M8zq0aOfrg8jmUWzY7S9tvM6tZuORx6ICfr2JF51/VOF5KlYdezSx/SEz9lqOeDRnr hcsLYMkbh3ABohwaRGSA+ui0utTmjvKUK6DdBL0kgJGsjaw0XcDCyLdx13rTYP1YMlzq Q/nlL5PuH5ENRM00Td620q1FW2Ue3mxUe3Nin7SaMZMXsT6KrJLv6Oa8cpAExWlQfJkO rrme6c2ZXUoqdCGCzcS0L35pEX4PBiyslhkIahsHEwVFdR+g+6R0FV1HHPDCLqT2GmmT 5T29U6+1Gwye4SREAkxU8ECGeK9pq6k7Xck6MF+CjwN9h5pMvqFGvLqoJYH4Tnksa3dP YfZg== X-Gm-Message-State: ACgBeo2oNa4Y4s2vJKhAtXtSxEXaAwds6kTF3FC4lZX/JvUV2KkKWvlf wN6vd/jrX8I30gOkQEfEBYz1/XcCFh3NPU3SeqNRd/6yNasmdyNk/YjPL6dENvVbZUcMf9H7mRr FZAqKDCmoNYOSGTcA+vF9Qw== X-Received: by 2002:a5d:6605:0:b0:226:dbe6:c326 with SMTP id n5-20020a5d6605000000b00226dbe6c326mr13795211wru.658.1662112804195; 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=-11.9 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_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2022 10:00:10 -0000 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