From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68488 invoked by alias); 7 Oct 2016 21:01:44 -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 68462 invoked by uid 89); 7 Oct 2016 21:01:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Fri, 07 Oct 2016 21:01:32 +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 u97KwY0k071687 for ; Fri, 7 Oct 2016 17:01:31 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 25xfav0jdr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 07 Oct 2016 17:01:31 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Oct 2016 15:01:30 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 7 Oct 2016 15:01:27 -0600 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 4AEF819D8026; Fri, 7 Oct 2016 15:00:54 -0600 (MDT) Received: from b01ledav03.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u97L1D3414156036; Fri, 7 Oct 2016 21:01:26 GMT Received: from b01ledav03.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3DBDB204E; Fri, 7 Oct 2016 17:01:26 -0400 (EDT) Received: from otta.local (unknown [9.85.164.102]) by b01ledav03.gho.pok.ibm.com (Postfix) with ESMTP id 5721EB2052; Fri, 7 Oct 2016 17:01:26 -0400 (EDT) Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER. To: Ulrich Weigand References: <20161007192106.D516E10C1FE@oc8523832656.ibm.com> Cc: Pedro Alves , Alan Modra , gdb-patches@sourceware.org, binutils From: Peter Bergner Date: Fri, 07 Oct 2016 21:01: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: <20161007192106.D516E10C1FE@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: 16100721-0008-0000-0000-000005C39AF8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005870; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00765626; UDB=6.00365879; IPR=6.00541497; BA=6.00004792; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012911; XFM=3.00000011; UTC=2016-10-07 21:01:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16100721-0009-0000-0000-00003BF514EE Message-Id: <4b819398-85fd-3e91-01cf-dc622b38226b@vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-07_09:,, 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-1610070362 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00184.txt.bz2 On 10/7/16 2:21 PM, Ulrich Weigand wrote: >> gdb/ >> * gdbarch.sh (target_disassemble_init): New. >> * gdbarch.c: Regenerate. >> * gdbarch.h: Likewise. >> * disasm.c (gdb_disassemble_info): Call gdbarch_target_disassemble_init. >> * rs6000-tdep.c: Include "opcode/ppc.h". >> (gdb_disassembler_cpu): New static declaration. >> (prospective_cpu): Likewise. >> (gdb_rs6000_init_disassembly): New function. >> (set_disassembler_cpu): Likewise. >> (show_disassembler_cpu): Likewise. >> (rs6000_gdbarch_init): Setup callback for gdb_rs6000_init_disassembly. >> (_initialize_rs6000_tdep): Initialize gdb_disassembler_cpu and >> target_init_disassembly. Setup callbacks for set_disassembler_cpu() >> and show_disassembler_cpu(). > > I like this a lot better than the original patch :-) Heh, well, I'm not a gdb developer, so I don't know the gdb code that well. I just hacked in stuff that worked with bfd. Now you guys are forcing me to learn the code and to work hard! :-) I agree it's looking better too. > Still some comments: > >> @@ -785,6 +785,8 @@ gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) >> di.endian = gdbarch_byte_order (gdbarch); >> di.endian_code = gdbarch_byte_order_for_code (gdbarch); >> di.application_data = gdbarch; >> + if (gdbarch_target_disassemble_init_p (gdbarch)) >> + gdbarch_target_disassemble_init (gdbarch, &di); >> disassemble_init_for_target (&di); >> return di; > > There's a second use of disassemble_init_for_target, which probably needs > the same treatment. In fact, maybe the nicest way would be to call the > callback "gdbarch_disassemble_init_for_target", with a default of simply > disassemble_init_for_target, but which targets can override to do extra > stuff before (or after) calling disassemble_init_for_target in there. > GDB common code would then just call gdbarch_disassemble_init_for_target > everywhere it currently calls disassemble_init_for_target. Sure, I can give that a try. >> + gdb_disassembler_cpu = strdup (PPC_DEFAULT_CPU",any"); > > Why do we have to know about this here in GDB? Can't the GDB default just > be the empty (or NULL) string, and then opcodes does the defaulting > (as it does today)? I thought it would be useful if the user does a "show powerpc disassembler" without ever doing a "set powerpc disassembler " to show them what default cpu they're actually using. If you want this hunk removed, I can spit out 'default' in the case gdb_disassembler_cpu is NULL. Peter