This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[gdbserver] target doesn't support xml features -> crash.
- From: Pedro Alves <pedro_alves at portugalmail dot pt>
- To: gdb-patches at sourceware dot org
- Date: Sun, 25 Feb 2007 16:49:41 +0000
- Subject: [gdbserver] target doesn't support xml features -> crash.
Daniel,
The new xml features support introduced a gdbserver crash when the target
doesn't implement the target_ops->arch_string method. win32-i386-low is
one example.
This patch gets me going.
Ok?
Cheers,
Pedro Alves
---
gdb/gdbserver/ChangeLog:
* server.c (get_features_xml): Check if target implemented arch_string.
* win32-i386-low.c (win32_arch_string): New.
(win32_target_ops): Add win32_arch_string as arch_string member.
Index: src/gdb/gdbserver/server.c
===================================================================
--- src.orig/gdb/gdbserver/server.c 2007-02-25 12:46:40.000000000 +0000
+++ src/gdb/gdbserver/server.c 2007-02-25 12:55:10.000000000 +0000
@@ -216,7 +216,9 @@
if (features_supported == -1)
{
- const char *arch = (*the_target->arch_string) ();
+ const char *arch = NULL;
+ if (the_target->arch_string != NULL)
+ arch = (*the_target->arch_string) ();
if (arch == NULL)
features_supported = 0;
Index: src/gdb/gdbserver/win32-i386-low.c
===================================================================
--- src.orig/gdb/gdbserver/win32-i386-low.c 2007-02-25 12:46:42.000000000 +0000
+++ src/gdb/gdbserver/win32-i386-low.c 2007-02-25 13:06:28.000000000 +0000
@@ -1054,6 +1054,12 @@
return child_xfer_memory (memaddr, (char *) myaddr, len, 1, 0) != len;
}
+static const char *
+win32_arch_string (void)
+{
+ return "i386";
+}
+
static struct target_ops win32_target_ops = {
win32_create_inferior,
win32_attach,
@@ -1066,8 +1072,16 @@
win32_store_inferior_registers,
win32_read_inferior_memory,
win32_write_inferior_memory,
- 0,
- 0
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ win32_arch_string
};
/* Initialize the Win32 backend. */