From patchwork Wed Sep 3 09:45:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 385469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8A4D0140216 for ; Wed, 3 Sep 2014 19:50:02 +1000 (EST) Received: from localhost ([::1]:43616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP7CS-0004oB-Qz for incoming@patchwork.ozlabs.org; Wed, 03 Sep 2014 05:50:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP7C5-0004WN-Ea for qemu-devel@nongnu.org; Wed, 03 Sep 2014 05:49:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP7Bs-0005vr-UZ for qemu-devel@nongnu.org; Wed, 03 Sep 2014 05:49:37 -0400 Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]:37198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP7Bs-0005uc-Jl for qemu-devel@nongnu.org; Wed, 03 Sep 2014 05:49:24 -0400 Received: by mail-pd0-f181.google.com with SMTP id fp1so10801283pdb.40 for ; Wed, 03 Sep 2014 02:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=0mS7T/oe3zngCkXo94TUypNU8/9NQGeaPHjGUF9ajPU=; b=vM1x1ZXawXsXC9Sl6OnzpN1gVfOUADYa/F2rnxwvD3aqFa04dTY973BHtTIyXx9nbl PL2GTHadGKr7RpPV//1tHENS4AA77r7Of6kz+yXng7zjF70yLzjJHlxIdEWbGjM3yhhD AIavAGc8YMv/L2URjpraZ5yPmTyaRRQce/r6CQwWotcyWgX2ieIgp6QH/nNBtN8oY94C uGNa9zWsUjkPnVyU+J/jXvEbmiAg31g9PTP8jB2uFkuEocx9MWogFDwBdKauyAJq9s/M IiDyVBJlhca/8KgCU5nPGyOtagA9Bto6Z0SjBg6e0inwuPpOacvg7cG2k7Ws3cYX2Rum dWbQ== X-Received: by 10.70.61.10 with SMTP id l10mr13207606pdr.154.1409737761728; Wed, 03 Sep 2014 02:49:21 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id dr5sm6426012pbb.24.2014.09.03.02.49.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 02:49:21 -0700 (PDT) Date: Wed, 3 Sep 2014 19:45:40 +1000 From: "Edgar E. Iglesias" To: David Hildenbrand Message-ID: <20140903094540.GA16778@toto> References: <1409320338-63098-1-git-send-email-jfrei@linux.vnet.ibm.com> <1409320338-63098-6-git-send-email-jfrei@linux.vnet.ibm.com> <20140903113724.544f594b@thinkpad-w530> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140903113724.544f594b@thinkpad-w530> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::235 Cc: Peter Maydell , Alexander Graf , QEMU Developers , Christian Borntraeger , Jens Freimann , "Vassili Karpov \(malc\)" , Cornelia Huck , Andreas =?iso-8859-1?Q?F=E4rber?= Subject: Re: [Qemu-devel] [PATCH 5/5] gdb: provide the name of the architecture in the target.xml X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Wed, Sep 03, 2014 at 11:37:24AM +0200, David Hildenbrand wrote: > > [ccing Andreas in case he wants to review the QOM aspects of this, > > though they're fairly straightforward I think.] > > > > On 29 August 2014 14:52, Jens Freimann wrote: > > > From: David Hildenbrand > > > > > > This patch provides the name of the architecture in the target.xml if available. > > > > > > This allows the remote gdb to detect the target architecture on its own - so > > > there is no need to specify it manually (e.g. if gdb is started without a > > > binary) using "set arch *arch_name*". > > > > This is neat; I didn't realise gdb let you do this. > > > > > The name of the architecture has been added to all archs that provide a > > > target.xml (by supplying a gdb_core_xml_file) and have a unique architecture > > > name in gdb's feature xml files. > > > > What about 32-bit ARM? You set the architecture name for AArch64 > > but not the 32 bit case. > > > > Well, my point was to not break anything :) > > On my way through the possible architecture names > (binutils-gdb/gdb/features/*.xml), I wasn't able to come up with the right name > for arm 32 bit (arm-core.xml) - they don't specify any. This patch therefore > adapts to the xml files from gdb. > > The architecture should be known at the same point when specifying the xml file. > So if anyone can come up with the proper arm name in the future (or even some > kind of detection algorithm), it can simply be set in target-arm/cpu.c (after > "arm-core.xml"). Hi, I've got some similar patches in my tree. I used the following: commit 26932a453da466d111b67c37b93dec71fb3ae111 Author: Edgar E. Iglesias Date: Wed Aug 20 19:22:10 2014 +1000 gdbstub: Emit the CPUs GDB architecture if available Allows GDB to autodetect the architecture. Signed-off-by: Edgar E. Iglesias diff --git a/gdbstub.c b/gdbstub.c index 7f82186..5b62c50 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -604,6 +604,11 @@ static const char *get_feature_xml(const char *p, const char **newp, pstrcat(target_xml, sizeof(target_xml), r->xml); pstrcat(target_xml, sizeof(target_xml), "\"/>"); } + if (cc->gdb_arch) { + pstrcat(target_xml, sizeof(target_xml), ""); + pstrcat(target_xml, sizeof(target_xml), cc->gdb_arch); + pstrcat(target_xml, sizeof(target_xml), ""); + } pstrcat(target_xml, sizeof(target_xml), ""); } return target_xml; commit a0b166c59491b154c05b963649f561c1e48aa706 Author: Edgar E. Iglesias Date: Wed Aug 20 19:21:28 2014 +1000 target-arm: Provide GDB arch names Signed-off-by: Edgar E. Iglesias diff --git a/target-arm/cpu.c b/target-arm/cpu.c index b726b6a..d1704f5 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -1163,6 +1163,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu; #endif + cc->gdb_arch = "arm"; cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; } diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c index fc9c991..c099d13 100644 --- a/target-arm/cpu64.c +++ b/target-arm/cpu64.c @@ -215,6 +215,7 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = aarch64_cpu_gdb_write_register; cc->gdb_num_core_regs = 34; cc->gdb_core_xml_file = "aarch64-core.xml"; + cc->gdb_arch = "aarch64"; } static void aarch64_cpu_register(const ARMCPUInfo *info) commit 0aca15f7829e6e8a94639ddd75bcfdfd3b034d2e Author: Edgar E. Iglesias Date: Wed Aug 20 19:20:35 2014 +1000 qom/cpu: Add a gdb_arch field to the CPUClass Used to optionally set the GDB architecture of the CPU. Signed-off-by: Edgar E. Iglesias diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 4d0908b..46b72e7 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -147,6 +147,7 @@ typedef struct CPUClass { void *opaque); const struct VMStateDescription *vmsd; + const char *gdb_arch; int gdb_num_core_regs; const char *gdb_core_xml_file; } CPUClass; commit eaa8bac08e300c9516d04c3425c3794a1bd893b8 Author: Edgar E. Iglesias Date: Wed Aug 20 11:26:52 2014 +1000 configure: gdbstub: Include ARM xml descritions in AArch64 builds Signed-off-by: Edgar E. Iglesias diff --git a/configure b/configure index fce5801..3a95948 100755 --- a/configure +++ b/configure @@ -4976,7 +4976,9 @@ case "$target_name" in aarch64) TARGET_BASE_ARCH=arm bflt="yes" - gdb_xml_files="aarch64-core.xml aarch64-fpu.xml" + arm_gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" + gdb_xml_files="aarch64-core.xml aarch64-fpu.xml $arm_gdb_xml_files" + echo $gdb_xml_files ;; cris) ;;