From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40432 invoked by alias); 14 Feb 2017 17:35:37 -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 40006 invoked by uid 89); 14 Feb 2017 17:35:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*f:CAH, H*i:CAH, storing, H*f:s-PORT5jzW X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Feb 2017 17:35:27 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0B424E33D; Tue, 14 Feb 2017 17:35:27 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1EHZ40D020075; Tue, 14 Feb 2017 12:35:25 -0500 Subject: Re: [PATCH, updated] Add support for setting disassembler-options in GDB for POWER, ARM and S390 To: Yao Qi References: <867f4uccky.fsf@gmail.com> <72237b44-c785-c22d-5664-a87c28a9678a@redhat.com> Cc: Peter Bergner , "gdb-patches@sourceware.org" , Alan Modra , Ulrich Weigand , Eli Zaretskii , Nick Clifton , binutils From: Pedro Alves Message-ID: <727ccb3d-29d3-02ef-7993-2a720d244f06@redhat.com> Date: Tue, 14 Feb 2017 17:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00392.txt.bz2 On 02/14/2017 05:21 PM, Yao Qi wrote: > On Mon, Feb 13, 2017 at 4:58 PM, Pedro Alves wrote: >> On 02/13/2017 03:52 PM, Yao Qi wrote: >>> These options should be modeled as per-architecture data. We need to >>> define a key to access that data dynamically. grep >>> "static struct gdbarch_data *" in *.c. >> >> If I understand the suggestion correctly, that would make all the different >> POWER (etc.) gdbarch instances have their own instance of the option string. > > Hi Pedro, > Peter's patch makes each gdbarch instance has its own instance of > option string set by GDB. Peter's patch adds two things in gdbarch, > > +# Functions for allowing a target to modify its disassembler options. > +v:char *:disassembler_options:::0:0::0:pstring (gdbarch->disassembler_options) > +v:const disasm_options_t > *:disassembler_options_arch:::0:0::0:host_address_to_string > (gdbarch->disassembler_options_arch->name > > The former one is a string, and it is per-gdbarch-instance. The latter is a > function, which provides all valid options for an arch. Different gdbarch > instances for powerpc, for example, have the same valid options, but each > gdbarch instance will have its own setting (set by GDB command). Then I'm a bit surprised, since that was not what was discussed earlier, here : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > I didn't realize we could have multiple gdbarchs for the same > arch live at the same time. Do you have a suggestion on how > to fix this? Maybe each arch will have its own *-tdep.c global > var to hold it and maybe store a pointer to that in the gdbarch? Yeah, that sounds like the simplest way to handle it. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to implement the above, the gdbarch should be storing a "char **", but it is storing a "char *" instead: +v:char *:disassembler_options:::0:0::0:pstring (gdbarch->disassembler_options) So I don't know why the current patch is doing it differently, and I was going by that earlier discussion. > My suggestion about using "struct gdbarch_data *" doesn't change the > the behaviour. Thanks for checking. So the question now is why does the current patch want to behave like that. :-) Thanks, Pedro Alves