Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Add StackGhost support to corelow.c
Date: Sat, 10 Apr 2004 09:49:00 -0000	[thread overview]
Message-ID: <200404100949.i3A9nO2r060287@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <200404070019.i370JLNa065626@elgar.kettenis.dyndns.org> (message from Mark Kettenis on Wed, 7 Apr 2004 02:19:21 +0200 (CEST))

   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;
 	    }
 


      reply	other threads:[~2004-04-10  9:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-07  0:19 Mark Kettenis
2004-04-10  9:49 ` Mark Kettenis [this message]

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=200404100949.i3A9nO2r060287@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb-patches@sources.redhat.com \
    /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