Received: from eggs.gnu.org ([2001:4830:134:3::10]:37731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwgL4-0002mV-N4 for qemu-devel@nongnu.org; Tue, 09 Jul 2013 18:24:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwgKz-0002U2-AQ for qemu-devel@nongnu.org; Tue, 09 Jul 2013 18:24:50 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 10 Jul 2013 00:24:00 +0200 Message-Id: <1373408640-6046-42-git-send-email-afaerber@suse.de> In-Reply-To: <1373408640-6046-1-git-send-email-afaerber@suse.de> References: <1373408640-6046-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu v3 41/41] cpu: Introduce CPUClass::gdb_core_xml_file for GDB_CORE_XML List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Alexander Graf , "open list:PowerPC" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paul Brook Replace the GDB_CORE_XML define in gdbstub.c with a CPUClass field. Use first_cpu for qSupported and qXfer:features:read: for now. Add a stub for xml_builtin. Signed-off-by: Andreas F=C3=A4rber --- gdbstub.c | 42 ++++++++++++++-------------------------= --- include/qom/cpu.h | 2 ++ stubs/Makefile.objs | 1 + stubs/gdbstub.c | 5 +++++ target-arm/cpu.c | 1 + target-m68k/cpu.c | 1 + target-ppc/translate_init.c | 5 +++++ 7 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 stubs/gdbstub.c diff --git a/gdbstub.c b/gdbstub.c index d8a5a0e..1af25a6 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -485,25 +485,6 @@ static int put_packet(GDBState *s, const char *buf) return put_packet_binary(s, buf, strlen(buf)); } =20 -#if defined(TARGET_PPC) - -#if defined (TARGET_PPC64) -#define GDB_CORE_XML "power64-core.xml" -#else -#define GDB_CORE_XML "power-core.xml" -#endif - -#elif defined (TARGET_ARM) - -#define GDB_CORE_XML "arm-core.xml" - -#elif defined (TARGET_M68K) - -#define GDB_CORE_XML "cf-core.xml" - -#endif - -#ifdef GDB_CORE_XML /* Encode data using the encoding for 'x' packets. */ static int memtox(char *buf, const char *mem, int len) { @@ -525,7 +506,8 @@ static int memtox(char *buf, const char *mem, int len= ) return p - buf; } =20 -static const char *get_feature_xml(const char *p, const char **newp) +static const char *get_feature_xml(const char *p, const char **newp, + CPUClass *cc) { size_t len; int i; @@ -549,7 +531,7 @@ static const char *get_feature_xml(const char *p, con= st char **newp) "" "" "", - GDB_CORE_XML); + cc->gdb_core_xml_file); =20 for (r =3D cpu->gdb_regs; r; r =3D r->next) { pstrcat(target_xml, sizeof(target_xml), "gdb_core_xml_file !=3D NULL) { + pstrcat(buf, sizeof(buf), ";qXfer:features:read+"); + } put_packet(s, buf); break; } -#ifdef GDB_CORE_XML if (strncmp(p, "Xfer:features:read:", 19) =3D=3D 0) { const char *xml; target_ulong total_len; =20 + cc =3D CPU_GET_CLASS(first_cpu); + if (cc->gdb_core_xml_file =3D=3D NULL) { + goto unknown_command; + } + gdb_has_xml =3D true; p +=3D 19; - xml =3D get_feature_xml(p, &p); + xml =3D get_feature_xml(p, &p, cc); if (!xml) { snprintf(buf, sizeof(buf), "E00"); put_packet(s, buf); @@ -1180,7 +1167,6 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) put_packet_binary(s, buf, len + 1); break; } -#endif /* Unrecognised 'q' command. */ goto unknown_command; =20 diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 68b9879..c3f25be 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -80,6 +80,7 @@ struct TranslationBlock; * @gdb_write_register: Callback for letting GDB write a register. * @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. * * Represents a CPU family or model. */ @@ -121,6 +122,7 @@ typedef struct CPUClass { =20 const struct VMStateDescription *vmsd; int gdb_num_core_regs; + const char *gdb_core_xml_file; } CPUClass; =20 struct KVMState; diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 9b701b4..f306cba 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -7,6 +7,7 @@ stub-obj-y +=3D fdset-add-fd.o stub-obj-y +=3D fdset-find-fd.o stub-obj-y +=3D fdset-get-fd.o stub-obj-y +=3D fdset-remove-fd.o +stub-obj-y +=3D gdbstub.o stub-obj-y +=3D get-fd.o stub-obj-y +=3D get-vm-name.o stub-obj-y +=3D iothread-lock.o diff --git a/stubs/gdbstub.c b/stubs/gdbstub.c new file mode 100644 index 0000000..c1dbfe7 --- /dev/null +++ b/stubs/gdbstub.c @@ -0,0 +1,5 @@ +#include "qemu-common.h" + +const char *const xml_builtin[][2] =3D { + { NULL, NULL } +}; diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 103a840..c145277 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -826,6 +826,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void = *data) cc->vmsd =3D &vmstate_arm_cpu; #endif cc->gdb_num_core_regs =3D 26; + cc->gdb_core_xml_file =3D "arm-core.xml"; } =20 static void cpu_register(const ARMCPUInfo *info) diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c index 01a70f1..c0bcb0d 100644 --- a/target-m68k/cpu.c +++ b/target-m68k/cpu.c @@ -197,6 +197,7 @@ static void m68k_cpu_class_init(ObjectClass *c, void = *data) #endif dc->vmsd =3D &vmstate_m68k_cpu; cc->gdb_num_core_regs =3D 18; + cc->gdb_core_xml_file =3D "cf-core.xml"; } =20 static void register_cpu_type(const M68kCPUInfo *info) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 1bd3eaf..a20a941 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8306,6 +8306,11 @@ static void ppc_cpu_class_init(ObjectClass *oc, vo= id *data) #endif =20 cc->gdb_num_core_regs =3D 71; +#if defined(TARGET_PPC64) + cc->gdb_core_xml_file =3D "power64-core.xml"; +#else + cc->gdb_core_xml_file =3D "power-core.xml"; +#endif } =20 static const TypeInfo ppc_cpu_type_info =3D { --=20 1.8.1.4