Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Add StackGhost support to corelow.c
@ 2004-04-07  0:19 Mark Kettenis
  2004-04-10  9:49 ` Mark Kettenis
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2004-04-07  0:19 UTC (permalink / raw)
  To: gdb-patches

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,


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

* Re: [PATCH] Add StackGhost support to corelow.c
  2004-04-07  0:19 [PATCH] Add StackGhost support to corelow.c Mark Kettenis
@ 2004-04-10  9:49 ` Mark Kettenis
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Kettenis @ 2004-04-10  9:49 UTC (permalink / raw)
  To: gdb-patches

   Date: Wed, 7 Apr 2004 02:19:21 +0200 (CEST)
   From: Mark Kettenis <kettenis@chello.nl>

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

   Mark

I noticed a pasto and a coding violation.  The attached is what I
actually committed.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* corelow.c (core_xfer_partial): Fix coding standards violation.
	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 10 Apr 2004 09:44:35 -0000
@@ -552,11 +552,43 @@ core_xfer_partial (struct target_ops *op
 	  size -= offset;
 	  if (size > len)
 	    size = len;
-	  if (size > 0 &&
-	      ! bfd_get_section_contents (core_bfd, section, readbuf,
-					  (file_ptr) offset, size))
+	  if (size > 0
+	      && !bfd_get_section_contents (core_bfd, section, readbuf,
+					    (file_ptr) offset, size))
 	    {
 	      warning ("Couldn't read NT_AUXV note in core file.");
+	      return -1;
+	    }
+
+	  return size;
+	}
+      return -1;
+
+    case TARGET_OBJECT_WCOOKIE:
+      if (readbuf)
+	{
+	  /* When the StackGhost cookie 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;
 	    }
 


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

end of thread, other threads:[~2004-04-10  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-07  0:19 [PATCH] Add StackGhost support to corelow.c Mark Kettenis
2004-04-10  9:49 ` Mark Kettenis

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