From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNMby-0002tl-UE for qemu-devel@nongnu.org; Fri, 29 Aug 2014 09:53:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNMbr-0002C7-Oy for qemu-devel@nongnu.org; Fri, 29 Aug 2014 09:53:06 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:45666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNMbr-0002Bv-Gl for qemu-devel@nongnu.org; Fri, 29 Aug 2014 09:52:59 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Aug 2014 14:52:58 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 59ED6219002D for ; Fri, 29 Aug 2014 14:52:37 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7TDqt4L44957776 for ; Fri, 29 Aug 2014 13:52:55 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7TDqrQ3030077 for ; Fri, 29 Aug 2014 07:52:55 -0600 From: Jens Freimann Date: Fri, 29 Aug 2014 15:52:18 +0200 Message-Id: <1409320338-63098-6-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1409320338-63098-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1409320338-63098-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/5] gdb: provide the name of the architecture in the target.xml List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: Peter Maydell , qemu-devel@nongnu.org, David Hildenbrand , Jens Freimann , "Vassili Karpov (malc)" 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*". 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. Signed-off-by: David Hildenbrand Acked-by: Cornelia Huck Acked-by: Christian Borntraeger Signed-off-by: Jens Freimann Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: Vassili Karpov (malc) --- gdbstub.c | 19 ++++++++++++------- include/qom/cpu.h | 2 ++ target-arm/cpu64.c | 1 + target-ppc/translate_init.c | 2 ++ target-s390x/cpu.c | 1 + 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 8afe0b7..af82259 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -523,13 +523,18 @@ static const char *get_feature_xml(const char *p, const char **newp, GDBRegisterState *r; CPUState *cpu = first_cpu; - snprintf(target_xml, sizeof(target_xml), - "" - "" - "" - "", - cc->gdb_core_xml_file); - + pstrcat(target_xml, sizeof(target_xml), + "" + "" + ""); + if (cc->gdb_arch_name) { + pstrcat(target_xml, sizeof(target_xml), ""); + pstrcat(target_xml, sizeof(target_xml), cc->gdb_arch_name); + pstrcat(target_xml, sizeof(target_xml), ""); + } + pstrcat(target_xml, sizeof(target_xml), "gdb_core_xml_file); + pstrcat(target_xml, sizeof(target_xml), "\"/>"); for (r = cpu->gdb_regs; r; r = r->next) { pstrcat(target_xml, sizeof(target_xml), "xml); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1aafbf5..8828b16 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -98,6 +98,7 @@ struct TranslationBlock; * @vmsd: State description for migration. * @gdb_num_core_regs: Number of core registers accessible to GDB. * @gdb_core_xml_file: File name for core registers GDB XML description. + * @gdb_arch_name: Architecture name known to GDB. * * Represents a CPU family or model. */ @@ -147,6 +148,7 @@ typedef struct CPUClass { const struct VMStateDescription *vmsd; int gdb_num_core_regs; const char *gdb_core_xml_file; + const char *gdb_arch_name; } CPUClass; #ifdef HOST_WORDS_BIGENDIAN diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c index 38d2b84..9df7492 100644 --- a/target-arm/cpu64.c +++ b/target-arm/cpu64.c @@ -201,6 +201,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_name = "aarch64"; } static void aarch64_cpu_register(const ARMCPUInfo *info) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 48177ed..7165347 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9649,8 +9649,10 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #if defined(TARGET_PPC64) cc->gdb_core_xml_file = "power64-core.xml"; + cc->gdb_arch_name = "powerpc:common64"; #else cc->gdb_core_xml_file = "power-core.xml"; + cc->gdb_arch_name = "powerpc:common"; #endif #ifndef CONFIG_USER_ONLY cc->virtio_is_big_endian = ppc_cpu_is_big_endian; diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 4b03e42..5dae93c 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -262,6 +262,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) dc->vmsd = &vmstate_s390_cpu; cc->gdb_num_core_regs = S390_NUM_CORE_REGS; cc->gdb_core_xml_file = "s390x-core64.xml"; + cc->gdb_arch_name = "s390:64-bit"; } static const TypeInfo s390_cpu_type_info = { -- 1.8.5.5