This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Add StackGhost support to corelow.c
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;
}