Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/hpux-core.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end for HP/UX core files.
    2    Copyright 1993, 1994, 1996, 1998, 1999, 2001
     2   Copyright 1993, 1994, 1996, 1998, 1999, 2001
    33   Free Software Foundation, Inc.
    44   Written by Stu Grossman, Cygnus Support.
     
    101101#define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid)
    102102
    103 static void swap_abort PARAMS ((void));
     103static asection *make_bfd_asection
     104  PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma,
     105           unsigned int));
     106static const bfd_target *hpux_core_core_file_p
     107  PARAMS ((bfd *));
     108static char *hpux_core_core_file_failing_command
     109  PARAMS ((bfd *));
     110static int hpux_core_core_file_failing_signal
     111  PARAMS ((bfd *));
     112static bfd_boolean hpux_core_core_file_matches_executable_p
     113  PARAMS ((bfd *, bfd *));
     114static void swap_abort
     115  PARAMS ((void));
    104116
    105117static asection *
    106118make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power)
    107119     bfd *abfd;
    108      CONST char *name;
     120      char *name;
    109121     flagword flags;
    110122     bfd_size_type _raw_size;
     
    115127  char *newname;
    116128
    117   newname = bfd_alloc (abfd, strlen (name) + 1);
     129  newname = bfd_alloc (abfd, strlen (name) + 1);
    118130  if (!newname)
    119131    return NULL;
     
    132144
    133145  return asect;
    134 }
    135 
    136 static asymbol *
    137 hpux_core_make_empty_symbol (abfd)
    138      bfd *abfd;
    139 {
    140   asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
    141   if (new)
    142     new->the_bfd = abfd;
    143   return new;
    144146}
    145147
     
    161163
    162164  core_hdr (abfd) = (struct hpux_core_struct *)
    163     bfd_zalloc (abfd, sizeof (struct hpux_core_struct));
     165    bfd_zalloc (abfd, sizeof (struct hpux_core_struct));
    164166  if (!core_hdr (abfd))
    165167    return NULL;
     
    170172      struct corehead core_header;
    171173
    172       val = bfd_read ((void *) &core_header, 1, sizeof core_header, abfd);
     174      val = bfd_bread ((void *) &core_header,
     175                      (bfd_size_type) sizeof core_header, abfd);
    173176      if (val <= 0)
    174177        break;
     
    177180        case CORE_KERNEL:
    178181        case CORE_FORMAT:
    179           bfd_seek (abfd, core_header.len, SEEK_CUR);   /* Just skip this */
     182          /* Just skip this.  */
     183          bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR);
    180184          good_sections++;
    181185          break;
     
    183187          {
    184188            struct proc_exec proc_exec;
    185             if (bfd_read ((void *) &proc_exec, 1, core_header.len, abfd)
    186                 != core_header.len)
     189            if (bfd_
     190                != core_header.len)
    187191              break;
    188192            strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1);
     
    198202               whether the core-dumped app was threaded before we create
    199203               any .reg sections. */
    200             if (bfd_read (&proc_info, 1, core_header.len, abfd)
     204            if (bfd_ core_header.len, abfd)
    201205                != core_header.len)
    202206              break;
     
    204208              /* However, we also want to create those sections with the
    205209                 file positioned at the start of the record, it seems. */
    206             if (bfd_seek (abfd, -core_header.len, SEEK_CUR) != 0)
     210            if (bfd_seek (abfd, -core_header.len, SEEK_CUR) != 0)
    207211              break;
    208212
     
    234238                                        (int) &proc_info - (int) & proc_info.hw_regs,
    235239                                        2))
    236                   return NULL;
     240;
    237241              }
    238242            else
     
    247251                                            (int) &proc_info - (int) & proc_info.hw_regs,
    248252                                            2))
    249                       return NULL;
     253                      ;
    250254                  }
    251255                /* We always make one of these sections, for every thread. */
     
    256260                                        (int) &proc_info - (int) & proc_info.hw_regs,
    257261                                        2))
    258                   return NULL;
     262;
    259263              }
    260264            core_signal (abfd) = proc_info.sig;
    261             if (bfd_seek (abfd, core_header.len, SEEK_CUR) != 0)
     265            if (bfd_seek (abfd, core_header.len, SEEK_CUR) != 0)
    262266              break;
    263267            good_sections++;
     
    274278                                  SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
    275279                                  core_header.len, core_header.addr, 2))
    276             return NULL;
    277 
    278           bfd_seek (abfd, core_header.len, SEEK_CUR);
     280            ;
     281
     282          bfd_seek (abfd, core_header.len, SEEK_CUR);
    279283          good_sections++;
    280284          break;
     
    290294          break;
    291295
    292          default: return 0; /*unrecognized core file type */
     296         default:
     297           goto fail; /*unrecognized core file type */
    293298        }
    294299    }
     
    308313
    309314  return abfd->xvec;
     315
     316
     317
     318
     319
     320
    310321}
    311322
     
    326337
    327338/* ARGSUSED */
    328 static boolean
     339static boolean
    329340hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd)
    330      bfd *core_bfd, *exec_bfd;
    331 {
    332   return true;                  /* FIXME, We have no way of telling at this point */
    333 }
    334 
    335 
    336 #define hpux_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound
    337 #define hpux_core_get_symtab _bfd_nosymbols_get_symtab
    338 #define hpux_core_print_symbol _bfd_nosymbols_print_symbol
    339 #define hpux_core_get_symbol_info _bfd_nosymbols_get_symbol_info
    340 #define hpux_core_bfd_is_local_label_name \
    341   _bfd_nosymbols_bfd_is_local_label_name
    342 #define hpux_core_get_lineno _bfd_nosymbols_get_lineno
    343 #define hpux_core_find_nearest_line _bfd_nosymbols_find_nearest_line
    344 #define hpux_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
    345 #define hpux_core_read_minisymbols _bfd_nosymbols_read_minisymbols
    346 #define hpux_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
     341     bfd *core_bfd ATTRIBUTE_UNUSED;
     342     bfd *exec_bfd ATTRIBUTE_UNUSED;
     343{
     344  return TRUE;                  /* FIXME, We have no way of telling at this point */
     345}
     346
    347347
    348348/* If somebody calls any byte-swapping routines, shoot them.  */
    349349static void
    350 swap_abort()
     350swap_abort()
    351351{
    352352  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
     
    392392    },
    393393
    394        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
    395        BFD_JUMP_TABLE_COPY (_bfd_generic),
    396        BFD_JUMP_TABLE_CORE (hpux_core),
    397        BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
    398        BFD_JUMP_TABLE_SYMBOLS (hpux_core),
    399        BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
    400        BFD_JUMP_TABLE_WRITE (_bfd_generic),
    401        BFD_JUMP_TABLE_LINK (_bfd_nolink),
    402        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
     394    BFD_JUMP_TABLE_GENERIC (_bfd_generic),
     395    BFD_JUMP_TABLE_COPY (_bfd_generic),
     396    BFD_JUMP_TABLE_CORE (hpux_core),
     397    BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
     398    ),
     399    BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
     400    BFD_JUMP_TABLE_WRITE (_bfd_generic),
     401    BFD_JUMP_TABLE_LINK (_bfd_nolink),
     402    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
    403403
    404404    NULL,
Note: See TracChangeset for help on using the changeset viewer.