Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [gdbserver] target doesn't support xml features -> crash.
@ 2007-02-25 16:50 Pedro Alves
  2007-02-25 17:22 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Alves @ 2007-02-25 16:50 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

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.


[-- Attachment #2: arch_string.diff --]
[-- Type: text/plain, Size: 1337 bytes --]

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.  */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-25 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-25 16:50 [gdbserver] target doesn't support xml features -> crash Pedro Alves
2007-02-25 17:22 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox