Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro_alves@portugalmail.pt>
To: gdb-patches@sourceware.org
Subject: [gdbserver] target doesn't support xml features -> crash.
Date: Sun, 25 Feb 2007 16:50:00 -0000	[thread overview]
Message-ID: <45E1BE25.4040407@portugalmail.pt> (raw)

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

             reply	other threads:[~2007-02-25 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-25 16:50 Pedro Alves [this message]
2007-02-25 17:22 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45E1BE25.4040407@portugalmail.pt \
    --to=pedro_alves@portugalmail.pt \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox