From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Received: (qmail 30545 invoked from network); 10 Apr 2004 09:49:25 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.113.248) by sources.redhat.com with SMTP; 10 Apr 2004 09:49:25 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i3A9nOM0005260 for ; Sat, 10 Apr 2004 11:49:24 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i3A9nOd0060290 for ; Sat, 10 Apr 2004 11:49:24 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i3A9nO2r060287; Sat, 10 Apr 2004 11:49:24 +0200 (CEST) Date: Sat, 10 Apr 2004 09:49:00 -0000 Message-Id: <200404100949.i3A9nO2r060287@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com In-reply-to: <200404070019.i370JLNa065626@elgar.kettenis.dyndns.org> (message from Mark Kettenis on Wed, 7 Apr 2004 02:19:21 +0200 (CEST)) Subject: Re: [PATCH] Add StackGhost support to corelow.c References: <200404070019.i370JLNa065626@elgar.kettenis.dyndns.org> X-SW-Source: 2004-04/txt/msg00238.txt.bz2 Date: Wed, 7 Apr 2004 02:19:21 +0200 (CEST) From: Mark Kettenis 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 * 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; }