From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119163 invoked by alias); 11 Oct 2016 18:49:10 -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 119092 invoked by uid 89); 11 Oct 2016 18:49:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER,SPF_PASS autolearn=unavailable version=3.3.2 spammy=bonus X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Oct 2016 18:49:02 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9BIhesf122165 for ; Tue, 11 Oct 2016 14:49:00 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2615bkrwh6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 11 Oct 2016 14:49:00 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Oct 2016 12:48:59 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Oct 2016 12:48:57 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 357D119D8026; Tue, 11 Oct 2016 12:48:23 -0600 (MDT) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9BImqsd8782114; Tue, 11 Oct 2016 11:48:56 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72296136043; Tue, 11 Oct 2016 12:48:56 -0600 (MDT) Received: from otta.local (unknown [9.85.164.102]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id 9D73D136050; Tue, 11 Oct 2016 12:48:55 -0600 (MDT) Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER. To: Pedro Alves References: <20160930161908.6A43511C24D@oc8523832656.ibm.com> <20161003222527.GO4877@bubble.grove.modra.org> <5a66aca9-dfe9-7c44-21f9-27774a07d143@vnet.ibm.com> <91e1cf79-06d8-0eff-a1a0-5665563f0054@vnet.ibm.com> <98f7c932-3347-a07c-5282-ca83cbb89593@redhat.com> Cc: Alan Modra , Ulrich Weigand , gdb-patches@sourceware.org, binutils From: Peter Bergner Date: Tue, 11 Oct 2016 18:49:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <98f7c932-3347-a07c-5282-ca83cbb89593@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101118-0012-0000-0000-000010DC0511 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005893; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00767018; UDB=6.00366943; IPR=6.00543161; BA=6.00004801; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012953; XFM=3.00000011; UTC=2016-10-11 18:48:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101118-0013-0000-0000-00004638EF8E Message-Id: <8bfd2bd6-c2b3-cf5e-c689-897b877970f1@vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-11_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610110319 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00274.txt.bz2 On 10/10/16 7:08 PM, Pedro Alves wrote: > A command that works for all architectures, like your original > "set disassembler-cpu" seemingly would be (ignoring implementation > details). Maybe "set disassembler-cpu" could be an alias for > "set $current_arch disassembler-cpu". GDB would then only need to store > a disassemble option string for each possible arch, and the alias would just > need to map the current arch's cpu to the right option string variable. It doesn't look like set_disassembler_cpu() is passed the gdbarch, so is there some global variable that it could use to determine what the current arch is? That said, even if I do have it, wouldn't we need to store the set/show commands in the gdbarch so that they can be called? > All the information to build this should be in opcodes, I think. Even > for "help show disassembler-cpu", it should be possible for gdb to ask > opcodes to print a description of each possible option, > since "objdump --help" does it. Bonus points for hooking that to > a completer for "set disassembler-cpu ". :-) The objdump --help output comes from opcodes/ppc-dis.c's print_ppc_disassembler_options(FILE *stream). I actually tried to call that from show_disassembler_cpu(), but the "file" pointer it's passed is of type "struct ui_file *file" which looks to be a black box, so I'm not sure how I can extract a "FILE *" pointer out of that. I don't know how to set up a completer and I don't see one. Do you know of an example in the code I could look at/copy? > BTW, AFAICS, objdump's -M isn't really only about "cpu". > "objdump --help" on an --enable-targets=all build of binutils > shows -M options that are not cpu options. "set disassembler-options" > would probably be a better name for this. I'm fine going with whatever option name people prefer. If you want "disassembler-options" instead of just "disassembler", ok, but shouldn't ARM be renamed then as well if it uses this mechanism? Peter