(c_variable_editable, cplus_variable_editable)
[deliverable/binutils-gdb.git] / bfd / ptrace-core.c
index 15b6777e121fc5db8aea774755b650dd495d0c52..a1aa34ce900c3504d5d57eb48d9a5714afdf34a5 100644 (file)
@@ -1,31 +1,32 @@
 /* BFD backend for core files which use the ptrace_user structure
-   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004,
+   2006, 2007  Free Software Foundation, Inc.
    The structure of this file is based on trad-core.c written by John Gilmore
    of Cygnus Support.
    Modified to work with the ptrace_user structure by Kevin A. Buettner.
    (Longterm it may be better to merge this file with trad-core.c)
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #ifdef PTRACE_CORE
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 
 #include <sys/param.h>
@@ -51,8 +52,7 @@ struct trad_core_struct
 const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd));
 char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
 int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
-bfd_boolean ptrace_unix_core_file_matches_executable_p
-  PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+#define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_executable_p
 static void swap_abort PARAMS ((void));
 
 const bfd_target *
@@ -64,6 +64,7 @@ ptrace_unix_core_file_p (abfd)
   struct ptrace_user u;
   struct trad_core_struct *rawptr;
   bfd_size_type amt;
+  flagword flags;
 
   val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
   if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
@@ -90,13 +91,17 @@ ptrace_unix_core_file_p (abfd)
 
   /* Create the sections.  */
 
-  core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+  flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+  core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+                                                            flags);
   if (core_stacksec (abfd) == NULL)
     goto fail;
-  core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+  core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+                                                           flags);
   if (core_datasec (abfd) == NULL)
     goto fail;
-  core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+  core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+                                                          SEC_HAS_CONTENTS);
   if (core_regsec (abfd) == NULL)
     goto fail;
 
@@ -104,13 +109,9 @@ ptrace_unix_core_file_p (abfd)
      text.  I don't think that any of these things are supported on the
      system on which I am developing this for though.  */
 
-  core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
-  core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
-  core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
-  core_datasec (abfd)->_raw_size =  u.pt_dsize;
-  core_stacksec (abfd)->_raw_size = u.pt_ssize;
-  core_regsec (abfd)->_raw_size = sizeof (u);
+  core_datasec (abfd)->size =  u.pt_dsize;
+  core_stacksec (abfd)->size = u.pt_ssize;
+  core_regsec (abfd)->size = sizeof (u);
 
   core_datasec (abfd)->vma = u.pt_o_data_start;
   core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize;
@@ -151,15 +152,6 @@ ptrace_unix_core_file_failing_signal (abfd)
 {
   return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num;
 }
-
-bfd_boolean
-ptrace_unix_core_file_matches_executable_p  (core_bfd, exec_bfd)
-     bfd *core_bfd, *exec_bfd;
-{
-  /* FIXME: Use pt_timdat field of the ptrace_user structure to match
-     the date of the executable */
-  return TRUE;
-}
 \f
 /* If somebody calls any byte-swapping routines, shoot them.  */
 static void
This page took 0.024742 seconds and 4 git commands to generate.