* hpux-core.c: New file; backend for HP/UX style core files.
authorIan Lance Taylor <ian@airs.com>
Thu, 22 Jul 1993 19:39:41 +0000 (19:39 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 22 Jul 1993 19:39:41 +0000 (19:39 +0000)
* bfd.c (struct _bfd): Renamed hppa_core_data field to
hpux_core_data.
* bfd-in2.h: Updated.
* hppa.c (make_bfd_asection, hppa_core_file_p,
hppa_core_file_failing_command, hppa_core_file_failing_signal,
hppa_core_file_matches_executable_p): Moved into hpux-core.c.
Removed from target vector.
* libhppa.h (struct hppa_core_struct and accessor macros): Moved
into hpux-core.c.
* targets.c: If HPUX_CORE is defined, add hpux_core_vec to
target list.
* config/hp300.mh (HDEFINES): Set to -DHPUX_CORE.
(HDEPFILES): Set to hpux-core.o.
* config/hppabsd.mh, config/hppahpux.mh: Likewise.
* hosts/hp300.h (HOST_HP300HPUX): Define.
* Makefile.in (OPTIONAL_BACKENDS): Added sco-core.o,
aix386-core.o, hpux-core.o.
(sco-core.o, aix386-core.o, hpux-core.o): New dependencies.

bfd/ChangeLog
bfd/Makefile.in
bfd/bfd.c
bfd/hosts/hp300.h
bfd/hppa.c
bfd/targets.c

index 3395c41..634a2f6 100644 (file)
@@ -1,5 +1,25 @@
 Thu Jul 22 13:34:57 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
+       * hpux-core.c: New file; backend for HP/UX style core files.
+       * bfd.c (struct _bfd): Renamed hppa_core_data field to
+       hpux_core_data.
+       * bfd-in2.h: Updated.
+       * hppa.c (make_bfd_asection, hppa_core_file_p,
+       hppa_core_file_failing_command, hppa_core_file_failing_signal,
+       hppa_core_file_matches_executable_p): Moved into hpux-core.c.
+       Removed from target vector.
+       * libhppa.h (struct hppa_core_struct and accessor macros): Moved
+       into hpux-core.c.
+       * targets.c: If HPUX_CORE is defined, add hpux_core_vec to
+       target list.
+       * config/hp300.mh (HDEFINES): Set to -DHPUX_CORE.
+       (HDEPFILES): Set to hpux-core.o.
+       * config/hppabsd.mh, config/hppahpux.mh: Likewise.
+       * hosts/hp300.h (HOST_HP300HPUX): Define.
+       * Makefile.in (OPTIONAL_BACKENDS): Added sco-core.o,
+       aix386-core.o, hpux-core.o.
+       (sco-core.o, aix386-core.o, hpux-core.o): New dependencies.
+
        * reloc.c (enum complain_overflow): New enumeration with the
        various flavours of overflow checking.
        (srtuct reloc_howto_struct): Changed complain_on_overflow field
index c65c4c8..68d3fe4 100644 (file)
@@ -102,7 +102,7 @@ BFD64_BACKENDS = \
        nlm64.o nlm64-gen.o \
        aout64.o demo64.o
 
-OPTIONAL_BACKENDS = trad-core.o
+OPTIONAL_BACKENDS = trad-core.o sco-core.o aix386-core.o hpux-core.o
 
 # These are defined by configure.in:
 # WORDSIZE=32
@@ -452,6 +452,11 @@ reloc.o : reloc.c $(BFD_H) \
 
 trad-core.o : trad-core.c $(BFD_H) $(INCDIR)/obstack.h \
   libbfd.h libaout.h 
+sco-core.o : sco-core.c $(BFD_H) libbfd.h libcoff.h \
+  $(INCDIR)/obstack.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h
+aix386-core.o : aix386-core.c $(BFD_H) libbfd.h libcoff.h \
+  $(INCDIR)/obstack.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h
+hpux-core.o : hpux-core.c $(BFD_H) libbfd.h libhppa.h
 
 coff-msym.o: coff-msym.c $(BFD_H)  $(INCDIR)/coff/ecoff-ext.h \
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h
index 4a027aa..6b4d447 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -157,7 +157,7 @@ CODE_FRAGMENT
 .      struct sun_core_struct *sun_core_data;
 .      struct trad_core_struct *trad_core_data;
 .      struct hppa_data_struct *hppa_data;
-.      struct hppa_core_struct *hppa_core_data;
+.      struct hpux_core_struct *hpux_core_data;
 .      struct sgi_core_struct *sgi_core_data;
 .      PTR any;
 .      } tdata;
index 48f1e3d..525ca8e 100644 (file)
@@ -12,6 +12,8 @@
 #define SEEK_SET 0
 #define SEEK_CUR 1
 
+#define HOST_HP300HPUX
+
 #define USE_UTIME
 
 void free();
index 888c78e..2613573 100644 (file)
@@ -511,134 +511,6 @@ hppa_sizeof_headers (abfd, reloc)
   return (0);
 }
 
-static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power)
-     bfd *abfd;
-     CONST char *name;
-     flagword flags;
-     bfd_size_type _raw_size;
-     bfd_vma vma;
-     unsigned int alignment_power;
-{
-  asection *asect;
-
-  asect = bfd_make_section (abfd, name);
-  if (!asect)
-    return NULL;
-
-  asect->flags = flags;
-  asect->_raw_size = _raw_size;
-  asect->vma = vma;
-  asect->filepos = bfd_tell (abfd);
-  asect->alignment_power = alignment_power;
-
-  return asect;
-}
-
-#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD)
-/* This requires system include files.  */
-
-static bfd_target *
-hppa_core_file_p (abfd)
-     bfd *abfd;
-{
-  core_hdr (abfd) = bfd_zalloc (abfd, sizeof (struct hppa_core_struct));
-  if (!core_hdr (abfd))
-    return NULL;
-
-  while (1)
-    {
-      int val;
-      struct corehead core_header;
-
-      val = bfd_read ((void *) &core_header, 1, sizeof core_header, abfd);
-      if (val <= 0)
-       break;
-      switch (core_header.type)
-       {
-       case CORE_KERNEL:
-       case CORE_FORMAT:
-         bfd_seek (abfd, core_header.len, SEEK_CUR);   /* Just skip this */
-         break;
-       case CORE_EXEC:
-         {
-           struct proc_exec proc_exec;
-           bfd_read ((void *) &proc_exec, 1, core_header.len, abfd);
-           strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1);
-         }
-         break;
-       case CORE_PROC:
-         {
-           struct proc_info proc_info;
-           core_regsec (abfd) = make_bfd_asection (abfd, ".reg",
-                                              SEC_ALLOC + SEC_HAS_CONTENTS,
-                                                   core_header.len,
-                               (int) &proc_info - (int) &proc_info.hw_regs,
-                                                   2);
-           bfd_read (&proc_info, 1, core_header.len, abfd);
-           core_signal (abfd) = proc_info.sig;
-         }
-         if (!core_regsec (abfd))
-           return NULL;
-         break;
-       case CORE_DATA:
-         core_datasec (abfd) = make_bfd_asection (abfd, ".data",
-                                   SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
-                                                  core_header.len,
-                                                  core_header.addr,
-                                                  2);
-         if (!core_datasec (abfd))
-           return NULL;
-         bfd_seek (abfd, core_header.len, SEEK_CUR);
-         break;
-       case CORE_STACK:
-         core_stacksec (abfd) = make_bfd_asection (abfd, ".stack",
-                                   SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
-                                                   core_header.len,
-                                                   core_header.addr,
-                                                   2);
-         if (!core_stacksec (abfd))
-           return NULL;
-         bfd_seek (abfd, core_header.len, SEEK_CUR);
-         break;
-       default:
-         fprintf (stderr, "Unknown HPPA/HPUX core file section type %d\n",
-                  core_header.type);
-         bfd_seek (abfd, core_header.len, SEEK_CUR);
-         break;
-       }
-    }
-
-  /* OK, we believe you.  You're a core file (sure, sure).  */
-
-  return abfd->xvec;
-}
-
-static char *
-hppa_core_file_failing_command (abfd)
-     bfd *abfd;
-{
-  return core_command (abfd);
-}
-
-/* ARGSUSED */
-static int
-hppa_core_file_failing_signal (abfd)
-     bfd *abfd;
-{
-  return core_signal (abfd);
-}
-
-/* ARGSUSED */
-static boolean
-hppa_core_file_matches_executable_p (core_bfd, exec_bfd)
-     bfd *core_bfd, *exec_bfd;
-{
-  return true;                 /* FIXME, We have no way of telling at this point */
-}
-
-#endif /* HPUX or BSD.  */
-
 /* Miscellaneous Support Functions -- Control Structures and Functions
    for the PA.  */
 
@@ -1036,6 +908,11 @@ hppa_get_symbol_info (ignore_abfd, symbol, ret)
 #define hppa_bfd_make_debug_symbol \
   ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
+/* Core file support is in the hpux-core backend.  */
+#define hppa_core_file_failing_command _bfd_dummy_core_file_failing_command
+#define hppa_core_file_failing_signal  _bfd_dummy_core_file_failing_signal
+#define hppa_core_file_matches_executable_p    _bfd_dummy_core_file_matches_executable_p
+
 bfd_target hppa_vec =
 {
   "hppa",                      /* name */
@@ -1063,7 +940,7 @@ bfd_target hppa_vec =
   {_bfd_dummy_target,
    hppa_object_p,              /* bfd_check_format */
    bfd_generic_archive_p,
-   hppa_core_file_p,
+   bfd_false
   },
   {
     bfd_false,
index 75117e6..4fa2975 100644 (file)
@@ -328,16 +328,18 @@ in this structure.
 #if MINIMIZE && defined(DEFAULT_VECTOR) && !defined(SELECT_VECS)
 #ifdef TRAD_CORE
 #define SELECT_VECS &DEFAULT_VECTOR,&trad_core_vec
-#else
+#endif
 #ifdef SCO_CORE
 #define SELECT_VECS &DEFAULT_VECTOR,&sco_core_vec
-#else
+#endif
 #ifdef AIX386_CORE
 #define SELECT_VECS &DEFAULT_VECTOR,&aix386_core_vec
-#else
-#define SELECT_VECS &DEFAULT_VECTOR
 #endif
+#ifdef HPUX_CORE
+#define SELECT_VECS &DEFAULT_VECTOR,&hpux_core_vec
 #endif
+#ifndef SELECT_VECS
+#define SELECT_VECS &DEFAULT_VECTOR
 #endif
 #endif
 
@@ -385,6 +387,7 @@ extern bfd_target a29kcoff_big_vec;
 extern bfd_target trad_core_vec;
 extern bfd_target sco_core_vec;
 extern bfd_target aix386_core_vec;
+extern bfd_target hpux_core_vec;
 extern bfd_target rs6000coff_vec;
 extern bfd_target h8300coff_vec;
 extern bfd_target h8500coff_vec;
@@ -480,6 +483,9 @@ bfd_target *target_vector[] = {
 #ifdef AIX386_CORE
        &aix386_core_vec,
 #endif
+#ifdef HPUX_CORE
+       &hpux_core_vec,
+#endif
 
 #endif /* not SELECT_VECS */
        NULL, /* end of list marker */