From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5521 invoked by alias); 5 Jun 2018 15:16:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 5493 invoked by uid 89); 5 Jun 2018 15:16:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=owns X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Jun 2018 15:16:21 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w55FGEZC022030 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 5 Jun 2018 11:16:19 -0400 Received: by simark.ca (Postfix, from userid 112) id 445761E5AF; Tue, 5 Jun 2018 11:16:14 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 063591E4F7; Tue, 5 Jun 2018 11:16:11 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 05 Jun 2018 15:16:00 -0000 From: Simon Marchi To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org, binutils@sourceware.org, Joel Brobecker , Fredrik Noring Subject: Re: [PATCH] GDB PR tdep/8282: MIPS: Wire in `set disassembler-options' In-Reply-To: References: Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 5 Jun 2018 15:16:14 +0000 X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00096.txt.bz2 Hi Maciej, I just had a few minutes to look at it, so I looked at the API in dis-asm.h, I have one small comment. > Index: gdb/include/dis-asm.h > =================================================================== > --- gdb.orig/include/dis-asm.h 2018-06-04 16:53:56.536062303 +0100 > +++ gdb/include/dis-asm.h 2018-06-05 00:20:26.008674269 +0100 > @@ -222,16 +222,50 @@ typedef struct disassemble_info > > } disassemble_info; > > -/* This struct is used to pass information about valid disassembler > options > - and their descriptions from the target to the generic GDB functions > that > - set and display them. */ > +/* This struct is used to pass information about valid disassembler > + option arguments from the target to the generic GDB functions > + that set and display them. */ > + > +typedef struct > +{ > + /* Option argument name to use in descriptions. */ > + const char *name; > + > + /* Vector of acceptable option argument values, NULL-terminated. */ > + const char **values; > +} disasm_option_arg_t; > + > +/* This struct is used to pass information about valid disassembler > + options, their descriptions and arguments from the target to the > + generic GDB functions that set and display them. Options are > + defined by tuples of vector entries at each index. */ > > typedef struct > { > + /* Vector of option names, NULL-terminated. */ > const char **name; > + > + /* Vector of option descriptions or NULL if none to be shown. */ > const char **description; > + > + /* Vector of option argument information pointers or NULL if no > + option accepts an argument. NULL entries denote individual > + options that accept no argument. */ > + const disasm_option_arg_t **arg; > } disasm_options_t; > > +/* This struct is used to pass information about valid disassembler > + options and arguments from the target to the generic GDB functions > + that set and display them. */ > + > +typedef struct > +{ > + /* Valid disassembler options. */ > + disasm_options_t options; > + > + /* Vector of acceptable option arguments, NULL-terminated. */ > + disasm_option_arg_t *args; > +} disasm_options_and_args_t; It took me a bit of time why we have a vector of disasm_option_arg_t here and in disasm_options_t. I finally understood that disasm_options_and_args_t::args owns the disasm_option_arg_t objects, and the pointers in disasm_options_t::arg point to these instances. Maybe that could be clarified in both comments? Do we really need a new struct, or could the "args" field be part of the disasm_options_t struct directly? Simon