From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23323 invoked by alias); 7 Oct 2016 19:21: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 23296 invoked by uid 89); 7 Oct 2016 19:21:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:500, H*Ad:U*amodra, ulrich, sk:ulrich 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, 07 Oct 2016 19:21:15 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u97JJ8ts025833 for ; Fri, 7 Oct 2016 15:21:14 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 25xc3rpc5p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 07 Oct 2016 15:21:13 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Oct 2016 20:21:10 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 7 Oct 2016 20:21:09 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4281317D805A; Fri, 7 Oct 2016 20:23:15 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u97JL9h214352704; Fri, 7 Oct 2016 19:21:09 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u97JL8lx021930; Fri, 7 Oct 2016 15:21:08 -0400 Received: from oc8523832656.ibm.com (icon-9-164-129-157.megacenter.de.ibm.com [9.164.129.157]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u97JL8LO021922; Fri, 7 Oct 2016 15:21:08 -0400 Received: by oc8523832656.ibm.com (Postfix, from userid 500) id D516E10C1FE; Fri, 7 Oct 2016 21:21:06 +0200 (CEST) Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER. To: bergner@vnet.ibm.com (Peter Bergner) Date: Fri, 07 Oct 2016 19:21:00 -0000 From: "Ulrich Weigand" Cc: palves@redhat.com (Pedro Alves), amodra@gmail.com (Alan Modra), gdb-patches@sourceware.org, binutils@sourceware.org (binutils) In-Reply-To: <91e1cf79-06d8-0eff-a1a0-5665563f0054@vnet.ibm.com> from "Peter Bergner" at Oct 06, 2016 02:26:38 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16100719-0040-0000-0000-000002EA337D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16100719-0041-0000-0000-00001D63B038 Message-Id: <20161007192106.D516E10C1FE@oc8523832656.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-1610070331 X-SW-Source: 2016-10/txt/msg00182.txt.bz2 Peter Bergner 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 :-) 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. > + 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)? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com