From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99178 invoked by alias); 28 Oct 2016 13:45:26 -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 99129 invoked by uid 89); 28 Oct 2016 13:45:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=unavailable version=3.3.2 spammy=arches, hesitant, complication, H*MI:1b3a X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Oct 2016 13:45:23 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9SDhuB7039877 for ; Fri, 28 Oct 2016 09:45:22 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 26c2mj0nmp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 28 Oct 2016 09:45:22 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Oct 2016 09:45:21 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Oct 2016 09:45:19 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id B0911C90041; Fri, 28 Oct 2016 09:45:03 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9SDjIsn30998580; Fri, 28 Oct 2016 13:45:18 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AB93AE034; Fri, 28 Oct 2016 09:45:18 -0400 (EDT) Received: from otta.local (unknown [9.85.133.123]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id E9254AE03B; Fri, 28 Oct 2016 09:45:17 -0400 (EDT) Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER. To: Ulrich Weigand References: <20161028123236.51A6210B91A@oc8523832656.ibm.com> Cc: Pedro Alves , Alan Modra , gdb-patches@sourceware.org, binutils From: Peter Bergner Date: Fri, 28 Oct 2016 13:45: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: <20161028123236.51A6210B91A@oc8523832656.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16102813-0056-0000-0000-000001C43A82 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005994; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00773946; UDB=6.00371688; IPR=6.00550747; BA=6.00004838; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013128; XFM=3.00000011; UTC=2016-10-28 13:45:20 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16102813-0057-0000-0000-000005F75029 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-28_05:,, 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-1610280234 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00797.txt.bz2 On 10/28/16 7:32 AM, Ulrich Weigand wrote: > really can be handled generically in common code, right? I.e. > set_disassembler_options verifies the string is a comma-separated > list of words from the supported option list, show_disassembler_options > simply displays the supported option list, etc. Yes, given Pedro's last comment, that is what I'm working on. One complication is that some arches (eg, arm) not only allow comma's as separators, but also allow spaces. Do we allow that for all architectures or should an architecture register which char(s) it allows as separators? We could add a generic show_disassembler_options loops that dumps out all of the valid options, but many of the architectures have functions that already do that, that include extra option info. I'm hesitant to copy that info over as well as the formatting will be different since we'll have a common displayer. I was thinking of modifying the opcodes/*-dis.c display functions to take a generic function pointer that they would use to print their output, then the objdump and gdb calls to that function could pass fprintf (std.., and fprintf_unfiltered(... and then things should work and look as before? Thoughts on that? My only thought after moving all of this code to generic code is, how do I handle the arch specific "set disassenbler..." code? One thought is that maybe we don't even need it anymore and we just always use the generic "set disassembler...." command. Thoughts? Otherwise, we'll have to setup the arch specific routine to call the generic one. > In fact, once the option processing is done in common code, we don't > even really need the per-gdbarch disassemble_init_for_target option > any more, since common code could simply set the disassembler_options > string before calling disassemble_init_for_target. I realized that too and have already removed it. Instead, I'm just unconditionally setting info->disassembler_options just before calling disassemble_init_for_target. For those architectures that don't opt in for this, it will just set info->disassembler_options to NULL, which is what it already is doing for them. Peter