aboutsummaryrefslogtreecommitdiff
path: root/gdb/corelow.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-04-10 09:49:21 +0000
committerMark Kettenis <kettenis@gnu.org>2004-04-10 09:49:21 +0000
commit403e1656010a87cdf0776294cea9f6856c81f00a (patch)
treebd14cbaaca16b34a340fde201687a5e48fe51d74 /gdb/corelow.c
parenta57e5a958357b2aaa76253b106eedf486734c876 (diff)
downloadgdb-403e1656010a87cdf0776294cea9f6856c81f00a.zip
gdb-403e1656010a87cdf0776294cea9f6856c81f00a.tar.gz
gdb-403e1656010a87cdf0776294cea9f6856c81f00a.tar.bz2
* corelow.c (core_xfer_partial): Fix coding standards violation.
Add support for TARGET_OBJECT_WCOOKIE.
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r--gdb/corelow.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 403cfa3..c0b782d 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -552,9 +552,9 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
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;
@@ -564,6 +564,38 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
}
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;
+ }
+
+ return size;
+ }
+ return -1;
+
default:
if (ops->beneath != NULL)
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,