[PATCH] Add StackGhost support to corelow.c

Mark Kettenis kettenis@chello.nl
Wed Apr 7 00:19:00 GMT 2004


This adds support for StackGhost cookies in core files.  Will check
this in in a few days.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* corelow.c (core_xfer_partial): Add support for
	TARGET_OBJECT_WCOOKIE.

Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.36
diff -u -p -r1.36 corelow.c
--- corelow.c 28 Feb 2004 18:04:36 -0000 1.36
+++ corelow.c 7 Apr 2004 00:17:54 -0000
@@ -564,6 +564,38 @@ core_xfer_partial (struct target_ops *op
 	}
       return -1;
 
+    case TARGET_OBJECT_WCOOKIE:
+      if (readbuf)
+	{
+	  /* When the aux vector is stored in core file, BFD
+	     represents this with a fake section called ".wcookie".  */
+
+	  struct bfd_section *section;
+	  bfd_size_type size;
+	  char *contents;
+
+	  section = bfd_get_section_by_name (core_bfd, ".wcookie");
+	  if (section == NULL)
+	    return -1;
+
+	  size = bfd_section_size (core_bfd, section);
+	  if (offset >= size)
+	    return 0;
+	  size -= offset;
+	  if (size > len)
+	    size = len;
+	  if (size > 0 &&
+	      ! bfd_get_section_contents (core_bfd, section, readbuf,
+					  (file_ptr) offset, size))
+	    {
+	      warning ("Couldn't read StackGhost cookie in core file.");
+	      return -1;
+	    }
+
+	  return size;
+	}
+      return -1;
+
     default:
       if (ops->beneath != NULL)
 	return ops->beneath->to_xfer_partial (ops->beneath, object, annex,



More information about the Gdb-patches mailing list