summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-05-02 19:51:47 +0000
committerdfr <dfr@FreeBSD.org>1999-05-02 19:51:47 +0000
commitc3bff79c67277ef1823f3dfe44024a8d08286598 (patch)
tree2c443fe82d35961d054ef5e80edfa6dac79373c4 /gnu
parent5ba529d419d8eb92b4821af4e4f8e4d1c1710288 (diff)
downloadFreeBSD-src-c3bff79c67277ef1823f3dfe44024a8d08286598.zip
FreeBSD-src-c3bff79c67277ef1823f3dfe44024a8d08286598.tar.gz
Remove old bmake framework for gdb. It has moved to live next to binutils.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/Makefile3
-rw-r--r--gnu/usr.bin/gdb/Makefile.inc7
-rw-r--r--gnu/usr.bin/gdb/bfd/Makefile31
-rw-r--r--gnu/usr.bin/gdb/bfd/bfd.h2479
-rw-r--r--gnu/usr.bin/gdb/bfd/config.h68
-rw-r--r--gnu/usr.bin/gdb/bfd/i386freebsd.h24
-rw-r--r--gnu/usr.bin/gdb/doc/Makefile24
-rw-r--r--gnu/usr.bin/gdb/gdb/Makefile131
-rw-r--r--gnu/usr.bin/gdb/gdb/config.h91
-rw-r--r--gnu/usr.bin/gdb/gdb/freebsd-nat.c440
-rw-r--r--gnu/usr.bin/gdb/gdb/gdb.1385
-rw-r--r--gnu/usr.bin/gdb/gdb/i386freebsd.h23
-rw-r--r--gnu/usr.bin/gdb/gdb/kvm-fbsd.c997
-rw-r--r--gnu/usr.bin/gdb/gdb/nm.h135
-rw-r--r--gnu/usr.bin/gdb/gdb/tm.h58
-rw-r--r--gnu/usr.bin/gdb/gdb/version.c3
-rw-r--r--gnu/usr.bin/gdb/gdb/xm.h23
-rw-r--r--gnu/usr.bin/gdb/gdbreplay/Makefile16
-rw-r--r--gnu/usr.bin/gdb/gdbserver/Makefile16
-rw-r--r--gnu/usr.bin/gdb/gdbserver/low-fbsd.c433
-rw-r--r--gnu/usr.bin/gdb/libiberty/Makefile15
-rw-r--r--gnu/usr.bin/gdb/libiberty/alloca-conf.h16
-rw-r--r--gnu/usr.bin/gdb/libiberty/config.h7
23 files changed, 0 insertions, 5425 deletions
diff --git a/gnu/usr.bin/gdb/Makefile b/gnu/usr.bin/gdb/Makefile
deleted file mode 100644
index 000bb74..0000000
--- a/gnu/usr.bin/gdb/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIR= bfd libiberty gdb doc gdbreplay gdbserver
-
-.include <bsd.subdir.mk>
diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc
deleted file mode 100644
index 5e39707..0000000
--- a/gnu/usr.bin/gdb/Makefile.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id: Makefile.inc,v 1.5 1998/10/15 00:15:01 peter Exp $
-
-CFLAGS+=-I${GDBDIR}/include -I${GDBDIR}/gdb -I${GDBDIR}/bfd
-CFLAGS+=-I${GDBDIR}/libiberty -I${GDBDIR}/gdb/config
-CFLAGS+=-DHAVE_CONFIG_H
-
-.include "../Makefile.inc"
diff --git a/gnu/usr.bin/gdb/bfd/Makefile b/gnu/usr.bin/gdb/bfd/Makefile
deleted file mode 100644
index e474809..0000000
--- a/gnu/usr.bin/gdb/bfd/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-LIB = bfd
-
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.PATH: ${GDBDIR}/bfd
-
-SRCS = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \
- archures.c coff-i386.c aout32.c \
- srec.c \
- ecoff.c ecofflink.c \
- coffgen.c format.c \
- section.c syms.c stab-syms.c reloc.c init.c \
- trad-core.c \
- i386aout.c \
- i386freebsd.c i386bsd.c \
- cpu-i386.c \
- elf.c \
- hash.c linker.c corefile.c binary.c \
- tekhex.c ihex.c
-
-CFLAGS+= -I${.CURDIR}/. -I${.CURDIR}/../gdb/.
-CFLAGS+= -DDEFAULT_VECTOR=i386freebsd_vec \
- -DSELECT_VECS='&i386freebsd_vec,&i386bsd_vec' \
- -DSELECT_ARCHITECTURES='&bfd_i386_arch' -DTRAD_CORE
-
-NOPROFILE=no
-NOPIC=no
-
-install:
- @echo -n
-
-.include <bsd.lib.mk>
diff --git a/gnu/usr.bin/gdb/bfd/bfd.h b/gnu/usr.bin/gdb/bfd/bfd.h
deleted file mode 100644
index c9b55d4..0000000
--- a/gnu/usr.bin/gdb/bfd/bfd.h
+++ /dev/null
@@ -1,2479 +0,0 @@
-/* Main header file for the bfd library -- portable access to object files.
- Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
-** instead, change bfd-in.h or the other BFD source files processed to
-** generate these files.
-
-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 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. */
-
-/* bfd.h -- The only header file required by users of the bfd library
-
-The bfd.h file is generated from bfd-in.h and various .c files; if you
-change it, your changes will probably be lost.
-
-All the prototypes and definitions following the comment "THE FOLLOWING
-IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
-BFD. If you change it, someone oneday will extract it from the source
-again, and your changes will be lost. To save yourself from this bind,
-change the definitions in the source in the bfd directory. Type "make
-docs" and then "make headers" in that directory, and magically this file
-will change to reflect your changes.
-
-If you don't have the tools to perform the extraction, then you are
-safe from someone on your system trampling over your header files.
-You should still maintain the equivalence between the source and this
-file though; every change you make to the .c file should be reflected
-here. */
-
-#ifndef __BFD_H_SEEN__
-#define __BFD_H_SEEN__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ansidecl.h"
-#include "obstack.h"
-
-/* These two lines get substitutions done by commands in Makefile.in. */
-#define BFD_VERSION "cygnus-2.6"
-#define BFD_ARCH_SIZE 32
-#define BFD_HOST_64BIT_LONG 0
-
-#if BFD_ARCH_SIZE >= 64
-#define BFD64
-#endif
-
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* forward declaration */
-typedef struct _bfd bfd;
-
-/* To squelch erroneous compiler warnings ("illegal pointer
- combination") from the SVR3 compiler, we would like to typedef
- boolean to int (it doesn't like functions which return boolean.
- Making sure they are never implicitly declared to return int
- doesn't seem to help). But this file is not configured based on
- the host. */
-/* General rules: functions which are boolean return true on success
- and false on failure (unless they're a predicate). -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
- force me to change it. */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-typedef enum bfd_boolean {false, true} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else. */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#endif
-
-/* A pointer to a position in a file. */
-/* FIXME: This should be using off_t from <sys/types.h>.
- For now, try to avoid breaking stuff by not including <sys/types.h> here.
- This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
- Probably the best long-term answer is to avoid using file_ptr AND off_t
- in this header file, and to handle this in the BFD implementation
- rather than in its interface. */
-/* typedef off_t file_ptr; */
-typedef long int file_ptr;
-
-/* Support for different sizes of target format ints and addresses.
- If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
- set to 1 above. Otherwise, if gcc is being used, this code will
- use gcc's "long long" type. Otherwise, the compilation will fail
- if 64-bit targets are requested. */
-
-#ifdef BFD64
-
-#ifndef BFD_HOST_64_BIT
-#if BFD_HOST_64BIT_LONG
-#define BFD_HOST_64_BIT long
-#else
-#ifdef __GNUC__
-#define BFD_HOST_64_BIT long long
-#endif /* defined (__GNUC__) */
-#endif /* ! BFD_HOST_64BIT_LONG */
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef unsigned BFD_HOST_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef unsigned BFD_HOST_64_BIT bfd_size_type;
-typedef unsigned BFD_HOST_64_BIT symvalue;
-
-#ifndef fprintf_vma
-#if BFD_HOST_64BIT_LONG
-#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
-#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
-#else
-#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
-#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
-#define fprintf_vma(s,x) \
- fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#define sprintf_vma(s,x) \
- sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#endif
-#endif
-
-#else /* not BFD64 */
-
-/* Represent a target address. Also used as a generic unsigned type
- which is guaranteed to be big enough to hold any arithmetic types
- we need to deal with. */
-typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
- arithmetic types we need to deal with. Can be assumed to be compatible
- with bfd_vma in the same way that signed and unsigned ints are compatible
- (as parameters, in assignment, etc). */
-typedef long bfd_signed_vma;
-
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
-
-/* Print a bfd_vma x on stream s. */
-#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
-#endif /* not BFD64 */
-#define printf_vma(x) fprintf_vma(stdout,x)
-
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
-
-/** File formats */
-
-typedef enum bfd_format {
- bfd_unknown = 0, /* file format is unknown */
- bfd_object, /* linker/assember/compiler output */
- bfd_archive, /* object archive file */
- bfd_core, /* core dump */
- bfd_type_end} /* marks the end; don't use it! */
- bfd_format;
-
-/* Values that may appear in the flags field of a BFD. These also
- appear in the object_flags field of the bfd_target structure, where
- they indicate the set of flags used by that backend (not all flags
- are meaningful for all object file formats) (FIXME: at the moment,
- the object_flags values have mostly just been copied from backend
- to another, and are not necessarily correct). */
-
-/* No flags. */
-#define NO_FLAGS 0x00
-
-/* BFD contains relocation entries. */
-#define HAS_RELOC 0x01
-
-/* BFD is directly executable. */
-#define EXEC_P 0x02
-
-/* BFD has line number information (basically used for F_LNNO in a
- COFF header). */
-#define HAS_LINENO 0x04
-
-/* BFD has debugging information. */
-#define HAS_DEBUG 0x08
-
-/* BFD has symbols. */
-#define HAS_SYMS 0x10
-
-/* BFD has local symbols (basically used for F_LSYMS in a COFF
- header). */
-#define HAS_LOCALS 0x20
-
-/* BFD is a dynamic object. */
-#define DYNAMIC 0x40
-
-/* Text section is write protected (if D_PAGED is not set, this is
- like an a.out NMAGIC file) (the linker sets this by default, but
- clears it for -r or -N). */
-#define WP_TEXT 0x80
-
-/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
- linker sets this by default, but clears it for -r or -n or -N). */
-#define D_PAGED 0x100
-
-/* BFD is relaxable (this means that bfd_relax_section may be able to
- do something) (sometimes bfd_relax_section can do something even if
- this is not set). */
-#define BFD_IS_RELAXABLE 0x200
-
-/* This may be set before writing out a BFD to request using a
- traditional format. For example, this is used to request that when
- writing out an a.out object the symbols not be hashed to eliminate
- duplicates. */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-/* This flag indicates that the BFD contents are actually cached in
- memory. If this is set, iostream points to a bfd_in_memory struct. */
-#define BFD_IN_MEMORY 0x800
-
-/* symbols and relocation */
-
-/* A count of carsyms (canonical archive symbols). */
-typedef unsigned long symindex;
-
-/* How to perform a relocation. */
-typedef const struct reloc_howto_struct reloc_howto_type;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* General purpose part of a symbol X;
- target specific parts are in libcoff.h, libaout.h, etc. */
-
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
-
-/* A canonical archive symbol. */
-/* This is a type pun with struct ranlib on purpose! */
-typedef struct carsym {
- char *name;
- file_ptr file_offset; /* look here to find the file */
-} carsym; /* to make these you call a carsymogen */
-
-
-/* Used in generating armaps (archive tables of contents).
- Perhaps just a forward definition would do? */
-struct orl { /* output ranlib */
- char **name; /* symbol name */
- file_ptr pos; /* bfd* or file position */
- int namidx; /* index into string table */
-};
-
-
-/* Linenumber stuff */
-typedef struct lineno_cache_entry {
- unsigned int line_number; /* Linenumber from start of function*/
- union {
- struct symbol_cache_entry *sym; /* Function name */
- unsigned long offset; /* Offset into section */
- } u;
-} alent;
-
-/* object and core file sections */
-
-#define align_power(addr, align) \
- ( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
-
-typedef struct sec *sec_ptr;
-
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
-#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
-#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
-#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
-
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
-
-typedef struct stat stat_type;
-
-typedef enum bfd_print_symbol
-{
- bfd_print_symbol_name,
- bfd_print_symbol_more,
- bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs. */
-
-typedef struct _symbol_info
-{
- symvalue value;
- char type;
- CONST char *name; /* Symbol name. */
- unsigned char stab_type; /* Stab type. */
- char stab_other; /* Stab other. */
- short stab_desc; /* Stab desc. */
- CONST char *stab_name; /* String for stab type. */
-} symbol_info;
-
-/* Get the name of a stabs type code. */
-
-extern const char *bfd_get_stab_name PARAMS ((int));
-
-/* Hash table routines. There is no way to free up a hash table. */
-
-/* An element in the hash table. Most uses will actually use a larger
- structure, and an instance of this will be the first field. */
-
-struct bfd_hash_entry
-{
- /* Next entry for this hash code. */
- struct bfd_hash_entry *next;
- /* String being hashed. */
- const char *string;
- /* Hash code. This is the full hash code, not the index into the
- table. */
- unsigned long hash;
-};
-
-/* A hash table. */
-
-struct bfd_hash_table
-{
- /* The hash array. */
- struct bfd_hash_entry **table;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* A function used to create new elements in the hash table. The
- first entry is itself a pointer to an element. When this
- function is first invoked, this pointer will be NULL. However,
- having the pointer permits a hierarchy of method functions to be
- built each of which calls the function in the superclass. Thus
- each function should be written to allocate a new block of memory
- only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
- /* An obstack for this hash table. */
- struct obstack memory;
-};
-
-/* Initialize a hash table. */
-extern boolean bfd_hash_table_init
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-
-/* Initialize a hash table specifying a size. */
-extern boolean bfd_hash_table_init_n
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int size));
-
-/* Free up a hash table. */
-extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
-
-/* Look up a string in a hash table. If CREATE is true, a new entry
- will be created for this string if one does not already exist. The
- COPY argument must be true if this routine should copy the string
- into newly allocated memory when adding an entry. */
-extern struct bfd_hash_entry *bfd_hash_lookup
- PARAMS ((struct bfd_hash_table *, const char *, boolean create,
- boolean copy));
-
-/* Replace an entry in a hash table. */
-extern void bfd_hash_replace
- PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw));
-
-/* Base method for creating a hash table entry. */
-extern struct bfd_hash_entry *bfd_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
-
-/* Grab some space for a hash table entry. */
-extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
- unsigned int));
-
-/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns false, the traversal stops. The
- INFO argument is passed to the function. */
-extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
- boolean (*) (struct bfd_hash_entry *,
- PTR),
- PTR info));
-
-/* Semi-portable string concatenation in cpp.
- The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the
- inner CAT macros to be evaluated first, producing still-valid pp-tokens.
- Then the final concatenation can be done. (Sigh.) */
-#ifndef CAT
-#ifdef SABER
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define CAT4(a,b,c,d) a##b##c##d
-#else
-#if defined(__STDC__) || defined(ALMOST_STDC)
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define XCAT2(a,b) CAT(a,b)
-#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d))
-#else
-#define CAT(a,b) a/**/b
-#define CAT3(a,b,c) a/**/b/**/c
-#define CAT4(a,b,c,d) a/**/b/**/c/**/d
-#endif
-#endif
-#endif
-
-#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities */
-
-/* Direct I/O routines, for programs which know more about the object
- file than BFD does. Use higher level routines if possible. */
-
-extern bfd_size_type bfd_read
- PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern bfd_size_type bfd_write
- PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
-extern long bfd_tell PARAMS ((bfd *abfd));
-extern int bfd_flush PARAMS ((bfd *abfd));
-extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
-
-
-/* Cast from const char * to char * so that caller can assign to
- a char * without a warning. */
-#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
-#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
-#define bfd_get_format(abfd) ((abfd)->format)
-#define bfd_get_target(abfd) ((abfd)->xvec->name)
-#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
-#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
-#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_header_big_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
-#define bfd_header_little_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_get_file_flags(abfd) ((abfd)->flags)
-#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
-#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
-#define bfd_my_archive(abfd) ((abfd)->my_archive)
-#define bfd_has_map(abfd) ((abfd)->has_armap)
-
-#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
-#define bfd_usrdata(abfd) ((abfd)->usrdata)
-
-#define bfd_get_start_address(abfd) ((abfd)->start_address)
-#define bfd_get_symcount(abfd) ((abfd)->symcount)
-#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
-#define bfd_count_sections(abfd) ((abfd)->section_count)
-
-#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
-
-extern boolean bfd_record_phdr
- PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
- boolean, boolean, unsigned int, struct sec **));
-
-/* Byte swapping routines. */
-
-bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb16 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
-void bfd_putb64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
-
-/* Externally visible ECOFF routines. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct symbol_cache_entry;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-#endif
-extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
-extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
-extern boolean bfd_ecoff_set_regmasks
- PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
- unsigned long *cprmask));
-extern PTR bfd_ecoff_debug_init
- PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
-extern void bfd_ecoff_debug_free
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- bfd *input_bfd, struct ecoff_debug_info *input_debug,
- const struct ecoff_debug_swap *input_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate_other
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_externals
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- boolean relocateable,
- boolean (*get_extr) (struct symbol_cache_entry *,
- struct ecoff_extr *),
- void (*set_index) (struct symbol_cache_entry *,
- bfd_size_type)));
-extern boolean bfd_ecoff_debug_one_external
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- const char *name, struct ecoff_extr *esym));
-extern bfd_size_type bfd_ecoff_debug_size
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap));
-extern boolean bfd_ecoff_write_debug
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, file_ptr where));
-extern boolean bfd_ecoff_write_accumulated_debug
- PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- struct bfd_link_info *info, file_ptr where));
-extern boolean bfd_mips_ecoff_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
-
-/* Externally visible ELF routines. */
-
-struct bfd_link_needed_list
-{
- struct bfd_link_needed_list *next;
- bfd *by;
- const char *name;
-};
-
-extern boolean bfd_elf32_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern boolean bfd_elf64_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern struct bfd_link_needed_list *bfd_elf_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean,
- struct bfd_link_info *, struct sec **));
-extern boolean bfd_elf64_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean,
- struct bfd_link_info *, struct sec **));
-extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
-extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
-
-/* SunOS shared library support routines for the linker. */
-
-extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sunos_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_sunos_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
- struct sec **));
-
-/* Linux shared library support routines for the linker. */
-
-extern boolean bfd_i386linux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_m68klinux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window {
- /* What the user asked for. */
- PTR data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-} bfd_window;
-
-extern void bfd_init_window PARAMS ((bfd_window *));
-extern void bfd_free_window PARAMS ((bfd_window *));
-extern boolean bfd_get_file_window
- PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
-
-/* XCOFF support routines for the linker. */
-
-extern boolean bfd_xcoff_link_record_set
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_size_type));
-extern boolean bfd_xcoff_import_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
-extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
-extern boolean bfd_xcoff_link_count_reloc
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
- unsigned long, unsigned long, unsigned long, boolean,
- int, boolean, boolean, struct sec **));
-
-/* And more from the source. */
-void
-bfd_init PARAMS ((void));
-
-bfd *
-bfd_openr PARAMS ((CONST char *filename, CONST char *target));
-
-bfd *
-bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
-
-bfd *
-bfd_openstreamr PARAMS (());
-
-bfd *
-bfd_openw PARAMS ((CONST char *filename, CONST char *target));
-
-boolean
-bfd_close PARAMS ((bfd *abfd));
-
-boolean
-bfd_close_all_done PARAMS ((bfd *));
-
-bfd_size_type
-bfd_alloc_size PARAMS ((bfd *abfd));
-
-bfd *
-bfd_create PARAMS ((CONST char *filename, bfd *templ));
-
-
- /* Byte swapping macros for user section data. */
-
-#define bfd_put_8(abfd, val, ptr) \
- (*((unsigned char *)(ptr)) = (unsigned char)(val))
-#define bfd_put_signed_8 \
- bfd_put_8
-#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *)(ptr))
-#define bfd_get_signed_8(abfd, ptr) \
- ((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
- bfd_put_16
-#define bfd_get_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
- bfd_put_32
-#define bfd_get_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
- bfd_put_64
-#define bfd_get_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
-
-
- /* Byte swapping macros for file header data. */
-
-#define bfd_h_put_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
-#define bfd_h_put_signed_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
-#define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
-#define bfd_h_get_signed_8(abfd, ptr) \
- bfd_get_signed_8 (abfd, ptr)
-
-#define bfd_h_put_16(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
-#define bfd_h_put_signed_16 \
- bfd_h_put_16
-#define bfd_h_get_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx16,(ptr))
-#define bfd_h_get_signed_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
-
-#define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
-#define bfd_h_put_signed_32 \
- bfd_h_put_32
-#define bfd_h_get_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx32,(ptr))
-#define bfd_h_get_signed_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
-
-#define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
-#define bfd_h_put_signed_64 \
- bfd_h_put_64
-#define bfd_h_get_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx64,(ptr))
-#define bfd_h_get_signed_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
-
-typedef struct sec
-{
- /* The name of the section; the name isn't a copy, the pointer is
- the same as that passed to bfd_make_section. */
-
- CONST char *name;
-
- /* Which section is it; 0..nth. */
-
- int index;
-
- /* The next section in the list belonging to the BFD, or NULL. */
-
- struct sec *next;
-
- /* The field flags contains attributes of the section. Some
- flags are read in from the object file, and some are
- synthesized from other information. */
-
- flagword flags;
-
-#define SEC_NO_FLAGS 0x000
-
- /* Tells the OS to allocate space for this section when loading.
- This is clear for a section containing debug information
- only. */
-#define SEC_ALLOC 0x001
-
- /* Tells the OS to load the section from the file when loading.
- This is clear for a .bss section. */
-#define SEC_LOAD 0x002
-
- /* The section contains data still to be relocated, so there is
- some relocation information too. */
-#define SEC_RELOC 0x004
-
-#if 0 /* Obsolete ? */
-#define SEC_BALIGN 0x008
-#endif
-
- /* A signal to the OS that the section contains read only
- data. */
-#define SEC_READONLY 0x010
-
- /* The section contains code only. */
-#define SEC_CODE 0x020
-
- /* The section contains data only. */
-#define SEC_DATA 0x040
-
- /* The section will reside in ROM. */
-#define SEC_ROM 0x080
-
- /* The section contains constructor information. This section
- type is used by the linker to create lists of constructors and
- destructors used by <<g++>>. When a back end sees a symbol
- which should be used in a constructor list, it creates a new
- section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
- the symbol to it, and builds a relocation. To build the lists
- of constructors, all the linker has to do is catenate all the
- sections called <<__CTOR_LIST__>> and relocate the data
- contained within - exactly the operations it would peform on
- standard data. */
-#define SEC_CONSTRUCTOR 0x100
-
- /* The section is a constuctor, and should be placed at the
- end of the text, data, or bss section(?). */
-#define SEC_CONSTRUCTOR_TEXT 0x1100
-#define SEC_CONSTRUCTOR_DATA 0x2100
-#define SEC_CONSTRUCTOR_BSS 0x3100
-
- /* The section has contents - a data section could be
- <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
- <<SEC_HAS_CONTENTS>> */
-#define SEC_HAS_CONTENTS 0x200
-
- /* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
-#define SEC_NEVER_LOAD 0x400
-
- /* The section is a COFF shared library section. This flag is
- only for the linker. If this type of section appears in
- the input file, the linker must copy it to the output file
- without changing the vma or size. FIXME: Although this
- was originally intended to be general, it really is COFF
- specific (and the flag was renamed to indicate this). It
- might be cleaner to have some more general mechanism to
- allow the back end to control what the linker does with
- sections. */
-#define SEC_COFF_SHARED_LIBRARY 0x800
-
- /* The section is a common section (symbols may be defined
- multiple times, the value of a symbol is the amount of
- space it requires, and the largest symbol value is the one
- used). Most targets have exactly one of these (which we
- translate to bfd_com_section_ptr), but ECOFF has two. */
-#define SEC_IS_COMMON 0x8000
-
- /* The section contains only debugging information. For
- example, this is set for ELF .debug and .stab sections.
- strip tests this flag to see if a section can be
- discarded. */
-#define SEC_DEBUGGING 0x10000
-
- /* The contents of this section are held in memory pointed to
- by the contents field. This is checked by
- bfd_get_section_contents, and the data is retrieved from
- memory if appropriate. */
-#define SEC_IN_MEMORY 0x20000
-
- /* The contents of this section are to be excluded by the
- linker for executable and shared objects unless those
- objects are to be further relocated. */
-#define SEC_EXCLUDE 0x40000
-
- /* The contents of this section are to be sorted by the
- based on the address specified in the associated symbol
- table. */
-#define SEC_SORT_ENTRIES 0x80000
-
- /* End of section flags. */
-
- /* The virtual memory address of the section - where it will be
- at run time. The symbols are relocated against this. The
- user_set_vma flag is maintained by bfd; if it's not set, the
- backend can assign addresses (for example, in <<a.out>>, where
- the default address for <<.data>> is dependent on the specific
- target and various flags). */
-
- bfd_vma vma;
- boolean user_set_vma;
-
- /* The load address of the section - where it would be in a
- rom image; really only used for writing section header
- information. */
-
- bfd_vma lma;
-
- /* The size of the section in bytes, as it will be output.
- contains a value even if the section has no contents (e.g., the
- size of <<.bss>>). This will be filled in after relocation */
-
- bfd_size_type _cooked_size;
-
- /* The original size on disk of the section, in bytes. Normally this
- value is the same as the size, but if some relaxing has
- been done, then this value will be bigger. */
-
- bfd_size_type _raw_size;
-
- /* If this section is going to be output, then this value is the
- offset into the output section of the first byte in the input
- section. E.g., if this was going to start at the 100th byte in
- the output section, this value would be 100. */
-
- bfd_vma output_offset;
-
- /* The output section through which to map on output. */
-
- struct sec *output_section;
-
- /* The alignment requirement of the section, as an exponent of 2 -
- e.g., 3 aligns to 2^3 (or 8). */
-
- unsigned int alignment_power;
-
- /* If an input section, a pointer to a vector of relocation
- records for the data in this section. */
-
- struct reloc_cache_entry *relocation;
-
- /* If an output section, a pointer to a vector of pointers to
- relocation records for the data in this section. */
-
- struct reloc_cache_entry **orelocation;
-
- /* The number of relocation records in one of the above */
-
- unsigned reloc_count;
-
- /* Information below is back end specific - and not always used
- or updated. */
-
- /* File position of section data */
-
- file_ptr filepos;
-
- /* File position of relocation info */
-
- file_ptr rel_filepos;
-
- /* File position of line data */
-
- file_ptr line_filepos;
-
- /* Pointer to data for applications */
-
- PTR userdata;
-
- /* If the SEC_IN_MEMORY flag is set, this points to the actual
- contents. */
- unsigned char *contents;
-
- /* Attached line number information */
-
- alent *lineno;
-
- /* Number of line number records */
-
- unsigned int lineno_count;
-
- /* When a section is being output, this value changes as more
- linenumbers are written out */
-
- file_ptr moving_line_filepos;
-
- /* What the section number is in the target world */
-
- int target_index;
-
- PTR used_by_bfd;
-
- /* If this is a constructor section then here is a list of the
- relocations created to relocate items within it. */
-
- struct relent_chain *constructor_chain;
-
- /* The BFD which owns the section. */
-
- bfd *owner;
-
- boolean reloc_done;
- /* A symbol which points at this section only */
- struct symbol_cache_entry *symbol;
- struct symbol_cache_entry **symbol_ptr_ptr;
-
- struct bfd_link_order *link_order_head;
- struct bfd_link_order *link_order_tail;
-} asection ;
-
- /* These sections are global, and are managed by BFD. The application
- and target back end are not permitted to change the values in
- these sections. New code should use the section_ptr macros rather
- than referring directly to the const sections. The const sections
- may eventually vanish. */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
- /* the absolute section */
-extern const asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
- /* Pointer to the undefined section */
-extern const asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
- /* Pointer to the common section */
-extern const asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
- /* Pointer to the indirect section */
-extern const asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-extern const struct symbol_cache_entry * const bfd_abs_symbol;
-extern const struct symbol_cache_entry * const bfd_com_symbol;
-extern const struct symbol_cache_entry * const bfd_und_symbol;
-extern const struct symbol_cache_entry * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
- (section->reloc_done ? (abort(),1): (section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
- ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
-asection *
-bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
-
-asection *
-bfd_make_section_old_way PARAMS ((bfd *abfd, CONST char *name));
-
-asection *
-bfd_make_section_anyway PARAMS ((bfd *abfd, CONST char *name));
-
-asection *
-bfd_make_section PARAMS ((bfd *, CONST char *name));
-
-boolean
-bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
-
-void
-bfd_map_over_sections PARAMS ((bfd *abfd,
- void (*func)(bfd *abfd,
- asection *sect,
- PTR obj),
- PTR obj));
-
-boolean
-bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
-
-boolean
-bfd_set_section_contents
- PARAMS ((bfd *abfd,
- asection *section,
- PTR data,
- file_ptr offset,
- bfd_size_type count));
-
-boolean
-bfd_get_section_contents
- PARAMS ((bfd *abfd, asection *section, PTR location,
- file_ptr offset, bfd_size_type count));
-
-boolean
-bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec));
-
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
- BFD_SEND (ibfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
-enum bfd_architecture
-{
- bfd_arch_unknown, /* File arch not known */
- bfd_arch_obscure, /* Arch known, not one of these */
- bfd_arch_m68k, /* Motorola 68xxx */
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
-#define bfd_mach_i960_core 1
-#define bfd_mach_i960_ka_sa 2
-#define bfd_mach_i960_kb_sb 3
-#define bfd_mach_i960_mc 4
-#define bfd_mach_i960_xa 5
-#define bfd_mach_i960_ca 6
-#define bfd_mach_i960_jx 7
-#define bfd_mach_i960_hx 8
-
- bfd_arch_a29k, /* AMD 29000 */
- bfd_arch_sparc, /* SPARC */
-#define bfd_mach_sparc 1
- /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
-#define bfd_mach_sparc_v8plus 2
-#define bfd_mach_sparc_v8plusa 3 /* with ultrasparc add'ns */
-#define bfd_mach_sparc_v9 4
-#define bfd_mach_sparc_v9a 5 /* with ultrasparc add'ns */
- /* Nonzero if MACH has the v9 instruction set. */
-#define bfd_mach_sparc_v9_p(mach) ((mach) != bfd_mach_sparc)
- bfd_arch_mips, /* MIPS Rxxxx */
- bfd_arch_i386, /* Intel 386 */
- bfd_arch_we32k, /* AT&T WE32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_romp, /* IBM ROMP PC/RT */
- bfd_arch_alliant, /* Alliant */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8300, /* Hitachi H8/300 */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
- bfd_arch_powerpc, /* PowerPC */
- bfd_arch_rs6000, /* IBM RS/6000 */
- bfd_arch_hppa, /* HP PA RISC */
- bfd_arch_z8k, /* Zilog Z8000 */
-#define bfd_mach_z8001 1
-#define bfd_mach_z8002 2
- bfd_arch_h8500, /* Hitachi H8/500 */
- bfd_arch_sh, /* Hitachi SH */
- bfd_arch_alpha, /* Dec Alpha */
- bfd_arch_arm, /* Advanced Risc Machines ARM */
- bfd_arch_ns32k, /* National Semiconductors ns32000 */
- bfd_arch_w65, /* WDC 65816 */
- bfd_arch_last
- };
-
-typedef struct bfd_arch_info
-{
- int bits_per_word;
- int bits_per_address;
- int bits_per_byte;
- enum bfd_architecture arch;
- unsigned long mach;
- const char *arch_name;
- const char *printable_name;
- unsigned int section_align_power;
- /* true if this is the default machine for the architecture */
- boolean the_default;
- const struct bfd_arch_info * (*compatible)
- PARAMS ((const struct bfd_arch_info *a,
- const struct bfd_arch_info *b));
-
- boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
-
- const struct bfd_arch_info *next;
-} bfd_arch_info_type;
-const char *
-bfd_printable_name PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_scan_arch PARAMS ((const char *string));
-
-const bfd_arch_info_type *
-bfd_arch_get_compatible PARAMS ((
- const bfd *abfd,
- const bfd *bbfd));
-
-void
-bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
-
-enum bfd_architecture
-bfd_get_arch PARAMS ((bfd *abfd));
-
-unsigned long
-bfd_get_mach PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_address PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_get_arch_info PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_lookup_arch
- PARAMS ((enum bfd_architecture
- arch,
- unsigned long machine));
-
-const char *
-bfd_printable_arch_mach
- PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
-typedef enum bfd_reloc_status
-{
- /* No errors detected */
- bfd_reloc_ok,
-
- /* The relocation was performed, but there was an overflow. */
- bfd_reloc_overflow,
-
- /* The address to relocate was not within the section supplied. */
- bfd_reloc_outofrange,
-
- /* Used by special functions */
- bfd_reloc_continue,
-
- /* Unsupported relocation size requested. */
- bfd_reloc_notsupported,
-
- /* Unused */
- bfd_reloc_other,
-
- /* The symbol to relocate against was undefined. */
- bfd_reloc_undefined,
-
- /* The relocation was performed, but may not be ok - presently
- generated only when linking i960 coff files with i960 b.out
- symbols. If this type is returned, the error_message argument
- to bfd_perform_relocation will be set. */
- bfd_reloc_dangerous
- }
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-{
- /* A pointer into the canonical table of pointers */
- struct symbol_cache_entry **sym_ptr_ptr;
-
- /* offset in section */
- bfd_size_type address;
-
- /* addend for relocation value */
- bfd_vma addend;
-
- /* Pointer to how to perform the required relocation */
- reloc_howto_type *howto;
-
-} arelent;
-enum complain_overflow
-{
- /* Do not complain on overflow. */
- complain_overflow_dont,
-
- /* Complain if the bitfield overflows, whether it is considered
- as signed or unsigned. */
- complain_overflow_bitfield,
-
- /* Complain if the value overflows when considered as signed
- number. */
- complain_overflow_signed,
-
- /* Complain if the value overflows when considered as an
- unsigned number. */
- complain_overflow_unsigned
-};
-
-struct reloc_howto_struct
-{
- /* The type field has mainly a documetary use - the back end can
- do what it wants with it, though normally the back end's
- external idea of what a reloc number is stored
- in this field. For example, a PC relative word relocation
- in a coff environment has the type 023 - because that's
- what the outside world calls a R_PCRWORD reloc. */
- unsigned int type;
-
- /* The value the final relocation is shifted right by. This drops
- unwanted data from the relocation. */
- unsigned int rightshift;
-
- /* The size of the item to be relocated. This is *not* a
- power-of-two measure. To get the number of bytes operated
- on by a type of relocation, use bfd_get_reloc_size. */
- int size;
-
- /* The number of bits in the item to be relocated. This is used
- when doing overflow checking. */
- unsigned int bitsize;
-
- /* Notes that the relocation is relative to the location in the
- data section of the addend. The relocation function will
- subtract from the relocation value the address of the location
- being relocated. */
- boolean pc_relative;
-
- /* The bit position of the reloc value in the destination.
- The relocated value is left shifted by this amount. */
- unsigned int bitpos;
-
- /* What type of overflow error should be checked for when
- relocating. */
- enum complain_overflow complain_on_overflow;
-
- /* If this field is non null, then the supplied function is
- called rather than the normal function. This allows really
- strange relocation methods to be accomodated (e.g., i960 callj
- instructions). */
- bfd_reloc_status_type (*special_function)
- PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- struct symbol_cache_entry *symbol,
- PTR data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message));
-
- /* The textual name of the relocation type. */
- char *name;
-
- /* When performing a partial link, some formats must modify the
- relocations rather than the data - this flag signals this.*/
- boolean partial_inplace;
-
- /* The src_mask selects which parts of the read in data
- are to be used in the relocation sum. E.g., if this was an 8 bit
- bit of data which we read and relocated, this would be
- 0x000000ff. When we have relocs which have an addend, such as
- sun4 extended relocs, the value in the offset part of a
- relocating field is garbage so we never use it. In this case
- the mask would be 0x00000000. */
- bfd_vma src_mask;
-
- /* The dst_mask selects which parts of the instruction are replaced
- into the instruction. In most cases src_mask == dst_mask,
- except in the above special case, where dst_mask would be
- 0x000000ff, and src_mask would be 0x00000000. */
- bfd_vma dst_mask;
-
- /* When some formats create PC relative instructions, they leave
- the value of the pc of the place being relocated in the offset
- slot of the instruction, so that a PC relative relocation can
- be made just by adding in an ordinary offset (e.g., sun3 a.out).
- Some formats leave the displacement part of an instruction
- empty (e.g., m88k bcs); this flag signals the fact.*/
- boolean pcrel_offset;
-
-};
-#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
- {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
-#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
-
-#define HOWTO_PREPARE(relocation, symbol) \
- { \
- if (symbol != (asymbol *)NULL) { \
- if (bfd_is_com_section (symbol->section)) { \
- relocation = 0; \
- } \
- else { \
- relocation = symbol->value; \
- } \
- } \
-}
-int
-bfd_get_reloc_size PARAMS ((reloc_howto_type *));
-
-typedef struct relent_chain {
- arelent relent;
- struct relent_chain *next;
-} arelent_chain;
-bfd_reloc_status_type
-
-bfd_perform_relocation
- PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- PTR data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message));
-
-bfd_reloc_status_type
-
-bfd_install_relocation
- PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- PTR data, bfd_vma data_start,
- asection *input_section,
- char **error_message));
-
-enum bfd_reloc_code_real {
- _dummy_first_bfd_reloc_code_real,
-
-
-/* Basic absolute relocations of N bits. */
- BFD_RELOC_64,
- BFD_RELOC_32,
- BFD_RELOC_26,
- BFD_RELOC_16,
- BFD_RELOC_14,
- BFD_RELOC_8,
-
-/* PC-relative relocations. Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation. It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations. */
- BFD_RELOC_64_PCREL,
- BFD_RELOC_32_PCREL,
- BFD_RELOC_24_PCREL,
- BFD_RELOC_16_PCREL,
- BFD_RELOC_12_PCREL,
- BFD_RELOC_8_PCREL,
-
-/* For ELF. */
- BFD_RELOC_32_GOT_PCREL,
- BFD_RELOC_16_GOT_PCREL,
- BFD_RELOC_8_GOT_PCREL,
- BFD_RELOC_32_GOTOFF,
- BFD_RELOC_16_GOTOFF,
- BFD_RELOC_LO16_GOTOFF,
- BFD_RELOC_HI16_GOTOFF,
- BFD_RELOC_HI16_S_GOTOFF,
- BFD_RELOC_8_GOTOFF,
- BFD_RELOC_32_PLT_PCREL,
- BFD_RELOC_24_PLT_PCREL,
- BFD_RELOC_16_PLT_PCREL,
- BFD_RELOC_8_PLT_PCREL,
- BFD_RELOC_32_PLTOFF,
- BFD_RELOC_16_PLTOFF,
- BFD_RELOC_LO16_PLTOFF,
- BFD_RELOC_HI16_PLTOFF,
- BFD_RELOC_HI16_S_PLTOFF,
- BFD_RELOC_8_PLTOFF,
-
-/* Relocations used by 68K ELF. */
- BFD_RELOC_68K_GLOB_DAT,
- BFD_RELOC_68K_JMP_SLOT,
- BFD_RELOC_68K_RELATIVE,
-
-/* Linkage-table relative. */
- BFD_RELOC_32_BASEREL,
- BFD_RELOC_16_BASEREL,
- BFD_RELOC_LO16_BASEREL,
- BFD_RELOC_HI16_BASEREL,
- BFD_RELOC_HI16_S_BASEREL,
- BFD_RELOC_8_BASEREL,
- BFD_RELOC_RVA,
-
-/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
- BFD_RELOC_8_FFnn,
-
-/* These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits. The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha. */
- BFD_RELOC_32_PCREL_S2,
- BFD_RELOC_16_PCREL_S2,
- BFD_RELOC_23_PCREL_S2,
-
-/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word. These are used on the SPARC. */
- BFD_RELOC_HI22,
- BFD_RELOC_LO10,
-
-/* For systems that allocate a Global Pointer register, these are
-displacements off that register. These relocation types are
-handled specially, because the value the register will have is
-decided relatively late. */
- BFD_RELOC_GPREL16,
- BFD_RELOC_GPREL32,
-
-/* Reloc types used for i960/b.out. */
- BFD_RELOC_I960_CALLJ,
-
-/* SPARC ELF relocations. There is probably some overlap with other
-relocation types already defined. */
- BFD_RELOC_NONE,
- BFD_RELOC_SPARC_WDISP22,
- BFD_RELOC_SPARC22,
- BFD_RELOC_SPARC13,
- BFD_RELOC_SPARC_GOT10,
- BFD_RELOC_SPARC_GOT13,
- BFD_RELOC_SPARC_GOT22,
- BFD_RELOC_SPARC_PC10,
- BFD_RELOC_SPARC_PC22,
- BFD_RELOC_SPARC_WPLT30,
- BFD_RELOC_SPARC_COPY,
- BFD_RELOC_SPARC_GLOB_DAT,
- BFD_RELOC_SPARC_JMP_SLOT,
- BFD_RELOC_SPARC_RELATIVE,
- BFD_RELOC_SPARC_UA32,
-
-/* I think these are specific to SPARC a.out (e.g., Sun 4). */
- BFD_RELOC_SPARC_BASE13,
- BFD_RELOC_SPARC_BASE22,
-
-/* Some relocations we're using for SPARC V9 -- subject to change. */
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
- BFD_RELOC_SPARC_10,
- BFD_RELOC_SPARC_11,
- BFD_RELOC_SPARC_OLO10,
- BFD_RELOC_SPARC_HH22,
- BFD_RELOC_SPARC_HM10,
- BFD_RELOC_SPARC_LM22,
- BFD_RELOC_SPARC_PC_HH22,
- BFD_RELOC_SPARC_PC_HM10,
- BFD_RELOC_SPARC_PC_LM22,
- BFD_RELOC_SPARC_WDISP16,
- BFD_RELOC_SPARC_WDISP19,
- BFD_RELOC_SPARC_GLOB_JMP,
- BFD_RELOC_SPARC_7,
- BFD_RELOC_SPARC_6,
- BFD_RELOC_SPARC_5,
-
-/* Alpha ECOFF relocations. Some of these treat the symbol or "addend"
-in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol. The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc). */
- BFD_RELOC_ALPHA_GPDISP_HI16,
-
-/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs. The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience. */
- BFD_RELOC_ALPHA_GPDISP_LO16,
-
-/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol. The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references. The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)
-
-The GNU linker currently doesn't do any of this optimizing. */
- BFD_RELOC_ALPHA_LITERAL,
- BFD_RELOC_ALPHA_LITUSE,
-
-/* The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors. */
- BFD_RELOC_ALPHA_HINT,
-
-/* Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise. */
- BFD_RELOC_MIPS_JMP,
-
-/* High 16 bits of 32-bit value; simple reloc. */
- BFD_RELOC_HI16,
-
-/* High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result. If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added. */
- BFD_RELOC_HI16_S,
-
-/* Low 16 bits. */
- BFD_RELOC_LO16,
-
-/* Like BFD_RELOC_HI16_S, but PC relative. */
- BFD_RELOC_PCREL_HI16_S,
-
-/* Like BFD_RELOC_LO16, but PC relative. */
- BFD_RELOC_PCREL_LO16,
-
-/* Relocation relative to the global pointer. */
-#define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16
-
-/* Relocation against a MIPS literal section. */
- BFD_RELOC_MIPS_LITERAL,
-
-/* MIPS ELF relocations. */
- BFD_RELOC_MIPS_GOT16,
- BFD_RELOC_MIPS_CALL16,
-#define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32
- BFD_RELOC_MIPS_GOT_HI16,
- BFD_RELOC_MIPS_GOT_LO16,
- BFD_RELOC_MIPS_CALL_HI16,
- BFD_RELOC_MIPS_CALL_LO16,
-
-/* i386/elf relocations */
- BFD_RELOC_386_GOT32,
- BFD_RELOC_386_PLT32,
- BFD_RELOC_386_COPY,
- BFD_RELOC_386_GLOB_DAT,
- BFD_RELOC_386_JUMP_SLOT,
- BFD_RELOC_386_RELATIVE,
- BFD_RELOC_386_GOTOFF,
- BFD_RELOC_386_GOTPC,
-
-/* ns32k relocations */
- BFD_RELOC_NS32K_IMM_8,
- BFD_RELOC_NS32K_IMM_16,
- BFD_RELOC_NS32K_IMM_32,
- BFD_RELOC_NS32K_IMM_8_PCREL,
- BFD_RELOC_NS32K_IMM_16_PCREL,
- BFD_RELOC_NS32K_IMM_32_PCREL,
- BFD_RELOC_NS32K_DISP_8,
- BFD_RELOC_NS32K_DISP_16,
- BFD_RELOC_NS32K_DISP_32,
- BFD_RELOC_NS32K_DISP_8_PCREL,
- BFD_RELOC_NS32K_DISP_16_PCREL,
- BFD_RELOC_NS32K_DISP_32_PCREL,
-
-/* Power(rs6000) and PowerPC relocations. */
- BFD_RELOC_PPC_B26,
- BFD_RELOC_PPC_BA26,
- BFD_RELOC_PPC_TOC16,
- BFD_RELOC_PPC_B16,
- BFD_RELOC_PPC_B16_BRTAKEN,
- BFD_RELOC_PPC_B16_BRNTAKEN,
- BFD_RELOC_PPC_BA16,
- BFD_RELOC_PPC_BA16_BRTAKEN,
- BFD_RELOC_PPC_BA16_BRNTAKEN,
- BFD_RELOC_PPC_COPY,
- BFD_RELOC_PPC_GLOB_DAT,
- BFD_RELOC_PPC_JMP_SLOT,
- BFD_RELOC_PPC_RELATIVE,
- BFD_RELOC_PPC_LOCAL24PC,
- BFD_RELOC_PPC_EMB_NADDR32,
- BFD_RELOC_PPC_EMB_NADDR16,
- BFD_RELOC_PPC_EMB_NADDR16_LO,
- BFD_RELOC_PPC_EMB_NADDR16_HI,
- BFD_RELOC_PPC_EMB_NADDR16_HA,
- BFD_RELOC_PPC_EMB_SDAI16,
- BFD_RELOC_PPC_EMB_SDA2I16,
- BFD_RELOC_PPC_EMB_SDA2REL,
- BFD_RELOC_PPC_EMB_SDA21,
- BFD_RELOC_PPC_EMB_MRKREF,
- BFD_RELOC_PPC_EMB_RELSEC16,
- BFD_RELOC_PPC_EMB_RELST_LO,
- BFD_RELOC_PPC_EMB_RELST_HI,
- BFD_RELOC_PPC_EMB_RELST_HA,
- BFD_RELOC_PPC_EMB_BIT_FLD,
- BFD_RELOC_PPC_EMB_RELSDA,
-
-/* The type of reloc used to build a contructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types. */
- BFD_RELOC_CTOR,
-
-/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction. */
- BFD_RELOC_ARM_PCREL_BRANCH,
-
-/* These relocs are only used within the ARM assembler. They are not
-(at present) written to any object files. */
- BFD_RELOC_ARM_IMMEDIATE,
- BFD_RELOC_ARM_OFFSET_IMM,
- BFD_RELOC_ARM_SHIFT_IMM,
- BFD_RELOC_ARM_SWI,
- BFD_RELOC_ARM_MULTI,
- BFD_RELOC_ARM_CP_OFF_IMM,
- BFD_RELOC_ARM_ADR_IMM,
- BFD_RELOC_ARM_LDR_IMM,
- BFD_RELOC_ARM_LITERAL,
- BFD_RELOC_ARM_IN_POOL,
- BFD_RELOC_UNUSED };
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-reloc_howto_type *
-
-bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-
-const char *
-bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
-
-
-typedef struct symbol_cache_entry
-{
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_{abs,com,und}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
-
- struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- CONST char *name;
-
- /* The value of the symbol. This really should be a union of a
- numeric value with a pointer, since some flags indicate that
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol: */
-
-#define BSF_NO_FLAGS 0x00
-
- /* The symbol has local scope; <<static>> in <<C>>. The value
- is the offset into the section of the data. */
-#define BSF_LOCAL 0x01
-
- /* The symbol has global scope; initialized data in <<C>>. The
- value is the offset into the section of the data. */
-#define BSF_GLOBAL 0x02
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
-#define BSF_EXPORT BSF_GLOBAL /* no real difference */
-
- /* A normal C symbol would be one of:
- <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
- <<BSF_GLOBAL>> */
-
- /* The symbol is a debugging record. The value has an arbitary
- meaning. */
-#define BSF_DEBUGGING 0x08
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
-#define BSF_FUNCTION 0x10
-
- /* Used by the linker. */
-#define BSF_KEEP 0x20
-#define BSF_KEEP_G 0x40
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
-#define BSF_WEAK 0x80
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
-#define BSF_SECTION_SYM 0x100
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
-#define BSF_OLD_COMMON 0x200
-
- /* The default value for common data. */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a <<ISFCN>> symbol
- which is also <<C_EXT>> symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
-
-#define BSF_NOT_AT_END 0x400
-
- /* Signal that the symbol is the label of constructor section. */
-#define BSF_CONSTRUCTOR 0x800
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
-#define BSF_WARNING 0x1000
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
-#define BSF_INDIRECT 0x2000
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
-#define BSF_FILE 0x4000
-
- /* Symbol is from dynamic linking information. */
-#define BSF_DYNAMIC 0x8000
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
-#define BSF_OBJECT 0x10000
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct sec *section;
-
- /* Back end special data. */
- union
- {
- PTR p;
- bfd_vma i;
- } udata;
-
-} asymbol;
-#define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-boolean
-bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
-
-#define bfd_is_local_label(abfd, sym) \
- BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym))
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab,\
- (abfd, location))
-boolean
-bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
-
-void
-bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
-
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-int
-bfd_decode_symclass PARAMS ((asymbol *symbol));
-
-void
-bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
-
-boolean
-bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
-
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-struct _bfd
-{
- /* The filename the application opened the BFD with. */
- CONST char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* To avoid dragging too many header files into every file that
- includes `<<bfd.h>>', IOSTREAM has been declared as a "char
- *", and MTIME as a "long". Their correct types, to which they
- are cast when used, are "FILE *" and "time_t". The iostream
- is the result of an fopen on the filename. However, if the
- BFD_IN_MEMORY flag is set, then iostream is actually a pointer
- to a bfd_in_memory struct. */
- PTR iostream;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
-
- boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
-
- boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs */
-
- struct _bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here: */
-
- file_ptr where;
-
- /* and here: (``once'' means at least once) */
-
- boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time: */
-
- boolean mtime_set;
-
- /* File modified time, if mtime_set is true: */
-
- long mtime;
-
- /* Reserved for an unimplemented file locking extension.*/
-
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
-
- bfd_format format;
-
- /* The direction the BFD was opened with*/
-
- enum bfd_direction {no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3} direction;
-
- /* Format_specific flags*/
-
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
-
- file_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- boolean output_has_begun;
-
- /* Pointer to linked list of sections*/
- struct sec *sections;
-
- /* The number of sections */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output*/
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries) */
- struct symbol_cache_entry **outsymbols;
-
- /* Pointer to structure which contains architecture information*/
- const struct bfd_arch_info *arch_info;
-
- /* Stuff only useful for archives:*/
- PTR arelt_data;
- struct _bfd *my_archive; /* The containing archive BFD. */
- struct _bfd *next; /* The next BFD in the archive. */
- struct _bfd *archive_head; /* The first BFD in the archive. */
- boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct _bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
-
- union
- {
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct sun_core_struct *sun_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- PTR any;
- } tdata;
-
- /* Used by the application to hold private data*/
- PTR usrdata;
-
- /* Where all the allocated stuff under this BFD goes */
- struct obstack memory;
-};
-
-typedef enum bfd_error
-{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
-} bfd_error_type;
-
-bfd_error_type
-bfd_get_error PARAMS ((void));
-
-void
-bfd_set_error PARAMS ((bfd_error_type error_tag));
-
-CONST char *
-bfd_errmsg PARAMS ((bfd_error_type error_tag));
-
-void
-bfd_perror PARAMS ((CONST char *message));
-
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
-
-bfd_error_handler_type
-bfd_set_error_handler PARAMS ((bfd_error_handler_type));
-
-void
-bfd_set_error_program_name PARAMS ((const char *));
-
-long
-bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
-
-long
-bfd_canonicalize_reloc
- PARAMS ((bfd *abfd,
- asection *sec,
- arelent **loc,
- asymbol **syms));
-
-void
-bfd_set_reloc
- PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count)
-
- );
-
-boolean
-bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
-
-boolean
-bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
-
-long
-bfd_get_mtime PARAMS ((bfd *abfd));
-
-long
-bfd_get_size PARAMS ((bfd *abfd));
-
-int
-bfd_get_gp_size PARAMS ((bfd *abfd));
-
-void
-bfd_set_gp_size PARAMS ((bfd *abfd, int i));
-
-bfd_vma
-bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base));
-
-boolean
-bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-boolean
-bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-boolean
-bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
-
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, \
- (abfd, flags))
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
-
- /* Do these three do anything useful at all, for any back end? */
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *,
- struct bfd_link_order *, bfd_byte *,
- boolean, asymbol **));
-
-symindex
-bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
-
-boolean
-bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
-
-bfd *
-bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
-
-CONST char *
-bfd_core_file_failing_command PARAMS ((bfd *abfd));
-
-int
-bfd_core_file_failing_signal PARAMS ((bfd *abfd));
-
-boolean
-core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-
-#define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- ((*((bfd)->xvec->message)) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-enum bfd_flavour {
- bfd_target_unknown_flavour,
- bfd_target_aout_flavour,
- bfd_target_coff_flavour,
- bfd_target_ecoff_flavour,
- bfd_target_elf_flavour,
- bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
- bfd_target_oasys_flavour,
- bfd_target_tekhex_flavour,
- bfd_target_srec_flavour,
- bfd_target_ihex_flavour,
- bfd_target_som_flavour,
- bfd_target_os9k_flavour,
- bfd_target_versados_flavour,
- bfd_target_msdos_flavour
-};
-
-enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
- /* Forward declaration. */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-{
- char *name;
- enum bfd_flavour flavour;
- enum bfd_endian byteorder;
- enum bfd_endian header_byteorder;
- flagword object_flags;
- flagword section_flags;
- char symbol_leading_char;
- char ar_pad_char;
- unsigned short ar_max_namelen;
- bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
- boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
- boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
-
- /* Generic entry points. */
-#define BFD_JUMP_TABLE_GENERIC(NAME)\
-CAT(NAME,_close_and_cleanup),\
-CAT(NAME,_bfd_free_cached_info),\
-CAT(NAME,_new_section_hook),\
-CAT(NAME,_get_section_contents),\
-CAT(NAME,_get_section_contents_in_window)
-
- /* Called when the BFD is being closed to do any necessary cleanup. */
- boolean (*_close_and_cleanup) PARAMS ((bfd *));
- /* Ask the BFD to free all cached information. */
- boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
- /* Called when a new section is created. */
- boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
- /* Read the contents of a section. */
- boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
- boolean (*_bfd_get_section_contents_in_window)
- PARAMS ((bfd *, sec_ptr, bfd_window *,
- file_ptr, bfd_size_type));
-
- /* Entry points to copy private data. */
-#define BFD_JUMP_TABLE_COPY(NAME)\
-CAT(NAME,_bfd_copy_private_bfd_data),\
-CAT(NAME,_bfd_merge_private_bfd_data),\
-CAT(NAME,_bfd_copy_private_section_data),\
-CAT(NAME,_bfd_copy_private_symbol_data),\
-CAT(NAME,_bfd_set_private_flags),\
-CAT(NAME,_bfd_print_private_bfd_data)\
- /* Called to copy BFD general private data from one object file
- to another. */
- boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
- /* Called to merge BFD general private data from one object file
- to a common output file when linking. */
- boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
- /* Called to copy BFD private section data from one object file
- to another. */
- boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
- bfd *, sec_ptr));
- /* Called to copy BFD private symbol data from one symbol
- to another. */
- boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
- bfd *, asymbol *));
- /* Called to set private backend flags */
- boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
-
- /* Called to print private BFD data */
- boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
-
- /* Core file entry points. */
-#define BFD_JUMP_TABLE_CORE(NAME)\
-CAT(NAME,_core_file_failing_command),\
-CAT(NAME,_core_file_failing_signal),\
-CAT(NAME,_core_file_matches_executable_p)
- char * (*_core_file_failing_command) PARAMS ((bfd *));
- int (*_core_file_failing_signal) PARAMS ((bfd *));
- boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
-
- /* Archive entry points. */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
-CAT(NAME,_slurp_armap),\
-CAT(NAME,_slurp_extended_name_table),\
-CAT(NAME,_construct_extended_name_table),\
-CAT(NAME,_truncate_arname),\
-CAT(NAME,_write_armap),\
-CAT(NAME,_read_ar_hdr),\
-CAT(NAME,_openr_next_archived_file),\
-CAT(NAME,_get_elt_at_index),\
-CAT(NAME,_generic_stat_arch_elt),\
-CAT(NAME,_update_armap_timestamp)
- boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
- boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
- boolean (*_bfd_construct_extended_name_table)
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
- void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
- boolean (*write_armap) PARAMS ((bfd *arch,
- unsigned int elength,
- struct orl *map,
- unsigned int orl_count,
- int stridx));
- PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
- bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
-#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
- bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
- int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
- boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
-
- /* Entry points used for symbols. */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
-CAT(NAME,_get_symtab_upper_bound),\
-CAT(NAME,_get_symtab),\
-CAT(NAME,_make_empty_symbol),\
-CAT(NAME,_print_symbol),\
-CAT(NAME,_get_symbol_info),\
-CAT(NAME,_bfd_is_local_label),\
-CAT(NAME,_get_lineno),\
-CAT(NAME,_find_nearest_line),\
-CAT(NAME,_bfd_make_debug_symbol),\
-CAT(NAME,_read_minisymbols),\
-CAT(NAME,_minisymbol_to_symbol)
- long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
- long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
- struct symbol_cache_entry **));
- struct symbol_cache_entry *
- (*_bfd_make_empty_symbol) PARAMS ((bfd *));
- void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
- struct symbol_cache_entry *,
- bfd_print_symbol_type));
-#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
- void (*_bfd_get_symbol_info) PARAMS ((bfd *,
- struct symbol_cache_entry *,
- symbol_info *));
-#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
- boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *));
-
- alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
- boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
- struct sec *section, struct symbol_cache_entry **symbols,
- bfd_vma offset, CONST char **file, CONST char **func,
- unsigned int *line));
- /* Back-door to allow format-aware applications to create debug symbols
- while using BFD for everything else. Currently used by the assembler
- when creating COFF files. */
- asymbol * (*_bfd_make_debug_symbol) PARAMS ((
- bfd *abfd,
- void *ptr,
- unsigned long size));
-#define bfd_read_minisymbols(b, d, m, s) \
- BFD_SEND (b, _read_minisymbols, (b, d, m, s))
- long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
- unsigned int *));
-#define bfd_minisymbol_to_symbol(b, d, m, f) \
- BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
- asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
- asymbol *));
-
- /* Routines for relocs. */
-#define BFD_JUMP_TABLE_RELOCS(NAME)\
-CAT(NAME,_get_reloc_upper_bound),\
-CAT(NAME,_canonicalize_reloc),\
-CAT(NAME,_bfd_reloc_type_lookup)
- long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
- long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
- struct symbol_cache_entry **));
- /* See documentation on reloc types. */
- reloc_howto_type *
- (*reloc_type_lookup) PARAMS ((bfd *abfd,
- bfd_reloc_code_real_type code));
-
- /* Routines used when writing an object file. */
-#define BFD_JUMP_TABLE_WRITE(NAME)\
-CAT(NAME,_set_arch_mach),\
-CAT(NAME,_set_section_contents)
- boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
- unsigned long));
- boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
-
- /* Routines used by the linker. */
-#define BFD_JUMP_TABLE_LINK(NAME)\
-CAT(NAME,_sizeof_headers),\
-CAT(NAME,_bfd_get_relocated_section_contents),\
-CAT(NAME,_bfd_relax_section),\
-CAT(NAME,_bfd_link_hash_table_create),\
-CAT(NAME,_bfd_link_add_symbols),\
-CAT(NAME,_bfd_final_link),\
-CAT(NAME,_bfd_link_split_section)
- int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
- bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
- struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *data, boolean relocateable,
- struct symbol_cache_entry **));
-
- boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
- struct bfd_link_info *, boolean *again));
-
- /* Create a hash table for the linker. Different backends store
- different information in this table. */
- struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
-
- /* Add symbols from this object file into the hash table. */
- boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
-
- /* Do a link based on the link_order structures attached to each
- section of the BFD. */
- boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
-
- /* Should this section be split up into smaller pieces during linking. */
- boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
-
- /* Routines to handle dynamic symbols and relocs. */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
-CAT(NAME,_get_dynamic_symtab_upper_bound),\
-CAT(NAME,_canonicalize_dynamic_symtab),\
-CAT(NAME,_get_dynamic_reloc_upper_bound),\
-CAT(NAME,_canonicalize_dynamic_reloc)
- /* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
- /* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- PARAMS ((bfd *, struct symbol_cache_entry **));
- /* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
- /* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
-
- PTR backend_data;
-} bfd_target;
-const bfd_target *
-bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
-
-const char **
-bfd_target_list PARAMS ((void));
-
-boolean
-bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
-
-boolean
-bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
-
-boolean
-bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
-
-CONST char *
-bfd_format_string PARAMS ((bfd_format format));
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/gnu/usr.bin/gdb/bfd/config.h b/gnu/usr.bin/gdb/bfd/config.h
deleted file mode 100644
index 20406d4..0000000
--- a/gnu/usr.bin/gdb/bfd/config.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* config.h. Generated automatically by configure. */
-/* config.in. Generated automatically from configure.in by autoheader. */
-
-/* Whether malloc must be declared even if <stdlib.h> is included. */
-/* #undef NEED_DECLARATION_MALLOC */
-
-/* Whether free must be declared even if <stdlib.h> is included. */
-/* #undef NEED_DECLARATION_FREE */
-
-/* Define if you have a working `mmap' system call. */
-#define HAVE_MMAP 1
-
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Do we need to use the b modifier when opening binary files? */
-/* #undef USE_BINARY_FOPEN */
-
-/* Name of host specific header file to include in trad-core.c. */
-#define TRAD_HEADER "i386freebsd.h"
-
-/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
-#define HAVE_SYS_PROCFS_H 1
-
-/* Do we really want to use mmap if it's available? */
-/* #undef USE_MMAP */
-
-/* Define if you have the fcntl function. */
-#define HAVE_FCNTL 1
-
-/* Define if you have the getpagesize function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the madvise function. */
-#define HAVE_MADVISE 1
-
-/* Define if you have the mprotect function. */
-#define HAVE_MPROTECT 1
-
-/* Define if you have the valloc function. */
-#define HAVE_VALLOC 1
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define if you have the <sys/file.h> header file. */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define if you have the <time.h> header file. */
-#define HAVE_TIME_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
diff --git a/gnu/usr.bin/gdb/bfd/i386freebsd.h b/gnu/usr.bin/gdb/bfd/i386freebsd.h
deleted file mode 100644
index 4859a37..0000000
--- a/gnu/usr.bin/gdb/bfd/i386freebsd.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Intel 386 running any FreeBSD Unix */
-
-#include <machine/param.h>
-#include <machine/vmparam.h>
-
-#define NBPG PAGE_SIZE
-#define HOST_PAGE_SIZE NBPG
-#define HOST_MACHINE_ARCH bfd_arch_i386
-#define HOST_TEXT_START_ADDR USRTEXT
-
-/* Jolitz suggested defining HOST_STACK_END_ADDR to
- (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
- both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */
-
-/* This seems to be the right thing for FreeBSD and BSDI */
-#define HOST_STACK_END_ADDR USRSTACK
-
-/* Leave HOST_DATA_START_ADDR undefined, since the default when it is not
- defined sort of works, and FreeBSD-2.0 through FreeBSD-2.2.2 do not
- set u.u_kproc.kp_eproc.e_vm.vm_daddr. */
-
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
- ((core_bfd)->tdata.trad_core_data->u.u_sig)
-#define u_comm u_kproc.kp_proc.p_comm
diff --git a/gnu/usr.bin/gdb/doc/Makefile b/gnu/usr.bin/gdb/doc/Makefile
deleted file mode 100644
index 6d77782..0000000
--- a/gnu/usr.bin/gdb/doc/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# $Id$
-
-INFO= annotate gdb gdbint stabs
-
-CONTRIBDIR= ${.CURDIR}/../../../../contrib
-SRCDIR= ${CONTRIBDIR}/gdb/gdb/doc
-MAKEINFOFLAGS+= -I ${CONTRIBDIR}/libreadline/doc
-CLEANFILES= gdb-cfg.texi inc-hist.texi inc-hist.texi.orig
-
-INFOSECTION= "Gdb Documentation"
-INFOENTRY_annotate= "* GDB annotation: (annotate). Annotations for the GNU Debugger (GDB)."
-
-gdb.info: gdb.texinfo gdb-cfg.texi GDBvn.texi remote.texi \
- rluser.texinfo inc-hist.texi
-
-gdb-cfg.texi: all-cfg.texi
- ln -sf ${.ALLSRC} ${.TARGET}
-
-.PATH: ${CONTRIBDIR}/libreadline/doc
-inc-hist.texi: hsuser.texinfo inc-hist.diff
- cp ${.ALLSRC:M*.texinfo} ${.TARGET}
- patch -b .orig < ${.ALLSRC:M*.diff}
-
-.include <bsd.info.mk>
diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile
deleted file mode 100644
index 4acb63f..0000000
--- a/gnu/usr.bin/gdb/gdb/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-# $Id: Makefile,v 1.38 1998/10/15 14:15:09 bde Exp $
-
-PROG = gdb
-
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.if ${OBJFORMAT} == elf
-BFDDIR= ${.CURDIR}/../../binutils/libbfd/${MACHINE_ARCH}
-BINDIR= /usr/libexec/elf
-.else
-BFDDIR= ${.CURDIR}/../bfd
-BINDIR= /usr/libexec/aout
-.endif
-.PATH: ${GDBDIR}/gdb
-.PATH: ${GDBDIR}/opcodes
-
-.if ${OBJFORMAT} == elf
-CFLAGS+= -DFREEBSD_ELF
-.endif
-
-XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \
- c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \
- ch-valprint.c coffread.c command.c complaints.c copying.c \
- core-regset.c corelow.c cp-valprint.c \
- dcache.c dbxread.c demangle.c dwarfread.c \
- elfread.c environ.c eval.c exec.c expprint.c \
- findvar.c fork-child.c freebsd-nat.c gdbtypes.c \
- i386-tdep.c infcmd.c inflow.c infptrace.c \
- infrun.c inftarg.c language.c \
- m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
- mem-break.c minsyms.c objfiles.c parse.c \
- printcmd.c remote.c remote-utils.c solib.c source.c \
- stabsread.c stack.c symfile.c symmisc.c \
- symtab.c target.c thread.c top.c \
- typeprint.c utils.c valarith.c valops.c \
- valprint.c values.c version.c \
- serial.c ser-unix.c ser-tcp.c mdebugread.c \
- c-exp.y f-exp.y m2-exp.y i387-tdep.c \
- kvm-fbsd.c bcache.c \
- corefile.c ch-exp.c f-lang.c scm-exp.c scm-lang.c \
- scm-valprint.c f-typeprint.c f-valprint.c nlmread.c \
- callback.c
-XSRCS+= i386-dis.c dis-buf.c disassemble.c
-SRCS= init.c ${XSRCS}
-
-CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I${BFDDIR}
-# use phkmalloc
-CFLAGS+= -DNO_MMALLOC
-# uncomment the next line if you want to debug gdb
-#CFLAGS+= -g
-YFLAGS=
-
-CLEANFILES= init.c init.c-tmp
-
-.if ${OBJFORMAT} == elf
-
-.if exists(${.OBJDIR}/../../binutils/libbfd)
-LIBBFD= ${.OBJDIR}/../../binutils/libbfd/libbfd.a
-.else
-LIBBFD= ${.CURDIR}/../../binutils/libbfd/libbfd.a
-.endif
-
-.if exists(${.OBJDIR}/../../binutils/libiberty)
-LIBIBERTY= ${.OBJDIR}/../../binutils/libiberty/libiberty.a
-.else
-LIBIBERTY= ${.CURDIR}/../../binutils/libiberty/libiberty.a
-.endif
-
-.else
-
-.if exists(${.OBJDIR}/../bfd)
-LIBBFD= ${.OBJDIR}/../bfd/libbfd.a
-.else
-LIBBFD= ${.CURDIR}/../bfd/libbfd.a
-.endif
-
-.if exists(${.OBJDIR}/../libiberty)
-LIBIBERTY= ${.OBJDIR}/../libiberty/libiberty.a
-.else
-LIBIBERTY= ${.CURDIR}/../libiberty/libiberty.a
-.endif
-
-.endif # OBJFORMAT
-
-DPADD= ${LIBBFD} ${LIBREADLINE} ${LIBGNUREGEX} ${LIBIBERTY} ${LIBTERMCAP}
-LDADD= ${LIBBFD} -lreadline -lgnuregex ${LIBIBERTY} -ltermcap
-DPADD+= ${LIBIBERTY}
-LDADD+= ${LIBIBERTY}
-
-# We do this by grepping through sources. If that turns out to be too slow,
-# maybe we could just require every .o file to have an initialization routine
-# of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
-#
-# Formatting conventions: The name of the _initialize_* routines must start
-# in column zero, and must not be inside #if.
-#
-# Note that the set of files with init functions might change, or the names
-# of the functions might change, so this files needs to depend on all the
-# object files that will be linked into gdb.
-
-init.c: ${XSRCS}
- @${ECHO} Making ${.TARGET}
- @rm -f init.c-tmp
- @echo '/* Do not modify this file. */' >init.c-tmp
- @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
- @echo 'void initialize_all_files () {' >>init.c-tmp
- @for i in ${.ALLSRC} ; do \
- filename=`echo $$i | sed \
- -e '/^Onindy.c/d' \
- -e '/^nindy.c/d' \
- -e '/ttyflush.c/d' \
- -e '/xdr_ld.c/d' \
- -e '/xdr_ptrace.c/d' \
- -e '/xdr_rdb.c/d' \
- -e '/udr.c/d' \
- -e '/udip2soc.c/d' \
- -e '/udi2go32.c/d' \
- -e '/version.c/d' \
- -e '/^[a-z0-9A-Z_]*_[SU].c/d' \
- -e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \
- case $$filename in \
- "") ;; \
- *) sed <$$filename >>init.c-tmp -n \
- -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (); \1 ();}/p' ; ;; \
- esac ; \
- done
- @echo '}' >>init.c-tmp
- @mv init.c-tmp ${.TARGET}
-
-.PRECIOUS: init.c
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/gdb/config.h b/gnu/usr.bin/gdb/gdb/config.h
deleted file mode 100644
index 6010886..0000000
--- a/gnu/usr.bin/gdb/gdb/config.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* config.h. Generated automatically by configure. */
-/* config.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-/* #undef _ALL_SOURCE */
-#endif
-
-/* Define if the `long double' type works. */
-#define HAVE_LONG_DOUBLE 1
-
-/* Define if you have a working `mmap' system call. */
-#define HAVE_MMAP 1
-
-/* Define if on MINIX. */
-/* #undef _MINIX */
-
-/* Define if the system does not provide POSIX.1 features except
- with this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define if you need to in order for stat and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
-/* #undef STAT_MACROS_BROKEN */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if fpregset_t type is available. */
-#define HAVE_FPREGSET_T 1
-
-/* Define if gregset_t type is available. */
-#define HAVE_GREGSET_T 1
-
-/* Define if the "%Lg" format works to print long doubles. */
-#define PRINTF_HAS_LONG_DOUBLE 1
-
-/* Define if you have the getpagesize function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the sbrk function. */
-#define HAVE_SBRK 1
-
-/* Define if you have the setpgid function. */
-#define HAVE_SETPGID 1
-
-/* Define if you have the valloc function. */
-#define HAVE_VALLOC 1
-
-/* Define if you have the <endian.h> header file. */
-/* #undef HAVE_ENDIAN_H */
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <link.h> header file. */
-#define HAVE_LINK_H 1
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have the <sgtty.h> header file. */
-#define HAVE_SGTTY_H 1
-
-/* Define if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define if you have the <sys/procfs.h> header file. */
-#define HAVE_SYS_PROCFS_H 1
-
-/* Define if you have the <termio.h> header file. */
-/* #undef HAVE_TERMIO_H */
-
-/* Define if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the dl library (-ldl). */
-/* #undef HAVE_LIBDL */
diff --git a/gnu/usr.bin/gdb/gdb/freebsd-nat.c b/gnu/usr.bin/gdb/gdb/freebsd-nat.c
deleted file mode 100644
index 3fbc7ef..0000000
--- a/gnu/usr.bin/gdb/gdb/freebsd-nat.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* Native-dependent code for BSD Unix running on i386's, for GDB.
- Copyright 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#include "defs.h"
-
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-#include <machine/frame.h>
-#include <sys/param.h>
-#include <sys/user.h>
-#include "gdbcore.h"
-#include "value.h"
-#include "inferior.h"
-
-#if defined(HAVE_GREGSET_T) || defined(HAVE_FPREGSET_T)
-#include <sys/procfs.h>
-#endif
-
-/* this table must line up with REGISTER_NAMES in tm-i386v.h */
-/* symbols like 'tEAX' come from <machine/reg.h> */
-static int tregmap[] =
-{
- tEAX, tECX, tEDX, tEBX,
- tESP, tEBP, tESI, tEDI,
- tEIP, tEFLAGS, tCS, tSS,
- tDS, tES, tFS, tGS,
-};
-
-static struct save87 pcb_savefpu;
-
-void
-fetch_inferior_registers (regno)
- int regno;
-{
- struct reg inferior_registers; /* ptrace order, not gcc/gdb order */
- int r;
-
- ptrace (PT_GETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-
- for (r = 0; r < NUM_REGS; r++)
- memcpy (&registers[REGISTER_BYTE (r)], ((int *)&inferior_registers) + tregmap[r], 4);
-
- registers_fetched ();
-}
-
-void
-store_inferior_registers (regno)
- int regno;
-{
- struct reg inferior_registers; /* ptrace order, not gcc/gdb order */
- int r;
-
- for (r = 0; r < NUM_REGS; r++)
- memcpy (((int *)&inferior_registers) + tregmap[r], &registers[REGISTER_BYTE (r)], 4);
-
- ptrace (PT_SETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0);
-}
-
-/* Extract the register values out of the core file and store
- them where `read_register' will find them.
- Extract the floating point state out of the core file and store
- it where `float_info' will find it.
-
- CORE_REG_SECT points to the register values themselves, read into memory.
- CORE_REG_SIZE is the size of that area.
- WHICH says which set of registers we are handling (0 = int, 2 = float
- on machines where they are discontiguous).
- REG_ADDR is the offset from u.u_ar0 to the register values relative to
- core_reg_sect. This is used with old-fashioned core files to
- locate the registers in a large upage-plus-stack ".reg" section.
- Original upage address X is at location core_reg_sect+x+reg_addr.
- */
-
-static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
- CORE_ADDR reg_addr;
-{
- register int regno;
- register int cregno;
- register int addr;
- int bad_reg = -1;
- int offset;
- struct user *tmp_uaddr;
-
- /*
- * First get virtual address of user structure. Then calculate offset.
- */
- memcpy(&tmp_uaddr,
- &((struct user *) core_reg_sect)->u_kproc.kp_proc.p_addr,
- sizeof(tmp_uaddr));
- offset = -reg_addr - (int) tmp_uaddr;
-
- for (regno = 0; regno < NUM_REGS; regno++)
- {
- cregno = tregmap[regno];
- if (cregno == tGS)
- addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_gs);
- else
- addr = offset + 4 * cregno;
- if (addr < 0 || addr >= core_reg_size)
- {
- if (bad_reg < 0)
- bad_reg = regno;
- }
- else
- {
- supply_register (regno, core_reg_sect + addr);
- }
- }
- if (bad_reg >= 0)
- {
- error ("Register %s not found in core file.", reg_names[bad_reg]);
- }
-
- addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_savefpu);
- memcpy (&pcb_savefpu, core_reg_sect + addr, sizeof pcb_savefpu);
-}
-
-#ifdef FLOAT_INFO
-#include "expression.h"
-#include "language.h" /* for local_hex_string */
-#include "floatformat.h"
-
-#include <sys/param.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#include <a.out.h>
-
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/uio.h>
-#define curpcb Xcurpcb /* XXX avoid leaking declaration from pcb.h */
-#include <sys/user.h>
-#undef curpcb
-#include <sys/file.h>
-#include "gdb_stat.h"
-#include <sys/ptrace.h>
-
-extern void print_387_control_word (); /* i387-tdep.h */
-extern void print_387_status_word ();
-
-#define fpstate save87
-#define U_FPSTATE(u) u.u_pcb.pcb_savefpu
-
-static void
-i387_to_double (from, to)
- char *from;
- char *to;
-{
- long *lp;
- /* push extended mode on 387 stack, then pop in double mode
- *
- * first, set exception masks so no error is generated -
- * number will be rounded to inf or 0, if necessary
- */
- asm ("pushl %eax"); /* grab a stack slot */
- asm ("fstcw (%esp)"); /* get 387 control word */
- asm ("movl (%esp),%eax"); /* save old value */
- asm ("orl $0x3f,%eax"); /* mask all exceptions */
- asm ("pushl %eax");
- asm ("fldcw (%esp)"); /* load new value into 387 */
-
- asm ("movl 8(%ebp),%eax");
- asm ("fldt (%eax)"); /* push extended number on 387 stack */
- asm ("fwait");
- asm ("movl 12(%ebp),%eax");
- asm ("fstpl (%eax)"); /* pop double */
- asm ("fwait");
-
- asm ("popl %eax"); /* flush modified control word */
- asm ("fnclex"); /* clear exceptions */
- asm ("fldcw (%esp)"); /* restore original control word */
- asm ("popl %eax"); /* flush saved copy */
-}
-
-struct env387
-{
- unsigned short control;
- unsigned short r0;
- unsigned short status;
- unsigned short r1;
- unsigned short tag;
- unsigned short r2;
- unsigned long eip;
- unsigned short code_seg;
- unsigned short opcode;
- unsigned long operand;
- unsigned short operand_seg;
- unsigned short r3;
- unsigned char regs[8][10];
-};
-
-static void
-print_387_status (status, ep)
- unsigned short status;
- struct env387 *ep;
-{
- int i;
- int bothstatus;
- int top;
- int fpreg;
-
- bothstatus = ((status != 0) && (ep->status != 0));
- if (status != 0)
- {
- if (bothstatus)
- printf_unfiltered ("u: ");
- print_387_status_word ((unsigned int)status);
- }
-
- if (ep->status != 0)
- {
- if (bothstatus)
- printf_unfiltered ("e: ");
- print_387_status_word ((unsigned int)ep->status);
- }
-
- print_387_control_word ((unsigned int)ep->control);
- printf_unfiltered ("last instruction: ");
- printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
- printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
- printf_unfiltered ("%s; ", local_hex_string(ep->eip));
- printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg));
- printf_unfiltered (":%s\n", local_hex_string(ep->operand));
-
- top = (ep->status >> 11) & 7;
-
- printf_unfiltered (" regno tag msb lsb value\n");
- for (fpreg = 7; fpreg >= 0; fpreg--)
- {
- int exp;
- int mantissa_or;
- int normal;
- char *sign;
- int st_regno;
- unsigned short *usregs;
- double val;
-
- /* The physical regno `fpreg' is only relevant as an index into the
- * tag word. Logical `%st' numbers are required for indexing ep->regs.
- */
- st_regno = (fpreg + 8 - top) & 7;
-
- printf_unfiltered ("%%st(%d) %s ", st_regno, fpreg == top ? "=>" : " ");
-
- switch ((ep->tag >> (fpreg * 2)) & 3)
- {
- case 0: printf_unfiltered ("valid "); break;
- case 1: printf_unfiltered ("zero "); break;
- case 2: printf_unfiltered ("trap "); break;
- case 3: printf_unfiltered ("empty "); break;
- }
- for (i = 9; i >= 0; i--)
- printf_unfiltered ("%02x", ep->regs[st_regno][i]);
-
- printf_unfiltered (" ");
-
- /*
- * Handle weird cases better than floatformat_to_double () and
- * printf ().
- */
- usregs = (unsigned short *) ep->regs[st_regno];
- sign = usregs[4] & 0x8000 ? "-" : "";
- exp = usregs[4] & 0x7fff;
- normal = usregs[3] & 0x8000;
- mantissa_or = usregs[0] | usregs[1] | usregs[2] | (usregs[3] & 0x7fff);
- if (exp == 0)
- {
- if (normal)
- printf_unfiltered ("Pseudo Denormal (0 as a double)");
- else if (mantissa_or == 0)
- printf_unfiltered ("%s0", sign);
- else
- printf_unfiltered ("Denormal (0 as a double)");
- }
- else if (exp == 0x7fff)
- {
- if (!normal)
- printf_unfiltered ("Pseudo ");
- if (mantissa_or == 0)
- printf_unfiltered ("%sInf", sign);
- else
- printf_unfiltered ("%s NaN",
- usregs[3] & 0x4000 ? "Quiet" : "Signaling");
- if (!normal)
- printf_unfiltered (" (NaN)");
- }
- else if (!normal)
- printf_unfiltered ("Unnormal (NaN)");
- else
- {
-#if 0
- /* Use this we stop trapping on overflow. */
- floatformat_to_double(&floatformat_i387_ext,
- (char *) ep->regs[st_regno], &val);
-#else
- i387_to_double((char *) ep->regs[st_regno], (char *) &val);
-#endif
- printf_unfiltered ("%g", val);
- }
- printf_unfiltered ("\n");
- }
-}
-
-void
-i386_float_info ()
-{
- struct user u; /* just for address computations */
- int i;
- /* fpstate defined in <sys/user.h> */
- struct fpstate *fpstatep;
- char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
- unsigned int uaddr;
- char fpvalid;
- unsigned int rounded_addr;
- unsigned int rounded_size;
- /*extern int corechan;*/
- int skip;
- extern int inferior_pid;
-
- uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
- if (inferior_pid != 0 && core_bfd == NULL)
- {
- int *ip;
-
- rounded_addr = uaddr & -sizeof (int);
- rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
- sizeof (int) - 1) / sizeof (int);
- skip = uaddr - rounded_addr;
-
- ip = (int *)buf;
- for (i = 0; i < rounded_size; i++)
- {
- *ip++ = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
- rounded_addr += sizeof (int);
- }
- fpstatep = (struct fpstate *)(buf + skip);
- }
- else
- fpstatep = &pcb_savefpu;
-
- print_387_status (fpstatep->sv_ex_sw, (struct env387 *)fpstatep);
-}
-#endif /* FLOAT_INFO */
-
-int
-kernel_u_size ()
-{
- return (sizeof (struct user));
-}
-
-#ifdef SETUP_ARBITRARY_FRAME
-#include "frame.h"
-struct frame_info *
-setup_arbitrary_frame (argc, argv)
- int argc;
- CORE_ADDR *argv;
-{
- if (argc != 2)
- error ("i386 frame specifications require two arguments: sp and pc");
-
- return create_new_frame (argv[0], argv[1]);
-}
-#endif /* SETUP_ARBITRARY_FRAME */
-
-#ifdef HAVE_GREGSET_T
-void
-supply_gregset (gp)
- gregset_t *gp;
-{
- int regno = 0;
-
- /* These must be ordered the same as REGISTER_NAMES in
- config/i386/tm-i386.h. */
- supply_register (regno++, (char *)&gp->r_eax);
- supply_register (regno++, (char *)&gp->r_ecx);
- supply_register (regno++, (char *)&gp->r_edx);
- supply_register (regno++, (char *)&gp->r_ebx);
- supply_register (regno++, (char *)&gp->r_esp);
- supply_register (regno++, (char *)&gp->r_ebp);
- supply_register (regno++, (char *)&gp->r_esi);
- supply_register (regno++, (char *)&gp->r_edi);
- supply_register (regno++, (char *)&gp->r_eip);
- supply_register (regno++, (char *)&gp->r_eflags);
- supply_register (regno++, (char *)&gp->r_cs);
- supply_register (regno++, (char *)&gp->r_ss);
- supply_register (regno++, (char *)&gp->r_ds);
- supply_register (regno++, (char *)&gp->r_es);
- supply_register (regno++, (char *)&gp->r_fs);
- supply_register (regno++, (char *)&gp->r_gs);
-}
-#endif /* HAVE_GREGSET_T */
-
-#ifdef HAVE_FPREGSET_T
-void
-supply_fpregset (fp)
- fpregset_t *fp;
-{
- memcpy (&pcb_savefpu, fp, sizeof pcb_savefpu);
-}
-#endif /* HAVE_FPREGSET_T */
-
-/* Register that we are able to handle aout (trad-core) file formats. */
-
-static struct core_fns aout_core_fns =
-{
- bfd_target_unknown_flavour,
- fetch_core_registers,
- NULL
-};
-
-void
-_initialize_core_aout ()
-{
- add_core_fns (&aout_core_fns);
-}
diff --git a/gnu/usr.bin/gdb/gdb/gdb.1 b/gnu/usr.bin/gdb/gdb/gdb.1
deleted file mode 100644
index f07c891..0000000
--- a/gnu/usr.bin/gdb/gdb/gdb.1
+++ /dev/null
@@ -1,385 +0,0 @@
-.\" Copyright (c) 1991 Free Software Foundation
-.\" See section COPYING for conditions for redistribution
-.\" $Id: gdb.1,v 1.3 1991/12/13 22:22:58 pesch Exp $
-.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"
-.SH NAME
-gdb \- The GNU Debugger
-.SH SYNOPSIS
-.na
-.TP
-.B gdb
-.RB "[\|" \-help "\|]"
-.RB "[\|" \-nx "\|]"
-.RB "[\|" \-q "\|]"
-.RB "[\|" \-batch "\|]"
-.RB "[\|" \-cd=\c
-.I dir\c
-\|]
-.RB "[\|" \-f "\|]"
-.RB "[\|" \-k "\|]"
-.RB "[\|" \-wcore "\|]"
-.RB "[\|" "\-b\ "\c
-.IR bps "\|]"
-.RB "[\|" "\-tty="\c
-.IR dev "\|]"
-.RB "[\|" "\-s "\c
-.I symfile\c
-\&\|]
-.RB "[\|" "\-e "\c
-.I prog\c
-\&\|]
-.RB "[\|" "\-se "\c
-.I prog\c
-\&\|]
-.RB "[\|" "\-c "\c
-.I core\c
-\&\|]
-.RB "[\|" "\-x "\c
-.I cmds\c
-\&\|]
-.RB "[\|" "\-d "\c
-.I dir\c
-\&\|]
-.RB "[\|" \c
-.I prog\c
-.RB "[\|" \c
-.IR core \||\| procID\c
-\&\|]\&\|]
-.ad b
-.SH DESCRIPTION
-The purpose of a debugger such as GDB is to allow you to see what is
-going on ``inside'' another program while it executes\(em\&or what another
-program was doing at the moment it crashed.
-
-GDB can do four main kinds of things (plus other things in support of
-these) to help you catch bugs in the act:
-
-.TP
-\ \ \ \(bu
-Start your program, specifying anything that might affect its behavior.
-
-.TP
-\ \ \ \(bu
-Make your program stop on specified conditions.
-
-.TP
-\ \ \ \(bu
-Examine what has happened, when your program has stopped.
-
-.TP
-\ \ \ \(bu
-Change things in your program, so you can experiment with correcting the
-effects of one bug and go on to learn about another.
-.PP
-
-You can use GDB to debug programs written in C, C++, and Modula-2.
-Fortran support will be added when a GNU Fortran compiler is ready.
-
-GDB is invoked with the shell command \c
-.B gdb\c
-\&. Once started, it reads
-commands from the terminal until you tell it to exit with the GDB
-command \c
-.B quit\c
-\&. You can get online help from \c
-.B gdb\c
-\& itself
-by using the command \c
-.B help\c
-\&.
-
-You can run \c
-.B gdb\c
-\& with no arguments or options; but the most
-usual way to start GDB is with one argument or two, specifying an
-executable program as the argument:
-.sp
-.br
-gdb\ program
-.br
-.sp
-
-You can also start with both an executable program and a core file specified:
-.sp
-.br
-gdb\ program\ core
-.br
-.sp
-
-You can, instead, specify a process ID as a second argument, if you want
-to debug a running process:
-.sp
-.br
-gdb\ program\ 1234
-.br
-.sp
-
-would attach GDB to process \c
-.B 1234\c
-\& (unless you also have a file
-named `\|\c
-.B 1234\c
-\&\|'; GDB does check for a core file first).
-
-Here are some of the most frequently needed GDB commands:
-.TP
-.B break \fR[\|\fIfile\fB:\fR\|]\fIfunction
-\&
-Set a breakpoint at \c
-.I function\c
-\& (in \c
-.I file\c
-\&).
-.TP
-.B run \fR[\|\fIarglist\fR\|]
-Start your program (with \c
-.I arglist\c
-\&, if specified).
-.TP
-.B bt
-Backtrace: display the program stack.
-.TP
-.BI print " expr"\c
-\&
-Display the value of an expression.
-.TP
-.B c
-Continue running your program (after stopping, e.g. at a breakpoint).
-.TP
-.B next
-Execute next program line (after stopping); step \c
-.I over\c
-\& any
-function calls in the line.
-.TP
-.B step
-Execute next program line (after stopping); step \c
-.I into\c
-\& any
-function calls in the line.
-.TP
-.B help \fR[\|\fIname\fR\|]
-Show information about GDB command \c
-.I name\c
-\&, or general information
-about using GDB.
-.TP
-.B quit
-Exit from GDB.
-.PP
-For full details on GDB, see \c
-.I
-Using GDB: A Guide to the GNU Source-Level Debugger\c
-\&, by Richard M. Stallman and Roland H. Pesch. The same text is available online
-as the \c
-.B gdb\c
-\& entry in the \c
-.B info\c
-\& program.
-.SH OPTIONS
-Any arguments other than options specify an executable
-file and core file (or process ID); that is, the first argument
-encountered with no
-associated option flag is equivalent to a `\|\c
-.B \-se\c
-\&\|' option, and the
-second, if any, is equivalent to a `\|\c
-.B \-c\c
-\&\|' option if it's the name of a file. Many options have
-both long and short forms; both are shown here. The long forms are also
-recognized if you truncate them, so long as enough of the option is
-present to be unambiguous. (If you prefer, you can flag option
-arguments with `\|\c
-.B +\c
-\&\|' rather than `\|\c
-.B \-\c
-\&\|', though we illustrate the
-more usual convention.)
-
-All the options and command line arguments you give are processed
-in sequential order. The order makes a difference when the
-`\|\c
-.B \-x\c
-\&\|' option is used.
-
-.TP
-.B \-help
-.TP
-.B \-h
-List all options, with brief explanations.
-
-.TP
-.BI "\-symbols=" "file"\c
-.TP
-.BI "\-s " "file"\c
-\&
-Read symbol table from file \c
-.I file\c
-\&.
-
-.TP
-.BI "\-exec=" "file"\c
-.TP
-.BI "\-e " "file"\c
-\&
-Use file \c
-.I file\c
-\& as the executable file to execute when
-appropriate, and for examining pure data in conjunction with a core
-dump.
-
-.TP
-.BI "\-se=" "file"\c
-\&
-Read symbol table from file \c
-.I file\c
-\& and use it as the executable
-file.
-
-.TP
-.BI "\-core=" "file"\c
-.TP
-.BI "\-c " "file"\c
-\&
-Use file \c
-.I file\c
-\& as a core dump to examine.
-
-.TP
-.BI "\-command=" "file"\c
-.TP
-.BI "\-x " "file"\c
-\&
-Execute GDB commands from file \c
-.I file\c
-\&.
-
-.TP
-.BI "\-directory=" "directory"\c
-.TP
-.BI "\-d " "directory"\c
-\&
-Add \c
-.I directory\c
-\& to the path to search for source files.
-.PP
-
-.TP
-.B \-nx
-.TP
-.B \-n
-Do not execute commands from any `\|\c
-.B .gdbinit\c
-\&\|' initialization files.
-Normally, the commands in these files are executed after all the
-command options and arguments have been processed.
-
-
-.TP
-.B \-quiet
-.TP
-.B \-q
-``Quiet''. Do not print the introductory and copyright messages. These
-messages are also suppressed in batch mode.
-
-.TP
-.B \-batch
-Run in batch mode. Exit with status \c
-.B 0\c
-\& after processing all the command
-files specified with `\|\c
-.B \-x\c
-\&\|' (and `\|\c
-.B .gdbinit\c
-\&\|', if not inhibited).
-Exit with nonzero status if an error occurs in executing the GDB
-commands in the command files.
-
-Batch mode may be useful for running GDB as a filter, for example to
-download and run a program on another computer; in order to make this
-more useful, the message
-.sp
-.br
-Program\ exited\ normally.
-.br
-.sp
-
-(which is ordinarily issued whenever a program running under GDB control
-terminates) is not issued when running in batch mode.
-
-.TP
-.BI "\-cd=" "directory"\c
-\&
-Run GDB using \c
-.I directory\c
-\& as its working directory,
-instead of the current directory.
-
-.TP
-.B \-fullname
-.TP
-.B \-f
-Emacs sets this option when it runs GDB as a subprocess. It tells GDB
-to output the full file name and line number in a standard,
-recognizable fashion each time a stack frame is displayed (which
-includes each time the program stops). This recognizable format looks
-like two `\|\c
-.B \032\c
-\&\|' characters, followed by the file name, line number
-and character position separated by colons, and a newline. The
-Emacs-to-GDB interface program uses the two `\|\c
-.B \032\c
-\&\|' characters as
-a signal to display the source code for the frame.
-
-.TP
-.B \-kernel
-.TP
-.B \-k
-Use gdb in kernel debugging mode. The prompt is set to ``(kgdb)''.
-
-.TP
-.B \-wcore
-This option may only be used in kernel debugging mode while
-debugging a ``live'' kernel and makes the corefile (/dev/mem)
-writable.
-
-.TP
-.BI "\-b " "bps"\c
-\&
-Set the line speed (baud rate or bits per second) of any serial
-interface used by GDB for remote debugging.
-
-.TP
-.BI "\-tty=" "device"\c
-\&
-Run using \c
-.I device\c
-\& for your program's standard input and output.
-.PP
-
-.SH "SEE ALSO"
-.RB "`\|" gdb "\|'"
-entry in
-.B info\c
-\&;
-.I
-Using GDB: A Guide to the GNU Source-Level Debugger\c
-, Richard M. Stallman and Roland H. Pesch, July 1991.
-.SH COPYING
-Copyright (c) 1991 Free Software Foundation, Inc.
-.PP
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-.PP
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-.PP
-Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be included in
-translations approved by the Free Software Foundation instead of in
-the original English.
diff --git a/gnu/usr.bin/gdb/gdb/i386freebsd.h b/gnu/usr.bin/gdb/gdb/i386freebsd.h
deleted file mode 100644
index af011311..0000000
--- a/gnu/usr.bin/gdb/gdb/i386freebsd.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Intel 386 running any FreeBSD Unix */
-
-#include <machine/param.h>
-#include <machine/vmparam.h>
-
-#define NBPG PAGE_SIZE
-#define HOST_PAGE_SIZE NBPG
-#define HOST_MACHINE_ARCH bfd_arch_i386
-#define HOST_TEXT_START_ADDR USRTEXT
-
-/* Jolitz suggested defining HOST_STACK_END_ADDR to
- (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
- both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */
-
-/* This seems to be the right thing for FreeBSD and BSDI */
-#define HOST_STACK_END_ADDR USRSTACK
-
-/* BSDI defines this too (PST) */
-#define HOST_DATA_START_ADDR ((bfd_vma)u.u_kproc.kp_eproc.e_vm.vm_daddr)
-
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
- ((core_bfd)->tdata.trad_core_data->u.u_sig)
-#define u_comm u_kproc.kp_proc.p_comm
diff --git a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
deleted file mode 100644
index 900ce60..0000000
--- a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
+++ /dev/null
@@ -1,997 +0,0 @@
-/* Live and postmortem kernel debugging functions for FreeBSD.
- Copyright 1996 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#include "defs.h"
-
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/sysctl.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include "frame.h" /* required by inferior.h */
-#include "inferior.h"
-#include "symtab.h"
-#include "symfile.h"
-#include "objfiles.h"
-#include "command.h"
-#include "bfd.h"
-#include "target.h"
-#include "gdbcore.h"
-#include <sys/stat.h>
-#include <unistd.h>
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-
-#include <machine/vmparam.h>
-#include <machine/pcb.h>
-#include <machine/tss.h>
-#include <machine/frame.h>
-
-static void kcore_files_info PARAMS ((struct target_ops *));
-
-static void kcore_close PARAMS ((int));
-
-static void get_kcore_registers PARAMS ((int));
-
-static int kcore_xfer_kmem PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *));
-
-static int xfer_umem PARAMS ((CORE_ADDR, char *, int, int));
-
-static CORE_ADDR ksym_lookup PARAMS ((const char *));
-
-static int read_pcb PARAMS ((int, CORE_ADDR));
-
-static struct proc * curProc PARAMS ((void));
-
-static int set_proc_context PARAMS ((CORE_ADDR paddr));
-
-static void kcore_open PARAMS ((char *filename, int from_tty));
-
-static void kcore_detach PARAMS ((char *args, int from_tty));
-
-static void set_proc_cmd PARAMS ((char *arg, int from_tty));
-
-static void set_cpu_cmd PARAMS ((char *arg, int from_tty));
-
-static CORE_ADDR kvtophys PARAMS ((int, CORE_ADDR));
-
-static int physrd PARAMS ((int, u_int, char*, int));
-
-static int kvm_open PARAMS ((const char *efile, char *cfile, char *sfile,
- int perm, char *errout));
-
-static int kvm_close PARAMS ((int fd));
-
-static int kvm_write PARAMS ((int core_kd, CORE_ADDR memaddr,
- char *myaddr, int len));
-
-static int kvm_read PARAMS ((int core_kd, CORE_ADDR memaddr,
- char *myaddr, int len));
-
-static int kvm_uread PARAMS ((int core_kd, struct proc *p,
- CORE_ADDR memaddr, char *myaddr,
- int len));
-
-static int kernel_core_file_hook PARAMS ((int fd, CORE_ADDR addr,
- char *buf, int len));
-
-static struct kinfo_proc * kvm_getprocs PARAMS ((int cfd, int op,
- CORE_ADDR proc, int *cnt));
-
-extern struct target_ops kcore_ops; /* Forward decl */
-
-/* Non-zero means we are debugging a kernel core file */
-int kernel_debugging = 0;
-int kernel_writablecore = 0;
-
-static char *core_file;
-static int core_kd = -1;
-static struct proc *cur_proc;
-static CORE_ADDR kernel_start;
-
-static int ncpus;
-static int cpuid;
-static CORE_ADDR prv_space; /* per-cpu private space */
-static int prv_space_size;
-#define prv_start (prv_space + cpuid * prv_space_size)
-
-/*
- * Read the "thing" at kernel address 'addr' into the space pointed to
- * by point. The length of the "thing" is determined by the type of p.
- * Result is non-zero if transfer fails.
- */
-#define kvread(addr, p) \
- (target_read_memory ((CORE_ADDR)(addr), (char *)(p), sizeof(*(p))))
-
-
-
-/*
- * The following is FreeBSD-specific hackery to decode special frames
- * and elide the assembly-language stub. This could be made faster by
- * defining a frame_type field in the machine-dependent frame information,
- * but we don't think that's too important right now.
- */
-enum frametype { tf_normal, tf_trap, tf_interrupt, tf_syscall };
-
-CORE_ADDR
-fbsd_kern_frame_saved_pc (fr)
-struct frame_info *fr;
-{
- struct minimal_symbol *sym;
- CORE_ADDR this_saved_pc;
- enum frametype frametype;
-
- this_saved_pc = read_memory_integer (fr->frame + 4, 4);
- sym = lookup_minimal_symbol_by_pc (this_saved_pc);
- frametype = tf_normal;
- if (sym != NULL) {
- if (strcmp (SYMBOL_NAME(sym), "calltrap") == 0)
- frametype = tf_trap;
- else if (strncmp (SYMBOL_NAME(sym), "Xresume", 7) == 0)
- frametype = tf_interrupt;
- else if (strcmp (SYMBOL_NAME(sym), "Xsyscall") == 0)
- frametype = tf_syscall;
- }
-
- switch (frametype) {
- case tf_normal:
- return (this_saved_pc);
-
-#define oEIP offsetof(struct trapframe, tf_eip)
-
- case tf_trap:
- return (read_memory_integer (fr->frame + 8 + oEIP, 4));
-
- case tf_interrupt:
- return (read_memory_integer (fr->frame + 16 + oEIP, 4));
-
- case tf_syscall:
- return (read_memory_integer (fr->frame + 8 + oEIP, 4));
-#undef oEIP
- }
-}
-
-static CORE_ADDR
-ksym_lookup (name)
-const char *name;
-{
- struct minimal_symbol *sym;
-
- sym = lookup_minimal_symbol (name, NULL, NULL);
- if (sym == NULL)
- error ("kernel symbol `%s' not found.", name);
-
- return SYMBOL_VALUE_ADDRESS (sym);
-}
-
-static struct proc *
-curProc ()
-{
- struct proc *p;
- CORE_ADDR addr = ksym_lookup ("gd_curproc") + prv_start;
-
- if (kvread (addr, &p))
- error ("cannot read proc pointer at %x\n", addr);
- return p;
-}
-
-/*
- * Set the process context to that of the proc structure at
- * system address paddr.
- */
-static int
-set_proc_context (paddr)
- CORE_ADDR paddr;
-{
- struct proc p;
-
- if (paddr < kernel_start)
- return (1);
-
- cur_proc = (struct proc *)paddr;
-#ifdef notyet
- set_kernel_boundaries (cur_proc);
-#endif
-
- /* Fetch all registers from core file */
- target_fetch_registers (-1);
-
- /* Now, set up the frame cache, and print the top of stack */
- flush_cached_frames ();
- set_current_frame (create_new_frame (read_fp (), read_pc ()));
- select_frame (get_current_frame (), 0);
- return (0);
-}
-
-/* Discard all vestiges of any previous core file
- and mark data and stack spaces as empty. */
-
-/* ARGSUSED */
-static void
-kcore_close (quitting)
- int quitting;
-{
- inferior_pid = 0; /* Avoid confusion from thread stuff */
-
- if (core_kd)
- {
- kvm_close (core_kd);
- free (core_file);
- core_file = NULL;
- core_kd = -1;
- }
-}
-
-/* This routine opens and sets up the core file bfd */
-
-static void
-kcore_open (filename, from_tty)
- char *filename;
- int from_tty;
-{
- const char *p;
- struct cleanup *old_chain;
- char buf[256], *cp;
- int ontop;
- CORE_ADDR addr;
- struct pcb pcb;
-
- target_preopen (from_tty);
-
- unpush_target (&kcore_ops);
-
- if (!filename)
- {
- /*error (core_kd?*/
- error ( (core_kd >= 0)?
- "No core file specified. (Use `detach' to stop debugging a core file.)"
- : "No core file specified.");
- }
-
- filename = tilde_expand (filename);
- if (filename[0] != '/')
- {
- cp = concat (current_directory, "/", filename, NULL);
- free (filename);
- filename = cp;
- }
-
- old_chain = make_cleanup (free, filename);
-
- /*
- * gdb doesn't really do anything if the exec-file couldn't
- * be opened (in that case exec_bfd is NULL). Usually that's
- * no big deal, but kvm_open needs the exec-file's name,
- * which results in dereferencing a NULL pointer, a real NO-NO !
- * So, check here if the open of the exec-file succeeded.
- */
- if (exec_bfd == NULL) /* the open failed */
- error ("kgdb could not open the exec-file, please check the name you used !");
-
- core_kd = kvm_open (exec_bfd->filename, filename, NULL,
- kernel_writablecore? O_RDWR : O_RDONLY, "kgdb: ");
- if (core_kd < 0)
- perror_with_name (filename);
-
- /* Looks semi-reasonable. Toss the old core file and work on the new. */
-
- discard_cleanups (old_chain); /* Don't free filename any more */
- core_file = filename;
- ontop = !push_target (&kcore_ops);
-
- kernel_start = bfd_get_start_address (exec_bfd); /* XXX */
-
- /* print out the panic string if there is one */
- if (kvread (ksym_lookup ("panicstr"), &addr) == 0
- && addr != 0
- && target_read_memory (addr, buf, sizeof (buf)) == 0)
- {
- for (cp = buf; cp < &buf[sizeof (buf)] && *cp; cp++)
- if (!isascii (*cp) || (!isprint (*cp) && !isspace (*cp)))
- *cp = '?';
- *cp = '\0';
- if (buf[0] != '\0')
- printf ("panicstr: %s\n", buf);
- }
-
- /* Print all the panic messages if possible. */
- if (symfile_objfile != NULL)
- {
- printf ("panic messages:\n---\n");
- snprintf (buf, sizeof buf,
- "/sbin/dmesg -N %s -M %s | \
- /usr/bin/awk '/^(panic:|Fatal trap) / { printing = 1 } \
- { if (printing) print $0 }'",
- symfile_objfile->name, filename);
- fflush(stdout);
- system (buf);
- printf ("---\n");
- }
-
- if (!ontop)
- {
- warning ("you won't be able to access this core file until you terminate\n\
-your %s; do ``info files''", target_longname);
- return;
- }
-
- /* we may need this later */
- cur_proc = (struct proc *)curProc ();
- /* Now, set up the frame cache, and print the top of stack */
- flush_cached_frames ();
- set_current_frame (create_new_frame (read_fp (), read_pc ()));
- select_frame (get_current_frame (), 0);
- print_stack_frame (selected_frame, selected_frame_level, 1);
-}
-
-static void
-kcore_detach (args, from_tty)
- char *args;
- int from_tty;
-{
- if (args)
- error ("Too many arguments");
- unpush_target (&kcore_ops);
- reinit_frame_cache ();
- if (from_tty)
- printf_filtered ("No kernel core file now.\n");
-}
-
-/* Get the registers out of a core file. This is the machine-
- independent part. Fetch_core_registers is the machine-dependent
- part, typically implemented in the xm-file for each architecture. */
-
-/* We just get all the registers, so we don't use regno. */
-/* ARGSUSED */
-static void
-get_kcore_registers (regno)
- int regno;
-{
- struct user *uaddr;
-
- /* find the pcb for the current process */
- if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
- error ("cannot read u area ptr for proc at %#x", cur_proc);
- if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
- error ("cannot read pcb at %#x", &uaddr->u_pcb);
-}
-
-static void
-kcore_files_info (t)
- struct target_ops *t;
-{
- printf ("\t`%s'\n", core_file);
-}
-
-static int
-kcore_xfer_kmem (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write;
- struct target_ops *target;
-{
- int ns;
- int nu;
-
- if (memaddr >= (CORE_ADDR)VM_MAXUSER_ADDRESS)
- nu = 0;
- else
- {
- nu = xfer_umem (memaddr, myaddr, len, write);
- if (nu <= 0)
- return (0);
- if (nu == len)
- return (nu);
- memaddr += nu;
- if (memaddr != (CORE_ADDR)VM_MAXUSER_ADDRESS)
- return (nu);
- myaddr += nu;
- len -= nu;
- }
-
- ns = (write ? kvm_write : kvm_read) (core_kd, memaddr, myaddr, len);
- if (ns < 0)
- ns = 0;
-
- return (nu + ns);
-}
-
-static int
-xfer_umem (memaddr, myaddr, len, write)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write; /* ignored */
-{
- int n;
- struct proc proc;
-
- if (cur_proc == NULL || kvread (cur_proc, &proc))
- error ("cannot read proc at %#x", cur_proc);
- n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
-
- if (n < 0)
- return 0;
- return n;
-}
-
-#define KERNOFF ((unsigned)KERNBASE)
-#define INKERNEL(x) ((x) >= KERNOFF)
-
-static CORE_ADDR sbr;
-static CORE_ADDR curpcb;
-static int found_pcb;
-static int devmem;
-static int kfd;
-static struct pcb pcb;
-
-static void
-set_proc_cmd (arg, from_tty)
- char *arg;
- int from_tty;
-{
- CORE_ADDR paddr;
- struct kinfo_proc *kp;
- int cnt = 0;
-
- if (!arg)
- error_no_arg ("proc address for new current process");
- if (!kernel_debugging)
- error ("not debugging kernel");
-
- paddr = (CORE_ADDR)parse_and_eval_address (arg);
- /* assume it's a proc pointer if it's in the kernel */
- if (paddr >= kernel_start) {
- if (set_proc_context(paddr))
- error("invalid proc address");
- } else {
- kp = kvm_getprocs(core_kd, KERN_PROC_PID, paddr, &cnt);
- if (!cnt)
- error("invalid pid");
- if (set_proc_context((CORE_ADDR)kp->kp_eproc.e_paddr))
- error("invalid proc address");
- }
-}
-
-static void
-set_cpu_cmd (arg, from_tty)
- char *arg;
- int from_tty;
-{
- CORE_ADDR paddr;
- struct kinfo_proc *kp;
- int cpu, cfd;
-
- if (!arg)
- error_no_arg ("cpu number");
- if (!kernel_debugging)
- error ("not debugging kernel");
- if (!ncpus)
- error ("not debugging SMP kernel");
-
- cpu = (int)parse_and_eval_address (arg);
- if (cpu < 0 || cpu > ncpus)
- error ("cpu number out of range");
- cpuid = cpu;
-
- cfd = core_kd;
- curpcb = kvtophys(cfd, ksym_lookup ("gd_curpcb") + prv_start);
- physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb);
-
- if (!devmem)
- paddr = ksym_lookup ("dumppcb") - KERNOFF;
- else
- paddr = kvtophys (cfd, curpcb);
- read_pcb (cfd, paddr);
- printf ("initial pcb at %lx\n", (unsigned long)paddr);
-
- if ((cur_proc = curProc()))
- target_fetch_registers (-1);
-
- /* Now, set up the frame cache, and print the top of stack */
- flush_cached_frames ();
- set_current_frame (create_new_frame (read_fp (), read_pc ()));
- select_frame (get_current_frame (), 0);
- print_stack_frame (selected_frame, selected_frame_level, 1);
-}
-
-/* substitutes for the stuff in libkvm which doesn't work */
-/* most of this was taken from the old kgdb */
-
-/* we don't need all this stuff, but the call should look the same */
-
-static int
-kvm_open (efile, cfile, sfile, perm, errout)
- const char *efile;
- char *cfile;
- char *sfile; /* makes this kvm_open more compatible to the one in libkvm */
- int perm;
- char *errout; /* makes this kvm_open more compatible to the one in libkvm */
-{
- struct stat stb;
- int cfd;
- CORE_ADDR paddr;
-
- if ((cfd = open (cfile, perm, 0)) < 0)
- return (cfd);
-
- fstat (cfd, &stb);
- if ((stb.st_mode & S_IFMT) == S_IFCHR
- && stb.st_rdev == makedev (2, 0))
- {
- devmem = 1;
- kfd = open ("/dev/kmem", perm, 0);
- }
-
- if (lookup_minimal_symbol("mp_ncpus", NULL, NULL)) {
- physrd(cfd, ksym_lookup("mp_ncpus") - KERNOFF,
- (char*)&ncpus, sizeof(ncpus));
- prv_space = ksym_lookup("SMP_prvspace");
- prv_space_size = (int)ksym_lookup("gd_idlestack_top");
- printf ("SMP %d cpus\n", ncpus);
- } else {
- ncpus = 0;
- prv_space = 0;
- prv_space_size = 0;
- }
- cpuid = 0;
-
- physrd (cfd, ksym_lookup ("IdlePTD") - KERNOFF, (char*)&sbr, sizeof sbr);
- printf ("IdlePTD %lu\n", (unsigned long)sbr);
- curpcb = kvtophys(cfd, ksym_lookup ("gd_curpcb") + prv_start);
- physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb);
-
- found_pcb = 1; /* for vtophys */
- if (!devmem)
- paddr = ksym_lookup ("dumppcb") - KERNOFF;
- else
- paddr = kvtophys (cfd, curpcb);
- read_pcb (cfd, paddr);
- printf ("initial pcb at %lx\n", (unsigned long)paddr);
-
- return (cfd);
-}
-
-static int
-kvm_close (fd)
- int fd;
-{
- return (close (fd));
-}
-
-static int
-kvm_write (core_kd, memaddr, myaddr, len)
- int core_kd;
- CORE_ADDR memaddr;
- char *myaddr;
-{
- int cc;
-
- if (devmem)
- {
- if (kfd > 0)
- {
- /*
- * Just like kvm_read, only we write.
- */
- errno = 0;
- if (lseek (kfd, (off_t)memaddr, 0) < 0
- && errno != 0)
- {
- error ("kvm_write:invalid address (%x)", memaddr);
- return (0);
- }
- cc = write (kfd, myaddr, len);
- if (cc < 0)
- {
- error ("kvm_write:write failed");
- return (0);
- }
- else if (cc < len)
- error ("kvm_write:short write");
- return (cc);
- }
- else
- return (0);
- }
- else
- {
- printf ("kvm_write not implemented for dead kernels\n");
- return (0);
- }
- /* NOTREACHED */
-}
-
-static int
-kvm_read (core_kd, memaddr, myaddr, len)
- int core_kd;
- CORE_ADDR memaddr;
- char *myaddr;
-{
- return (kernel_core_file_hook (core_kd, memaddr, myaddr, len));
-}
-
-static int
-kvm_uread (core_kd, p, memaddr, myaddr, len)
- int core_kd;
- register struct proc *p;
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register char *cp;
- char procfile[MAXPATHLEN];
- ssize_t amount;
- int fd;
-
- if (devmem)
- {
- sprintf (procfile, "/proc/%d/mem", p->p_pid);
- fd = open (procfile, O_RDONLY, 0);
- if (fd < 0)
- {
- error ("cannot open %s", procfile);
- close (fd);
- return (0);
- }
-
- cp = myaddr;
- while (len > 0)
- {
- errno = 0;
- if (lseek (fd, (off_t)memaddr, 0) == -1 && errno != 0)
- {
- error ("invalid address (%x) in %s", memaddr, procfile);
- break;
- }
- amount = read (fd, cp, len);
- if (amount < 0)
- {
- error ("error reading %s", procfile);
- break;
- }
- if (amount == 0)
- {
- error ("EOF reading %s", procfile);
- break;
- }
- cp += amount;
- memaddr += amount;
- len -= amount;
- }
-
- close (fd);
- return ((ssize_t) (cp - myaddr));
- }
- else
- return (kernel_core_file_hook (core_kd, memaddr, myaddr, len));
-}
-
-static struct kinfo_proc kp;
-
-/*
- * try to do what kvm_proclist in libkvm would do
- */
-static int
-kvm_proclist (cfd, pid, p, cnt)
-int cfd, pid, *cnt;
-struct proc *p;
-{
- struct proc lp;
-
- for (; p != NULL; p = lp.p_list.le_next) {
- if (!kvm_read(cfd, (CORE_ADDR)p, (char *)&lp, sizeof (lp)))
- return (0);
- if (lp.p_pid != pid)
- continue;
- kp.kp_eproc.e_paddr = p;
- *cnt = 1;
- return (1);
- }
- *cnt = 0;
- return (0);
-}
-
-/*
- * try to do what kvm_deadprocs in libkvm would do
- */
-static struct kinfo_proc *
-kvm_deadprocs (cfd, pid, cnt)
-int cfd, pid, *cnt;
-{
- CORE_ADDR allproc, zombproc;
- struct proc *p;
-
- allproc = ksym_lookup("allproc");
- if (kvm_read(cfd, allproc, (char *)&p, sizeof (p)) == 0)
- return (NULL);
- kvm_proclist (cfd, pid, p, cnt);
- if (!*cnt) {
- zombproc = ksym_lookup("zombproc");
- if (kvm_read(cfd, zombproc, (char *)&p, sizeof (p)) == 0)
- return (NULL);
- kvm_proclist (cfd, pid, p, cnt);
- }
- return (&kp);
-}
-
-/*
- * try to do what kvm_getprocs in libkvm would do
- */
-static struct kinfo_proc *
-kvm_getprocs (cfd, op, proc, cnt)
-int cfd, op, *cnt;
-CORE_ADDR proc;
-{
- int mib[4], size;
-
- *cnt = 0;
- /* assume it's a pid */
- if (devmem) { /* "live" kernel, use sysctl */
- mib[0] = CTL_KERN;
- mib[1] = KERN_PROC;
- mib[2] = KERN_PROC_PID;
- mib[3] = (int)proc;
- size = sizeof (kp);
- if (sysctl (mib, 4, &kp, &size, NULL, 0) < 0) {
- perror("sysctl");
- *cnt = 0;
- return (NULL);
- }
- if (!size)
- *cnt = 0;
- else
- *cnt = 1;
- return (&kp);
- } else
- return (kvm_deadprocs (cfd, (int)proc, cnt));
-}
-
-static int
-physrd (cfd, addr, dat, len)
- int cfd;
- u_int addr;
- char *dat;
- int len;
-{
- if (lseek (cfd, (off_t)addr, L_SET) == -1)
- return (-1);
- return (read (cfd, dat, len));
-}
-
-static CORE_ADDR
-kvtophys (fd, addr)
- int fd;
- CORE_ADDR addr;
-{
- CORE_ADDR v;
- unsigned int pte;
- static CORE_ADDR PTD = -1;
- CORE_ADDR current_ptd;
-
- /*
- * We may no longer have a linear system page table...
- *
- * Here's the scoop. IdlePTD contains the physical address
- * of a page table directory that always maps the kernel.
- * IdlePTD is in memory that is mapped 1-to-1, so we can
- * find it easily given its 'virtual' address from ksym_lookup().
- * For hysterical reasons, the value of IdlePTD is stored in sbr.
- *
- * To look up a kernel address, we first convert it to a 1st-level
- * address and look it up in IdlePTD. This gives us the physical
- * address of a page table page; we extract the 2nd-level part of
- * VA and read the 2nd-level pte. Finally, we add the offset part
- * of the VA into the physical address from the pte and return it.
- *
- * User addresses are a little more complicated. If we don't have
- * a current PCB from read_pcb(), we use PTD, which is the (fixed)
- * virtual address of the current ptd. Since it's NOT in 1-to-1
- * kernel space, we must look it up using IdlePTD. If we do have
- * a pcb, we get the ptd from pcb_ptd.
- */
-
- if (INKERNEL (addr))
- current_ptd = sbr;
- else if (found_pcb == 0)
- {
- if (PTD == -1)
- PTD = kvtophys (fd, ksym_lookup ("PTD"));
- current_ptd = PTD;
- }
- else
- current_ptd = pcb.pcb_cr3;
-
- /*
- * Read the first-level page table (ptd).
- */
- v = current_ptd + ( (unsigned)addr >> PDRSHIFT) * sizeof pte;
- if (physrd (fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0)
- return (~0);
-
- if (pte & PG_PS)
- {
- /*
- * No second-level page table; ptd describes one 4MB page.
- * (We assume that the kernel wouldn't set PG_PS without enabling
- * it cr0, and that the kernel doesn't support 36-bit physical
- * addresses).
- */
-#define PAGE4M_MASK (NBPDR - 1)
-#define PG_FRAME4M (~PAGE4M_MASK)
- addr = (pte & PG_FRAME4M) + (addr & PAGE4M_MASK);
- }
- else
- {
- /*
- * Read the second-level page table.
- */
- v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte;
- if (physrd (fd, v, (char *) &pte, sizeof (pte)) < 0 || (pte&PG_V) == 0)
- return (~0);
-
- addr = (pte & PG_FRAME) + (addr & PAGE_MASK);
- }
-#if 0
- printf ("vtophys (%x) -> %x\n", oldaddr, addr);
-#endif
- return (addr);
-}
-
-static int
-read_pcb (fd, uaddr)
- int fd;
- CORE_ADDR uaddr;
-{
- int i;
- int noreg;
- CORE_ADDR nuaddr = uaddr;
-
- /* need this for the `proc' command to work */
- if (INKERNEL(uaddr))
- nuaddr = kvtophys(fd, uaddr);
-
- if (physrd (fd, nuaddr, (char *)&pcb, sizeof pcb) < 0)
- {
- error ("cannot read pcb at %x\n", uaddr);
- return (-1);
- }
-
- /*
- * get the register values out of the sys pcb and
- * store them where `read_register' will find them.
- */
- /*
- * XXX many registers aren't available.
- * XXX for the non-core case, the registers are stale - they are for
- * the last context switch to the debugger.
- * XXX gcc's register numbers aren't all #defined in tm-i386.h.
- */
- noreg = 0;
- for (i = 0; i < 3; ++i) /* eax,ecx,edx */
- supply_register (i, (char *)&noreg);
- supply_register (3, (char *)&pcb.pcb_ebx);
- supply_register (SP_REGNUM, (char *)&pcb.pcb_esp);
- supply_register (FP_REGNUM, (char *)&pcb.pcb_ebp);
- supply_register (6, (char *)&pcb.pcb_esi);
- supply_register (7, (char *)&pcb.pcb_edi);
- supply_register (PC_REGNUM, (char *)&pcb.pcb_eip);
- for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es, fs */
- supply_register (i, (char *)&noreg);
- supply_register (15, (char *)&pcb.pcb_gs);
-
- /* XXX 80387 registers? */
-}
-
-/*
- * read len bytes from kernel virtual address 'addr' into local
- * buffer 'buf'. Return numbert of bytes if read ok, 0 otherwise. On read
- * errors, portion of buffer not read is zeroed.
- */
-
-static int
-kernel_core_file_hook (fd, addr, buf, len)
- int fd;
- CORE_ADDR addr;
- char *buf;
- int len;
-{
- int i;
- CORE_ADDR paddr;
- register char *cp;
- int cc;
-
- cp = buf;
-
- while (len > 0)
- {
- paddr = kvtophys (fd, addr);
- if (paddr == ~0)
- {
- memset (buf, '\000', len);
- break;
- }
- /* we can't read across a page boundary */
- i = min (len, PAGE_SIZE - (addr & PAGE_MASK));
- if ( (cc = physrd (fd, paddr, cp, i)) <= 0)
- {
- memset (cp, '\000', len);
- return (cp - buf);
- }
- cp += cc;
- addr += cc;
- len -= cc;
- }
- return (cp - buf);
-}
-
-struct target_ops kcore_ops = {
- "kcore", /* to_shortname */
- "Kernel core dump file", /* to_longname */
- "Use a core file as a target. Specify the filename of the core file.", /* to_doc */
- kcore_open, /* to_open */
- kcore_close, /* to_close */
- find_default_attach, /* to_attach */
- kcore_detach, /* to_detach */
- NULL, /* to_resume */
- NULL, /* to_wait */
- get_kcore_registers, /* to_fetch_registers */
- NULL, /* to_store_registers */
- NULL, /* to_prepare_to_store */
- kcore_xfer_kmem, /* to_xfer_memory */
- kcore_files_info, /* to_files_info */
- NULL, /* to_insert_breakpoint */
- NULL, /* to_remove_breakpoint */
- NULL, /* to_terminal_init */
- NULL, /* to_terminal_inferior */
- NULL, /* to_terminal_ours_for_output */
- NULL, /* to_terminal_ours */
- NULL, /* to_terminal_info */
- NULL, /* to_kill */
- NULL, /* to_load */
- NULL, /* to_lookup_symbol */
- find_default_create_inferior, /* to_create_inferior */
- NULL, /* to_mourn_inferior */
- 0, /* to_can_run */
- 0, /* to_notice_signals */
- NULL, /* to_thread_alive */
- 0, /* to_stop */
- kcore_stratum, /* to_stratum */
- NULL, /* to_next */
- 0, /* to_has_all_memory */
- 1, /* to_has_memory */
- 1, /* to_has_stack */
- 1, /* to_has_registers */
- 0, /* to_has_execution */
- NULL, /* sections */
- NULL, /* sections_end */
- OPS_MAGIC /* to_magic */
-};
-
-void
-_initialize_kcorelow()
-{
- add_target (&kcore_ops);
- add_com ("proc", class_obscure, set_proc_cmd, "Set current process context");
- add_com ("cpu", class_obscure, set_cpu_cmd, "Set current cpu");
-}
diff --git a/gnu/usr.bin/gdb/gdb/nm.h b/gnu/usr.bin/gdb/gdb/nm.h
deleted file mode 100644
index 84ec01e..0000000
--- a/gnu/usr.bin/gdb/gdb/nm.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Native-dependent definitions for Intel 386 running BSD Unix, for GDB.
- Copyright 1986, 1987, 1989, 1992, 1996 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#ifndef NM_FBSD_H
-#define NM_FBSD_H
-
-#define ATTACH_DETACH
-
-/* Be shared lib aware */
-#include "solib.h"
-#ifdef FREEBSD_ELF
-#define SVR4_SHARED_LIBS
-#endif
-
-/* This is the amount to subtract from u.u_ar0
- to get the offset in the core file of the register values. */
-
-#include <machine/vmparam.h>
-#define KERNEL_U_ADDR USRSTACK
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- (addr) = i386_register_u_addr ((blockend),(regno));
-
-/* We define our own fetch/store methods */
-#define FETCH_INFERIOR_REGISTERS
-
-extern int
-i386_register_u_addr PARAMS ((int, int));
-
-#define PTRACE_ARG3_TYPE char*
-
-#ifndef FREEBSD_ELF
-
-/* make structure definitions match up with those expected in solib.c */
-#define link_object sod
-#define lo_name sod_name
-#define lo_library sod_library
-#define lo_unused sod_reserved
-#define lo_major sod_major
-#define lo_minor sod_minor
-#define lo_next sod_next
-
-#define link_map so_map
-#define lm_addr som_addr
-#define lm_name som_path
-#define lm_next som_next
-#define lm_lop som_sod
-#define lm_lob som_sodbase
-#define lm_rwt som_write
-#define lm_ld som_dynamic
-#define lm_lpd som_spd
-
-#define link_dynamic_2 section_dispatch_table
-#define ld_loaded sdt_loaded
-#define ld_need sdt_sods
-#define ld_rules sdt_filler1
-#define ld_got sdt_got
-#define ld_plt sdt_plt
-#define ld_rel sdt_rel
-#define ld_hash sdt_hash
-#define ld_stab sdt_nzlist
-#define ld_stab_hash sdt_filler2
-#define ld_buckets sdt_buckets
-#define ld_symbols sdt_strings
-#define ld_symb_size sdt_str_sz
-#define ld_text sdt_text_sz
-#define ld_plt_sz sdt_plt_sz
-
-#define rtc_symb rt_symbol
-#define rtc_sp rt_sp
-#define rtc_next rt_next
-
-#define ld_debug so_debug
-#define ldd_version dd_version
-#define ldd_in_debugger dd_in_debugger
-#define ldd_sym_loaded dd_sym_loaded
-#define ldd_bp_addr dd_bpt_addr
-#define ldd_bp_inst dd_bpt_shadow
-#define ldd_cp dd_cc
-
-#define link_dynamic _dynamic
-#define ld_version d_version
-#define ldd d_debug
-#define ld_un d_un
-#define ld_2 d_sdt
-
-#endif
-
-/* Return sizeof user struct to callers in less machine dependent routines */
-
-#define KERNEL_U_SIZE kernel_u_size()
-extern int kernel_u_size PARAMS ((void));
-
-#define ADDITIONAL_OPTIONS \
- {"kernel", no_argument, &kernel_debugging, 1}, \
- {"k", no_argument, &kernel_debugging, 1}, \
- {"wcore", no_argument, &kernel_writablecore, 1}, \
- {"w", no_argument, &kernel_writablecore, 1},
-
-#define ADDITIONAL_OPTION_HELP \
- "\
- --kernel Enable kernel debugging.\n\
- --wcore Make core file writable (only works for /dev/mem).\n\
- This option only works while debugging a kernel !!\n\
-"
-
-extern int kernel_debugging;
-extern int kernel_writablecore;
-
-#define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) "
-
-/* misuse START_PROGRESS to test whether we're running as kgdb */
-/* START_PROGRESS is called at the top of main */
-#undef START_PROGRESS
-#define START_PROGRESS(STR,N) \
- if (!strcmp(STR, "kgdb")) \
- kernel_debugging = 1;
-
-#endif /* NM_FBSD_H */
diff --git a/gnu/usr.bin/gdb/gdb/tm.h b/gnu/usr.bin/gdb/gdb/tm.h
deleted file mode 100644
index 39fda77..0000000
--- a/gnu/usr.bin/gdb/gdb/tm.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Macro definitions for x86 running under FreeBSD Unix.
- Copyright 1996 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#ifndef TM_FBSD_H
-#define TM_FBSD_H 1
-
-#include "i386/tm-i386bsd.h"
-
-#undef NUM_REGS
-#define NUM_REGS 16
-
-extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));
-
-#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
-
-extern void i386_float_info PARAMS ((void));
-
-#define FLOAT_INFO i386_float_info ()
-
-#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) STREQ (name, "_DYNAMIC")
-
-/* Saved Pc. Get it from sigcontext if within sigtramp. */
-
-extern CORE_ADDR fbsd_kern_frame_saved_pc (struct frame_info *);
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(FRAME) \
- (kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \
- (((FRAME)->signal_handler_caller \
- ? sigtramp_saved_pc (FRAME) \
- : read_memory_integer ((FRAME)->frame + 4, 4)) \
- ))
-
-/* On FreeBSD, sigtramp has size 0x18 and is immediately below the
- ps_strings struct which has size 0x10 and is at the top of the
- user stack. */
-
-#undef SIGTRAMP_START
-#undef SIGTRAMP_END
-#define SIGTRAMP_START 0xefbfdfd8
-#define SIGTRAMP_END 0xefbfdff0
-
-#endif /* ifndef TM_FBSD_H */
diff --git a/gnu/usr.bin/gdb/gdb/version.c b/gnu/usr.bin/gdb/gdb/version.c
deleted file mode 100644
index 3d677fe..0000000
--- a/gnu/usr.bin/gdb/gdb/version.c
+++ /dev/null
@@ -1,3 +0,0 @@
-char *version = "4.16";
-char *host_name = "i386-unknown-freebsd";
-char *target_name = "i386-unknown-freebsd";
diff --git a/gnu/usr.bin/gdb/gdb/xm.h b/gnu/usr.bin/gdb/gdb/xm.h
deleted file mode 100644
index 8a852a2..0000000
--- a/gnu/usr.bin/gdb/gdb/xm.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Host-dependent definitions for Intel 386 running BSD Unix, for GDB.
- Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#define HOST_BYTE_ORDER LITTLE_ENDIAN
-
-#include <machine/limits.h> /* for INT_MIN, to avoid "INT_MIN
- redefined" warnings from defs.h */
diff --git a/gnu/usr.bin/gdb/gdbreplay/Makefile b/gnu/usr.bin/gdb/gdbreplay/Makefile
deleted file mode 100644
index 1d93cc3..0000000
--- a/gnu/usr.bin/gdb/gdbreplay/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# $Id: Makefile,v 1.2 1997/04/26 17:34:04 pst Exp $
-
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.PATH: ${GDBDIR}/gdb/gdbserver
-.PATH: ${GDBDIR}/gdb
-.PATH: ${GDBDIR}/opcodes
-
-PROG= gdbreplay
-NOMAN= yes
-
-SRCS= gdbreplay.c
-
-CFLAGS+=-I${.CURDIR}/../gdb -I${.CURDIR}/../bfd
-CFLAGS+=-DNO_MMALLOC
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/gdbserver/Makefile b/gnu/usr.bin/gdb/gdbserver/Makefile
deleted file mode 100644
index 366f1b7..0000000
--- a/gnu/usr.bin/gdb/gdbserver/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# $Id: Makefile,v 1.2 1997/04/26 17:34:05 pst Exp $
-
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.PATH: ${GDBDIR}/gdb/gdbserver
-.PATH: ${GDBDIR}/gdb
-.PATH: ${GDBDIR}/opcodes
-
-PROG= gdbserver
-
-SRCS= remote-utils.c utils.c server.c
-SRCS+= low-fbsd.c
-
-CFLAGS+=-I${.CURDIR}/../gdb -I${.CURDIR}/../bfd
-CFLAGS+=-DNO_MMALLOC
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/gdbserver/low-fbsd.c b/gnu/usr.bin/gdb/gdbserver/low-fbsd.c
deleted file mode 100644
index bc85f36..0000000
--- a/gnu/usr.bin/gdb/gdbserver/low-fbsd.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* Low level interface to ptrace, for the remote server for GDB.
- Copyright (C) 1995 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-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 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. */
-
-#include "defs.h"
-#include <sys/wait.h>
-#include "frame.h"
-#include "inferior.h"
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <dirent.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sgtty.h>
-#include <fcntl.h>
-
-/***************Begin MY defs*********************/
-int quit_flag = 0;
-char registers[REGISTER_BYTES];
-
-/* Index within `registers' of the first byte of the space for
- register N. */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
-/***************End MY defs*********************/
-
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-extern char **environ;
-extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
-
-/* Start an inferior process and returns its pid.
- ALLARGS is a vector of program-name and args.
- ENV is the environment vector to pass. */
-
-int
-create_inferior (program, allargs)
- char *program;
- char **allargs;
-{
- int pid;
-
- pid = fork ();
- if (pid < 0)
- perror_with_name ("fork");
-
- if (pid == 0)
- {
- ptrace (PT_TRACE_ME, 0, 0, 0);
-
- execv (program, allargs);
-
- fprintf (stderr, "Cannot exec %s: %s.\n", program, strerror(errno));
- fflush (stderr);
- _exit (0177);
- }
-
- return pid;
-}
-
-/* Kill the inferior process. Make us have no inferior. */
-
-void
-kill_inferior ()
-{
- if (inferior_pid == 0)
- return;
- ptrace (PT_KILL, inferior_pid, 0, 0);
- wait (0);
- /*************inferior_died ();****VK**************/
-}
-
-/* Return nonzero if the given thread is still alive. */
-int
-mythread_alive (pid)
- int pid;
-{
- return 1;
-}
-
-/* Wait for process, returns status */
-
-unsigned char
-mywait (status)
- char *status;
-{
- int pid;
- int w;
-
- pid = wait (&w);
- if (pid != inferior_pid)
- perror_with_name ("wait");
-
- if (WIFEXITED (w))
- {
- fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
- *status = 'W';
- return ((unsigned char) WEXITSTATUS (w));
- }
- else if (!WIFSTOPPED (w))
- {
- fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
- *status = 'X';
- return ((unsigned char) WTERMSIG (w));
- }
-
- fetch_inferior_registers (0);
-
- *status = 'T';
- return ((unsigned char) WSTOPSIG (w));
-}
-
-/* Resume execution of the inferior process.
- If STEP is nonzero, single-step it.
- If SIGNAL is nonzero, give it that signal. */
-
-void
-myresume (step, signal)
- int step;
- int signal;
-{
- errno = 0;
- ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid,
- (PTRACE_ARG3_TYPE) 1, signal);
- if (errno)
- perror_with_name ("ptrace");
-}
-
-
-#if !defined (offsetof)
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
-/* U_REGS_OFFSET is the offset of the registers within the u area. */
-#if !defined (U_REGS_OFFSET)
-#define U_REGS_OFFSET \
- ptrace (PT_READ_U, inferior_pid, \
- (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
- - KERNEL_U_ADDR
-#endif
-
-unsigned int
-register_addr (regno, blockend)
- int regno;
- int blockend;
-{
- int addr;
-
- if (regno < 0 || regno >= ARCH_NUM_REGS)
- error ("Invalid register number %d.", regno);
-
- REGISTER_U_ADDR (addr, blockend, regno);
-
- return addr;
-}
-
-/* Fetch one register. */
-
-static void
-fetch_register (regno)
- int regno;
-{
- register unsigned int regaddr;
- char buf[MAX_REGISTER_RAW_SIZE];
- register int i;
-
- /* Offset of registers within the u area. */
- unsigned int offset;
-
- offset = U_REGS_OFFSET;
-
- regaddr = register_addr (regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
- {
- errno = 0;
- *(int *) &registers[ regno * sizeof(int) + i] =
- ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0);
- regaddr += sizeof (int);
- if (errno != 0)
- {
- /* Warning, not error, in case we are attached; sometimes the
- kernel doesn't let us at the registers. */
- char *err = strerror (errno);
- char *msg = alloca (strlen (err) + 128);
- sprintf (msg, "reading register %d: %s", regno, err);
- error (msg);
- goto error_exit;
- }
- }
- error_exit:;
-}
-
-/* Fetch all registers, or just one, from the child process. */
-
-void
-fetch_inferior_registers (regno)
- int regno;
-{
- if (regno == -1 || regno == 0)
- for (regno = 0; regno < NUM_REGS; regno++)
- fetch_register (regno);
- else
- fetch_register (regno);
-}
-
-/* Store our register values back into the inferior.
- If REGNO is -1, do this for all registers.
- Otherwise, REGNO specifies which register (so we can save time). */
-
-void
-store_inferior_registers (regno)
- int regno;
-{
- register unsigned int regaddr;
- char buf[80];
- extern char registers[];
- register int i;
- unsigned int offset = U_REGS_OFFSET;
- int scratch;
-
- if (regno >= 0)
- {
- regaddr = register_addr (regno, offset);
- errno = 0;
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
- {
- errno = 0;
- ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
- *(int *) &registers[REGISTER_BYTE (regno) + i]);
- if (errno != 0)
- {
- /* Warning, not error, in case we are attached; sometimes the
- kernel doesn't let us at the registers. */
- char *err = strerror (errno);
- char *msg = alloca (strlen (err) + 128);
- sprintf (msg, "writing register %d: %s",
- regno, err);
- error (msg);
- return;
- }
- regaddr += sizeof(int);
- }
- }
- else
- for (regno = 0; regno < NUM_REGS; regno++)
- store_inferior_registers (regno);
-}
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
- in the NEW_SUN_PTRACE case.
- It ought to be straightforward. But it appears that writing did
- not write the data that I specified. I cannot understand where
- it got the data that it actually did write. */
-
-/* Copy LEN bytes from inferior's memory starting at MEMADDR
- to debugger memory starting at MYADDR. */
-
-read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
-
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- buffer[i] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
- }
-
- /* Copy appropriate bytes out of the buffer. */
- memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-}
-
-/* Copy LEN bytes of data from debugger memory at MYADDR
- to inferior's memory at MEMADDR.
- On failure (cannot write the inferior)
- returns the value of errno. */
-
-int
-write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -sizeof (int);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
- /* Allocate buffer of that many longwords. */
- register int *buffer = (int *) alloca (count * sizeof (int));
- extern int errno;
-
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- buffer[0] = ptrace (PT_READ_I, inferior_pid,
- (PTRACE_ARG3_TYPE) addr, 0);
-
- if (count > 1)
- {
- buffer[count - 1]
- = ptrace (PT_READ_I, inferior_pid,
- (PTRACE_ARG3_TYPE) addr + (count - 1) * sizeof (int), 0);
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, buffer[i]);
- if (errno)
- return errno;
- }
-
- return 0;
-}
-
-void
-initialize ()
-{
- inferior_pid = 0;
-}
-
-int
-have_inferior_p ()
-{
- return inferior_pid != 0;
-}
-
-/* Some systems don't provide all the registers on a trap. Use SS as a
- default if so. */
-
-#ifndef tDS
-#define tDS tSS
-#endif
-#ifndef tES
-#define tES tSS
-#endif
-#ifndef tFS
-#define tFS tSS
-#endif
-#ifndef tGS
-#define tGS tSS
-#endif
-
-/* These tables map between the registers on a trap frame, and the register
- order used by the rest of GDB. */
-/* this table must line up with REGISTER_NAMES in tm-i386.h */
-/* symbols like 'tEAX' come from <machine/reg.h> */
-static int tregmap[] =
-{
- tEAX, tECX, tEDX, tEBX,
- tESP, tEBP, tESI, tEDI,
- tEIP, tEFLAGS, tCS, tSS,
- tDS, tES, tFS, tGS
-};
-
-#ifdef sEAX
-static int sregmap[] =
-{
- sEAX, sECX, sEDX, sEBX,
- sESP, sEBP, sESI, sEDI,
- sEIP, sEFLAGS, sCS, sSS
-};
-#else /* No sEAX */
-
-/* FreeBSD has decided to collapse the s* and t* symbols. So if the s*
- ones aren't around, use the t* ones for sregmap too. */
-
-static int sregmap[] =
-{
- tEAX, tECX, tEDX, tEBX,
- tESP, tEBP, tESI, tEDI,
- tEIP, tEFLAGS, tCS, tSS,
- tDS, tES, tFS, tGS
-};
-#endif /* No sEAX */
-
-/* blockend is the value of u.u_ar0, and points to the
- place where ES is stored. */
-
-int
-i386_register_u_addr (blockend, regnum)
- int blockend;
- int regnum;
-{
- /* The following condition is a kludge to get at the proper register map
- depending upon the state of pcb_flag.
- The proper condition would be
- if (u.u_pcb.pcb_flag & FM_TRAP)
- but that would require a ptrace call here and wouldn't work
- for corefiles. */
-
- if (blockend < 0x1fcc)
- return (blockend + 4 * tregmap[regnum]);
- else
- return (blockend + 4 * sregmap[regnum]);
-}
diff --git a/gnu/usr.bin/gdb/libiberty/Makefile b/gnu/usr.bin/gdb/libiberty/Makefile
deleted file mode 100644
index 25de36c..0000000
--- a/gnu/usr.bin/gdb/libiberty/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-LIB= iberty
-INTERNALLIB= true
-INTERNALSTATICLIB= true
-
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.PATH: ${GDBDIR}/libiberty
-
-SRCS= argv.c basename.c concat.c cplus-dem.c fdmatch.c getopt.c \
- getopt1.c getruntime.c hex.c floatformat.c obstack.c spaces.c \
- strsignal.c xatexit.c xexit.c \
- xmalloc.c xstrdup.c xstrerror.c insque.c
-
-CFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/../gdb/.
-
-.include <bsd.lib.mk>
diff --git a/gnu/usr.bin/gdb/libiberty/alloca-conf.h b/gnu/usr.bin/gdb/libiberty/alloca-conf.h
deleted file mode 100644
index 8d91b5a..0000000
--- a/gnu/usr.bin/gdb/libiberty/alloca-conf.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* "Normal" configuration for alloca. */
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not __GNUC__ */
-#ifdef sparc
-#include <alloca.h>
-extern char *__builtin_alloca(); /* Stupid include file doesn't declare it */
-#else
-#ifdef __STDC__
-PTR alloca (size_t);
-#else
-PTR alloca (); /* must agree with functions.def */
-#endif
-#endif /* sparc */
-#endif /* not __GNUC__ */
diff --git a/gnu/usr.bin/gdb/libiberty/config.h b/gnu/usr.bin/gdb/libiberty/config.h
deleted file mode 100644
index cff00a8..0000000
--- a/gnu/usr.bin/gdb/libiberty/config.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* !Automatically generated from ./functions.def - DO NOT EDIT! */
-#ifndef NEED_basename
-#define NEED_basename
-#endif
-#ifndef NEED_on_exit
-#define NEED_on_exit
-#endif
OpenPOWER on IntegriCloud