Bug#57210: remove pstack

Quoting from the bug report:

The pstack library has been included in MySQL since version
4.0.0. It's useless and should be removed.

Details: According to its own documentation, pstack only works
on Linux on x86 in 32 bit mode and requires LinuxThreads and a
statically linked binary. It doesn't really support any Linux
from 2003 or later and doesn't work on any other OS.

The --enable-pstack option is thus deprecated and has no effect.
This commit is contained in:
Davi Arnaut 2010-11-09 12:45:13 -02:00
parent b21d06f680
commit b963c7b14d
29 changed files with 14 additions and 22399 deletions

View File

@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $static_link"
extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server --without-pstack"
extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server"
. "$path/FINISH.sh"

View File

@ -23,7 +23,6 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \
@pstack_dir@ \
@sql_union_dirs@ unittest \
@sql_server@ @man_dirs@ tests \
netware @libmysqld_dirs@ \
@ -32,7 +31,6 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
DIST_SUBDIRS = . include Docs zlib \
cmd-line-utils sql-common scripts \
pstack \
strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
vio sql man tests \
netware libmysqld \

94
README
View File

@ -1192,97 +1192,3 @@ library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
***************************************************************************
%%The following software may be included in this product:
pstack (part of GNU Binutils)
Use of any of this software is governed by the terms of the license below:
pstack is comprised of various .c and .h files; all begin like this:
/* bucomm.h -- binutils common include file.
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
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. */
***************************************************************************
%%The following software may be included in this product:
libiberty.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://www.koders.com/c/fid99F596804BBE22C076522B848D5575F142079064.aspx
/* Function declarations for libiberty.
Written by Cygnus Support, 1994.
The libiberty library provides a number of functions which are
missing on some operating systems. We do not declare those here,
to avoid conflicts with the system header files on operating
systems that do support those functions. In this file we only
declare those functions which are specific to libiberty. */
***************************************************************************
%%The following software may be included in this product:
ieee.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee.h
/* IEEE Standard 695-1980 "Universal Format for Object Modules"
header file
Contributed by Cygnus Support. */
***************************************************************************
%%The following software may be included in this product:
pstack.c (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
/*
pstack.c -- asynchronous stack trace of a running process
Copyright (c) 1999 Ross Thompson
Author: Ross Thompson
Critical bug fix: Tim Waugh
*/
/*
This file 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.
*/
***************************************************************************

View File

@ -910,46 +910,6 @@ struct request_info *req;
])
AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],
[ USE_PSTACK=no ])
pstack_libs=
pstack_dir=
if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
dnl I have no idea if this is a good test - can not find docs for libiberty
AC_CHECK_LIB([iberty], [fdmatch],
[have_libiberty=yes
AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])])
LIBS="$my_save_LIBS"
if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
then
pstack_dir="pstack"
pstack_libs="../pstack/libpstack.a -lbfd -liberty"
# We must link staticly when using pstack
with_mysqld_ldflags="-all-static"
AC_SUBST([pstack_dir])
AC_SUBST([pstack_libs])
AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
dnl This check isn't needed, but might be nice to give some feedback....
dnl AC_CHECK_HEADER(libiberty.h,
dnl have_libiberty_h=yes,
dnl have_libiberty_h=no)
else
USE_PSTACK="no"
fi
else
USE_PSTACK="no"
fi
fi
AC_MSG_CHECKING([if we should use pstack])
AC_MSG_RESULT([$USE_PSTACK])
# Check for gtty if termio.h doesn't exists
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then
@ -1178,7 +1138,7 @@ dnl Is this the right match for DEC OSF on alpha?
sql/Makefile.in)
# Use gen_lex_hash.linux instead of gen_lex_hash
# Add library dependencies to mysqld_DEPENDENCIES
lib_DEPENDENCIES="\$(pstack_libs) \$(openssl_libs) \$(yassl_libs)"
lib_DEPENDENCIES="\$(openssl_libs) \$(yassl_libs)"
cat > $filesed << EOF
s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES %
@ -2880,9 +2840,6 @@ esac
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
# Output results
if test -d "$srcdir/pstack" ; then
AC_CONFIG_FILES(pstack/Makefile pstack/aout/Makefile)
fi
if test -d "$srcdir/cmd-line-utils/readline" ; then
AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
fi

View File

@ -20,7 +20,6 @@
/* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */

View File

@ -1,32 +0,0 @@
# Copyright (C) 2000-2003, 2005 MySQL AB
#
# 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; version 2 of the License.
#
# 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
#
# As pstack doesn't work on all configurations, we have to use
# the USE_PSTACK hack to get all files into distribution
#
SUBDIRS = aout
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libpstack.a
libpstack_a_SOURCES = bucomm.c filemode.c linuxthreads.c rddbg.c \
debug.c ieee.c pstack.c stabs.c
noinst_HEADERS = bucomm.h debug.h ieee.h budbg.h demangle.h \
linuxthreads.h pstack.h pstacktrace.h
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -1,4 +0,0 @@
noinst_HEADERS = aout64.h stab.def stab_gnu.h
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -1,475 +0,0 @@
/* `a.out' object-file definitions, including extensions to 64-bit fields */
#ifndef __A_OUT_64_H__
#define __A_OUT_64_H__
/* This is the layout on disk of the 32-bit or 64-bit exec header. */
#ifndef external_exec
struct external_exec
{
bfd_byte e_info[4]; /* magic number and stuff */
bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */
bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */
bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */
bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */
bfd_byte e_entry[BYTES_IN_WORD]; /* start address */
bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */
bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */
};
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
/* Magic numbers for a.out files */
#if ARCH_SIZE==64
#define OMAGIC 0x1001 /* Code indicating object file */
#define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */
#define NMAGIC 0x1003 /* Code indicating pure executable. */
/* There is no 64-bit QMAGIC as far as I know. */
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
#else
#define OMAGIC 0407 /* ...object file or impure executable. */
#define NMAGIC 0410 /* Code indicating pure executable. */
#define ZMAGIC 0413 /* Code indicating demand-paged executable. */
#define BMAGIC 0415 /* Used by a b.out object. */
/* This indicates a demand-paged executable with the header in the text.
It is used by 386BSD (and variants) and Linux, at least. */
#ifndef QMAGIC
#define QMAGIC 0314
#endif
# ifndef N_BADMAG
# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC \
&& N_MAGIC(x) != QMAGIC)
# endif /* N_BADMAG */
#endif
#endif
#ifdef QMAGIC
#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC)
#else
#define N_IS_QMAGIC(x) (0)
#endif
/* The difference between TARGET_PAGE_SIZE and N_SEGSIZE is that TARGET_PAGE_SIZE is
the finest granularity at which you can page something, thus it
controls the padding (if any) before the text segment of a ZMAGIC
file. N_SEGSIZE is the resolution at which things can be marked as
read-only versus read/write, so it controls the padding between the
text segment and the data segment (in memory; on disk the padding
between them is TARGET_PAGE_SIZE). TARGET_PAGE_SIZE and N_SEGSIZE are the same
for most machines, but different for sun3. */
/* By default, segment size is constant. But some machines override this
to be a function of the a.out header (e.g. machine type). */
#ifndef N_SEGSIZE
#define N_SEGSIZE(x) SEGMENT_SIZE
#endif
/* Virtual memory address of the text section.
This is getting very complicated. A good reason to discard a.out format
for something that specifies these fields explicitly. But til then...
* OMAGIC and NMAGIC files:
(object files: text for "relocatable addr 0" right after the header)
start at 0, offset is EXEC_BYTES_SIZE, size as stated.
* The text address, offset, and size of ZMAGIC files depend
on the entry point of the file:
* entry point below TEXT_START_ADDR:
(hack for SunOS shared libraries)
start at 0, offset is 0, size as stated.
* If N_HEADER_IN_TEXT(x) is true (which defaults to being the
case when the entry point is EXEC_BYTES_SIZE or further into a page):
no padding is needed; text can start after exec header. Sun
considers the text segment of such files to include the exec header;
for BFD's purposes, we don't, which makes more work for us.
start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,
size as stated minus EXEC_BYTES_SIZE.
* If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when
the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page
aligned)): (padding is needed so that text can start at a page boundary)
start at TEXT_START_ADDR, offset TARGET_PAGE_SIZE, size as stated.
Specific configurations may want to hardwire N_HEADER_IN_TEXT,
for efficiency or to allow people to play games with the entry point.
In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,
and as 0 for most other hosts (Sony News, Vax Ultrix, etc).
(Do this in the appropriate bfd target file.)
(The default is a heuristic that will break if people try changing
the entry point, perhaps with the ld -e flag.)
* QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
and for which the starting address is TARGET_PAGE_SIZE (or should this be
SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).
*/
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
in the text. */
#ifndef N_HEADER_IN_TEXT
#define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
#endif
/* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC
files. */
#ifndef N_SHARED_LIB
#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR)
#endif
/* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on
the assumption that we are dealing with a .o file, not an
executable. This is necessary for OMAGIC (but means we don't work
right on the output from ld -N); more questionable for NMAGIC. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) \
(/* The address of a QMAGIC file is always one page in, */ \
/* with the header in the text. */ \
N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \
N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\
N_SHARED_LIB(x) ? 0 : \
N_HEADER_IN_TEXT(x) ? \
TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
TEXT_START_ADDR /* a page of padding */\
)
#endif
/* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding
to make the text segment start at a certain boundary. For most
systems, this boundary is TARGET_PAGE_SIZE. But for Linux, in the
time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is
not what TARGET_PAGE_SIZE needs to be for QMAGIC. */
#ifndef ZMAGIC_DISK_BLOCK_SIZE
#define ZMAGIC_DISK_BLOCK_SIZE TARGET_PAGE_SIZE
#endif
#define N_DISK_BLOCK_SIZE(x) \
(N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : TARGET_PAGE_SIZE)
/* Offset in an a.out of the start of the text section. */
#ifndef N_TXTOFF
#define N_TXTOFF(x) \
(/* For {O,N,Q}MAGIC, no padding. */ \
N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \
N_SHARED_LIB(x) ? 0 : \
N_HEADER_IN_TEXT(x) ? \
EXEC_BYTES_SIZE : /* no padding */\
ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\
)
#endif
/* Size of the text section. It's always as stated, except that we
offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
for ZMAGIC files that nominally include the exec header
as part of the first page of text. (BFD doesn't consider the
exec header to be part of the text segment.) */
#ifndef N_TXTSIZE
#define N_TXTSIZE(x) \
(/* For QMAGIC, we don't consider the header part of the text section. */\
N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \
(N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \
N_HEADER_IN_TEXT(x) ? \
(x).a_text - EXEC_BYTES_SIZE: /* no padding */\
(x).a_text /* a page of padding */\
)
#endif
/* The address of the data segment in virtual memory.
It is the text segment address, plus text segment size, rounded
up to a N_SEGSIZE boundary for pure or pageable files. */
#ifndef N_DATADDR
#define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
#endif
/* The address of the BSS segment -- immediately after the data segment. */
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
/* Offsets of the various portions of the file after the text segment. */
/* For {Q,Z}MAGIC, there is padding to make the data segment start on
a page boundary. Most of the time the a_text field (and thus
N_TXTSIZE) already contains this padding. It is possible that for
BSDI and/or 386BSD it sometimes doesn't contain the padding, and
perhaps we should be adding it here. But this seems kind of
questionable and probably should be BSDI/386BSD-specific if we do
do it.
For NMAGIC (at least for hp300 BSD, probably others), there is
padding in memory only, not on disk, so we must *not* ever pad here
for NMAGIC. */
#ifndef N_DATOFF
#define N_DATOFF(x) \
(N_TXTOFF(x) + N_TXTSIZE(x))
#endif
#ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#endif
#ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#endif
#ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#endif
#ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
#endif
/* Symbols */
#ifndef external_nlist
struct external_nlist {
bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */
bfd_byte e_type[1]; /* type of symbol */
bfd_byte e_other[1]; /* misc info (usually empty) */
bfd_byte e_desc[2]; /* description field */
bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */
};
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
#endif
struct internal_nlist {
unsigned long n_strx; /* index into string table of name */
unsigned char n_type; /* type of symbol */
unsigned char n_other; /* misc info (usually empty) */
unsigned short n_desc; /* description field */
bfd_vma n_value; /* value of symbol */
};
/* The n_type field is the symbol type, containing: */
#define N_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol -- defined at particular addr */
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */
#define N_DATA 6 /* Data sym -- defined at offset in data seg */
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */
#define N_FN 0x1f /* File name of .o file */
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
N_DATA, or N_BSS. When the low-order bit of other types is set,
(e.g. N_WARNING versus N_FN), they are two different types. */
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */
#define N_TYPE 0x1e
#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */
#define N_INDR 0x0a
/* The following symbols refer to set elements.
All the N_SET[ATDB] symbols with the same name form one set.
Space is allocated for the set in the text section, and each set
elements value is stored into one word of the space.
The first word of the space is the length of the set (number of elements).
The address of the set is made into an N_SETV symbol
whose name is the same as the name of the set.
This symbol acts like a N_DATA global symbol
in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
/* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
/* Warning symbol. The text gives a warning message, the next symbol
in the table will be undefined. When the symbol is referenced, the
message is printed. */
#define N_WARNING 0x1e
/* Weak symbols. These are a GNU extension to the a.out format. The
semantics are those of ELF weak symbols. Weak symbols are always
externally visible. The N_WEAK? values are squeezed into the
available slots. The value of a N_WEAKU symbol is 0. The values
of the other types are the definitions. */
#define N_WEAKU 0x0d /* Weak undefined symbol. */
#define N_WEAKA 0x0e /* Weak absolute symbol. */
#define N_WEAKT 0x0f /* Weak text symbol. */
#define N_WEAKD 0x10 /* Weak data symbol. */
#define N_WEAKB 0x11 /* Weak bss symbol. */
/* Relocations
There are two types of relocation flavours for a.out systems,
standard and extended. The standard form is used on systems where the
instruction has room for all the bits of an offset to the operand, whilst
the extended form is used when an address operand has to be split over n
instructions. Eg, on the 68k, each move instruction can reference
the target with a displacement of 16 or 32 bits. On the sparc, move
instructions use an offset of 14 bits, so the offset is stored in
the reloc field, and the data in the section is ignored.
*/
/* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures,
all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */
struct reloc_std_external {
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
bfd_byte r_index[3]; /* symbol table index of symbol */
bfd_byte r_type[1]; /* relocation type */
};
#define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80)
#define RELOC_STD_BITS_PCREL_LITTLE ((unsigned int) 0x01)
#define RELOC_STD_BITS_LENGTH_BIG ((unsigned int) 0x60)
#define RELOC_STD_BITS_LENGTH_SH_BIG 5
#define RELOC_STD_BITS_LENGTH_LITTLE ((unsigned int) 0x06)
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
#define RELOC_STD_BITS_EXTERN_BIG ((unsigned int) 0x10)
#define RELOC_STD_BITS_EXTERN_LITTLE ((unsigned int) 0x08)
#define RELOC_STD_BITS_BASEREL_BIG ((unsigned int) 0x08)
#define RELOC_STD_BITS_BASEREL_LITTLE ((unsigned int) 0x10)
#define RELOC_STD_BITS_JMPTABLE_BIG ((unsigned int) 0x04)
#define RELOC_STD_BITS_JMPTABLE_LITTLE ((unsigned int) 0x20)
#define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02)
#define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40)
#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */
struct reloc_std_internal
{
bfd_vma r_address; /* Address (within segment) to be relocated. */
/* The meaning of r_symbolnum depends on r_extern. */
unsigned int r_symbolnum:24;
/* Nonzero means value is a pc-relative offset
and it should be relocated for changes in its own address
as well as for changes in the symbol or section specified. */
unsigned int r_pcrel:1;
/* Length (as exponent of 2) of the field to be relocated.
Thus, a value of 2 indicates 1<<2 bytes. */
unsigned int r_length:2;
/* 1 => relocate with value of symbol.
r_symbolnum is the index of the symbol
in files the symbol table.
0 => relocate with the address of a segment.
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
(the N_EXT bit may be set also, but signifies nothing). */
unsigned int r_extern:1;
/* The next three bits are for SunOS shared libraries, and seem to
be undocumented. */
unsigned int r_baserel:1; /* Linkage table relative */
unsigned int r_jmptable:1; /* pc-relative to jump table */
unsigned int r_relative:1; /* "relative relocation" */
/* unused */
unsigned int r_pad:1; /* Padding -- set to zero */
};
/* EXTENDED RELOCS */
struct reloc_ext_external {
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
bfd_byte r_index[3]; /* symbol table index of symbol */
bfd_byte r_type[1]; /* relocation type */
bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */
};
#define RELOC_EXT_BITS_EXTERN_BIG ((unsigned int) 0x80)
#define RELOC_EXT_BITS_EXTERN_LITTLE ((unsigned int) 0x01)
#define RELOC_EXT_BITS_TYPE_BIG ((unsigned int) 0x1F)
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
#define RELOC_EXT_BITS_TYPE_LITTLE ((unsigned int) 0xF8)
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
/* Bytes per relocation entry */
#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
enum reloc_type
{
/* simple relocations */
RELOC_8, /* data[0:7] = addend + sv */
RELOC_16, /* data[0:15] = addend + sv */
RELOC_32, /* data[0:31] = addend + sv */
/* pc-rel displacement */
RELOC_DISP8, /* data[0:7] = addend - pc + sv */
RELOC_DISP16, /* data[0:15] = addend - pc + sv */
RELOC_DISP32, /* data[0:31] = addend - pc + sv */
/* Special */
RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */
RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */
RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */
RELOC_22, /* data[0:21] = (addend + sv) */
RELOC_13, /* data[0:12] = (addend + sv) */
RELOC_LO10, /* data[0:9] = (addend + sv) */
RELOC_SFA_BASE,
RELOC_SFA_OFF13,
/* P.I.C. (base-relative) */
RELOC_BASE10, /* Not sure - maybe we can do this the */
RELOC_BASE13, /* right way now */
RELOC_BASE22,
/* for some sort of pc-rel P.I.C. (?) */
RELOC_PC10,
RELOC_PC22,
/* P.I.C. jump table */
RELOC_JMP_TBL,
/* reputedly for shared libraries somehow */
RELOC_SEGOFF16,
RELOC_GLOB_DAT,
RELOC_JMP_SLOT,
RELOC_RELATIVE,
RELOC_11,
RELOC_WDISP2_14,
RELOC_WDISP19,
RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */
RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */
/* 29K relocation types */
RELOC_JUMPTARG,
RELOC_CONST,
RELOC_CONSTH,
/* All the new ones I can think of, for sparc v9 */
RELOC_64, /* data[0:63] = addend + sv */
RELOC_DISP64, /* data[0:63] = addend - pc + sv */
RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */
RELOC_DISP21, /* data[0:20] = addend - pc + sv */
RELOC_DISP14, /* data[0:13] = addend - pc + sv */
/* Q .
What are the other ones,
Since this is a clean slate, can we throw away the ones we dont
understand ? Should we sort the values ? What about using a
microcode format like the 68k ?
*/
NO_RELOC
};
struct reloc_internal {
bfd_vma r_address; /* offset of of data to relocate */
long r_index; /* symbol table index of symbol */
enum reloc_type r_type; /* relocation type */
bfd_vma r_addend; /* datum addend */
};
/* Q.
Should the length of the string table be 4 bytes or 8 bytes ?
Q.
What about archive indexes ?
*/
#endif /* __A_OUT_64_H__ */

View File

@ -1,264 +0,0 @@
/* Table of DBX symbol codes for the GNU system.
Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
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. */
/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files
overlaps the N_UNDF used for ordinary symbols. In ELF files, the
debug information is in a different file section, so there is no conflict.
This symbol's n_value gives the size of the string section associated
with this file. The symbol's n_strx (relative to the just-updated
string section start address) gives the name of the source file,
e.g. "foo.c", without any path information. The symbol's n_desc gives
the count of upcoming symbols associated with this file (not including
this one). */
/* __define_stab (N_UNDF, 0x00, "UNDF") */
/* Global variable. Only the name is significant.
To find the address, look in the corresponding external symbol. */
__define_stab (N_GSYM, 0x20, "GSYM")
/* Function name for BSD Fortran. Only the name is significant.
To find the address, look in the corresponding external symbol. */
__define_stab (N_FNAME, 0x22, "FNAME")
/* Function name or text-segment variable for C. Value is its address.
Desc is supposedly starting line number, but GCC doesn't set it
and DBX seems not to miss it. */
__define_stab (N_FUN, 0x24, "FUN")
/* Data-segment variable with internal linkage. Value is its address.
"Static Sym". */
__define_stab (N_STSYM, 0x26, "STSYM")
/* BSS-segment variable with internal linkage. Value is its address. */
__define_stab (N_LCSYM, 0x28, "LCSYM")
/* Name of main routine. Only the name is significant. */
__define_stab (N_MAIN, 0x2a, "MAIN")
/* Solaris2: Read-only data symbols. */
__define_stab (N_ROSYM, 0x2c, "ROSYM")
/* Global symbol in Pascal.
Supposedly the value is its line number; I'm skeptical. */
__define_stab (N_PC, 0x30, "PC")
/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */
__define_stab (N_NSYMS, 0x32, "NSYMS")
/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
__define_stab (N_NOMAP, 0x34, "NOMAP")
/* New stab from Solaris 2. Like N_SO, but for the object file. Two in
a row provide the build directory and the relative path of the .o from it.
Solaris2 uses this to avoid putting the stabs info into the linked
executable; this stab goes into the ".stab.index" section, and the debugger
reads the real stabs directly from the .o files instead. */
__define_stab (N_OBJ, 0x38, "OBJ")
/* New stab from Solaris 2. Options for the debugger, related to the
source language for this module. E.g. whether to use ANSI
integral promotions or traditional integral promotions. */
__define_stab (N_OPT, 0x3c, "OPT")
/* Register variable. Value is number of register. */
__define_stab (N_RSYM, 0x40, "RSYM")
/* Modula-2 compilation unit. Can someone say what info it contains? */
__define_stab (N_M2C, 0x42, "M2C")
/* Line number in text segment. Desc is the line number;
value is corresponding address. On Solaris2, the line number is
relative to the start of the current function. */
__define_stab (N_SLINE, 0x44, "SLINE")
/* Similar, for data segment. */
__define_stab (N_DSLINE, 0x46, "DSLINE")
/* Similar, for bss segment. */
__define_stab (N_BSLINE, 0x48, "BSLINE")
/* Sun's source-code browser stabs. ?? Don't know what the fields are.
Supposedly the field is "path to associated .cb file". THIS VALUE
OVERLAPS WITH N_BSLINE! */
__define_stab_duplicate (N_BROWS, 0x48, "BROWS")
/* GNU Modula-2 definition module dependency. Value is the modification time
of the definition file. Other is non-zero if it is imported with the
GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there
are enough empty fields? */
__define_stab(N_DEFD, 0x4a, "DEFD")
/* New in Solaris2. Function start/body/end line numbers. */
__define_stab(N_FLINE, 0x4C, "FLINE")
/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2
and one is for C++. Still,... */
/* GNU C++ exception variable. Name is variable name. */
__define_stab (N_EHDECL, 0x50, "EHDECL")
/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */
__define_stab_duplicate (N_MOD2, 0x50, "MOD2")
/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if
this entry is immediately followed by a CAUGHT stab saying what exception
was caught. Multiple CAUGHT stabs means that multiple exceptions
can be caught here. If Desc is 0, it means all exceptions are caught
here. */
__define_stab (N_CATCH, 0x54, "CATCH")
/* Structure or union element. Value is offset in the structure. */
__define_stab (N_SSYM, 0x60, "SSYM")
/* Solaris2: Last stab emitted for module. */
__define_stab (N_ENDM, 0x62, "ENDM")
/* Name of main source file.
Value is starting text address of the compilation.
If multiple N_SO's appear, the first to contain a trailing / is the
compilation directory. The first to not contain a trailing / is the
source file name, relative to the compilation directory. Others (perhaps
resulting from cfront) are ignored.
On Solaris2, value is undefined, but desc is a source-language code. */
__define_stab (N_SO, 0x64, "SO")
/* Automatic variable in the stack. Value is offset from frame pointer.
Also used for type descriptions. */
__define_stab (N_LSYM, 0x80, "LSYM")
/* Beginning of an include file. Only Sun uses this.
In an object file, only the name is significant.
The Sun linker puts data into some of the other fields. */
__define_stab (N_BINCL, 0x82, "BINCL")
/* Name of sub-source file (#include file).
Value is starting text address of the compilation. */
__define_stab (N_SOL, 0x84, "SOL")
/* Parameter variable. Value is offset from argument pointer.
(On most machines the argument pointer is the same as the frame pointer. */
__define_stab (N_PSYM, 0xa0, "PSYM")
/* End of an include file. No name.
This and N_BINCL act as brackets around the file's output.
In an object file, there is no significant data in this entry.
The Sun linker puts data into some of the fields. */
__define_stab (N_EINCL, 0xa2, "EINCL")
/* Alternate entry point. Value is its address. */
__define_stab (N_ENTRY, 0xa4, "ENTRY")
/* Beginning of lexical block.
The desc is the nesting level in lexical blocks.
The value is the address of the start of the text for the block.
The variables declared inside the block *precede* the N_LBRAC symbol.
On Solaris2, the value is relative to the start of the current function. */
__define_stab (N_LBRAC, 0xc0, "LBRAC")
/* Place holder for deleted include file. Replaces a N_BINCL and everything
up to the corresponding N_EINCL. The Sun linker generates these when
it finds multiple identical copies of the symbols from an include file.
This appears only in output from the Sun linker. */
__define_stab (N_EXCL, 0xc2, "EXCL")
/* Modula-2 scope information. Can someone say what info it contains? */
__define_stab (N_SCOPE, 0xc4, "SCOPE")
/* End of a lexical block. Desc matches the N_LBRAC's desc.
The value is the address of the end of the text for the block.
On Solaris2, the value is relative to the start of the current function. */
__define_stab (N_RBRAC, 0xe0, "RBRAC")
/* Begin named common block. Only the name is significant. */
__define_stab (N_BCOMM, 0xe2, "BCOMM")
/* End named common block. Only the name is significant
(and it should match the N_BCOMM). */
__define_stab (N_ECOMM, 0xe4, "ECOMM")
/* Member of a common block; value is offset within the common block.
This should occur within a BCOMM/ECOMM pair. */
__define_stab (N_ECOML, 0xe8, "ECOML")
/* Solaris2: Pascal "with" statement: type,,0,0,offset */
__define_stab (N_WITH, 0xea, "WITH")
/* These STAB's are used on Gould systems for Non-Base register symbols
or something like that. FIXME. I have assigned the values at random
since I don't have a Gould here. Fixups from Gould folk welcome... */
__define_stab (N_NBTEXT, 0xF0, "NBTEXT")
__define_stab (N_NBDATA, 0xF2, "NBDATA")
__define_stab (N_NBBSS, 0xF4, "NBBSS")
__define_stab (N_NBSTS, 0xF6, "NBSTS")
__define_stab (N_NBLCS, 0xF8, "NBLCS")
/* Second symbol entry containing a length-value for the preceding entry.
The value is the length. */
__define_stab (N_LENG, 0xfe, "LENG")
/* The above information, in matrix format.
STAB MATRIX
_________________________________________________
| 00 - 1F are not dbx stab symbols |
| In most cases, the low bit is the EXTernal bit|
| 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
| 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
| 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA |
| 09 |EXT | 0B | 0D WEAKU | 0F WEAKT |
| 10 WEAKD | 12 COMM | 14 SETA | 16 SETT |
| 11 WEAKB | 13 | 15 | 17 |
| 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
| 19 | 1B | 1D | 1F FN |
|_______________________________________________|
| Debug entries with bit 01 set are unused. |
| 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
| 28 LCSYM | 2A MAIN | 2C ROSYM | 2E |
| 30 PC | 32 NSYMS | 34 NOMAP | 36 |
| 38 OBJ | 3A | 3C OPT | 3E |
| 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
| 48 BSLINE*| 4A DEFD | 4C FLINE | 4E |
| 50 EHDECL*| 52 | 54 CATCH | 56 |
| 58 | 5A | 5C | 5E |
| 60 SSYM | 62 ENDM | 64 SO | 66 |
| 68 | 6A | 6C | 6E |
| 70 | 72 | 74 | 76 |
| 78 | 7A | 7C | 7E |
| 80 LSYM | 82 BINCL | 84 SOL | 86 |
| 88 | 8A | 8C | 8E |
| 90 | 92 | 94 | 96 |
| 98 | 9A | 9C | 9E |
| A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
| A8 | AA | AC | AE |
| B0 | B2 | B4 | B6 |
| B8 | BA | BC | BE |
| C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
| C8 | CA | CC | CE |
| D0 | D2 | D4 | D6 |
| D8 | DA | DC | DE |
| E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
| E8 ECOML | EA WITH | EC | EE |
| F0 | F2 | F4 | F6 |
| F8 | FA | FC | FE LENG |
+-----------------------------------------------+
* 50 EHDECL is also MOD2.
* 48 BSLINE is also BROWS.
*/

View File

@ -1,37 +0,0 @@
#ifndef __GNU_STAB__
/* Indicate the GNU stab.h is in use. */
#define __GNU_STAB__
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE,
enum __stab_debug_code
{
#include "aout/stab.def"
LAST_UNUSED_STAB_CODE
};
#undef __define_stab
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
#define N_SO_AS 1
#define N_SO_C 2
#define N_SO_ANSI_C 3
#define N_SO_CC 4 /* C++ */
#define N_SO_FORTRAN 5
#define N_SO_PASCAL 6
/* Solaris2: Floating point type values in basic types. */
#define NF_NONE 0
#define NF_SINGLE 1 /* IEEE 32-bit */
#define NF_DOUBLE 2 /* IEEE 64-bit */
#define NF_COMPLEX 3 /* Fortran complex */
#define NF_COMPLEX16 4 /* Fortran double complex */
#define NF_COMPLEX32 5 /* Fortran complex*16 */
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
#endif /* __GNU_STAB_ */

View File

@ -1,238 +0,0 @@
/* bucomm.c -- Bin Utils COMmon code.
Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
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. */
/* We might put this in a library someday so it could be dynamically
loaded, but for now it's not necessary. */
#include <bfd.h>
#include <libiberty.h>
#include "bucomm.h"
#include <sys/stat.h>
#include <time.h> /* ctime, maybe time_t */
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* Error reporting */
char *program_name;
void
bfd_nonfatal (string)
CONST char *string;
{
CONST char *errmsg = bfd_errmsg (bfd_get_error ());
if (string)
fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
else
fprintf (stderr, "%s: %s\n", program_name, errmsg);
}
void
bfd_fatal (string)
CONST char *string;
{
bfd_nonfatal (string);
xexit (1);
}
#ifdef ANSI_PROTOTYPES
void
fatal (const char *format, ...)
{
va_list args;
fprintf (stderr, "%s: ", program_name);
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
putc ('\n', stderr);
xexit (1);
}
#else
void
fatal (va_alist)
va_dcl
{
char *Format;
va_list args;
fprintf (stderr, "%s: ", program_name);
va_start (args);
Format = va_arg (args, char *);
vfprintf (stderr, Format, args);
va_end (args);
putc ('\n', stderr);
xexit (1);
}
#endif
/* Set the default BFD target based on the configured target. Doing
this permits the binutils to be configured for a particular target,
and linked against a shared BFD library which was configured for a
different target. */
#define TARGET "elf32-i386" /* FIXME: hard-coded! */
void
set_default_bfd_target ()
{
/* The macro TARGET is defined by Makefile. */
const char *target = TARGET;
if (! bfd_set_default_target (target))
{
char *errmsg;
errmsg = (char *) xmalloc (100 + strlen (target));
sprintf (errmsg, "can't set BFD default target to `%s'", target);
bfd_fatal (errmsg);
}
}
/* After a false return from bfd_check_format_matches with
bfd_get_error () == bfd_error_file_ambiguously_recognized, print
the possible matching targets. */
void
list_matching_formats (p)
char **p;
{
fprintf(stderr, "%s: Matching formats:", program_name);
while (*p)
fprintf(stderr, " %s", *p++);
fprintf(stderr, "\n");
}
/* List the supported targets. */
void
list_supported_targets (name, f)
const char *name;
FILE *f;
{
extern bfd_target *bfd_target_vector[];
int t;
if (name == NULL)
fprintf (f, "Supported targets:");
else
fprintf (f, "%s: supported targets:", name);
for (t = 0; bfd_target_vector[t] != NULL; t++)
fprintf (f, " %s", bfd_target_vector[t]->name);
fprintf (f, "\n");
}
/* Display the archive header for an element as if it were an ls -l listing:
Mode User\tGroup\tSize\tDate Name */
void
print_arelt_descr (file, abfd, verbose)
FILE *file;
bfd *abfd;
boolean verbose;
{
struct stat buf;
if (verbose)
{
if (bfd_stat_arch_elt (abfd, &buf) == 0)
{
char modebuf[11];
char timebuf[40];
time_t when = buf.st_mtime;
CONST char *ctime_result = (CONST char *) ctime (&when);
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
/* POSIX 1003.2/D11 says to skip first character (entry type). */
fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
(long) buf.st_uid, (long) buf.st_gid,
(long) buf.st_size, timebuf);
}
}
fprintf (file, "%s\n", bfd_get_filename (abfd));
}
/* Return the name of a temporary file in the same directory as FILENAME. */
char *
make_tempname (filename)
char *filename;
{
static char template[] = "stXXXXXX";
char *tmpname;
char *slash = strrchr (filename, '/');
#if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32)
if (slash == NULL)
slash = strrchr (filename, '\\');
#endif
if (slash != (char *) NULL)
{
char c;
c = *slash;
*slash = 0;
tmpname = xmalloc (strlen (filename) + sizeof (template) + 1);
strcpy (tmpname, filename);
strcat (tmpname, "/");
strcat (tmpname, template);
mkstemp (tmpname);
*slash = c;
}
else
{
tmpname = xmalloc (sizeof (template));
strcpy (tmpname, template);
mkstemp (tmpname);
}
return tmpname;
}
/* Parse a string into a VMA, with a fatal error if it can't be
parsed. */
bfd_vma
parse_vma (s, arg)
const char *s;
const char *arg;
{
bfd_vma ret;
const char *end;
ret = bfd_scan_vma (s, &end, 0);
if (*end != '\0')
{
fprintf (stderr, "%s: %s: bad number: %s\n", program_name, arg, s);
exit (1);
}
return ret;
}

View File

@ -1,91 +0,0 @@
/* bucomm.h -- binutils common include file.
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
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 _BUCOMM_H
#define _BUCOMM_H
#include "ansidecl.h"
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#ifdef __GNUC__
# undef alloca
# define alloca __builtin_alloca
#else
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
# if !defined (__STDC__) && !defined (__hpux)
char *alloca ();
# else
void *alloca ();
# endif /* __STDC__, __hpux */
# endif /* alloca */
# endif /* HAVE_ALLOCA_H */
#endif
#ifndef BFD_TRUE_FALSE
#define boolean bfd_boolean
#define true TRUE
#define false FALSE
#endif
/* bucomm.c */
void bfd_nonfatal PARAMS ((CONST char *));
void bfd_fatal PARAMS ((CONST char *));
void fatal PARAMS ((CONST char *, ...));
void set_default_bfd_target PARAMS ((void));
void list_matching_formats PARAMS ((char **p));
void list_supported_targets PARAMS ((const char *, FILE *));
void print_arelt_descr PARAMS ((FILE *file, bfd *abfd, boolean verbose));
char *make_tempname PARAMS ((char *));
bfd_vma parse_vma PARAMS ((const char *, const char *));
extern char *program_name;
/* filemode.c */
void mode_string PARAMS ((unsigned long mode, char *buf));
/* version.c */
extern void print_version PARAMS ((const char *));
/* libiberty */
PTR xmalloc PARAMS ((size_t));
PTR xrealloc PARAMS ((PTR, size_t));
#endif /* _BUCOMM_H */

View File

@ -1,64 +0,0 @@
/* budbg.c -- Interfaces to the generic debugging information routines.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
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 BUDBG_H
#define BUDBG_H
#include <stdio.h>
#ifndef BFD_TRUE_FALSE
#define boolean bfd_boolean
#define true TRUE
#define false FALSE
#endif
/* Routine used to read generic debugging information. */
extern PTR read_debugging_info PARAMS ((bfd *, asymbol **, long));
/* Routine used to print generic debugging information. */
extern boolean print_debugging_info PARAMS ((FILE *, PTR));
/* Routines used to read and write stabs information. */
extern PTR start_stab PARAMS ((PTR, bfd *, boolean, asymbol **, long));
extern boolean finish_stab PARAMS ((PTR, PTR));
extern boolean parse_stab PARAMS ((PTR, PTR, int, int, bfd_vma, const char *));
extern boolean write_stabs_in_sections_debugging_info
PARAMS ((bfd *, PTR, bfd_byte **, bfd_size_type *, bfd_byte **,
bfd_size_type *));
/* Routines used to read and write IEEE debugging information. */
extern boolean parse_ieee
PARAMS ((PTR, bfd *, const bfd_byte *, bfd_size_type));
extern boolean write_ieee_debugging_info PARAMS ((bfd *, PTR));
/* Routine used to read COFF debugging information. */
extern boolean parse_coff PARAMS ((bfd *, asymbol **, long, PTR));
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,798 +0,0 @@
/* debug.h -- Describe generic debugging information.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
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 DEBUG_H
#define DEBUG_H
/* This header file describes a generic debugging information format.
We may eventually have readers which convert different formats into
this generic format, and writers which write it out. The initial
impetus for this was writing a convertor from stabs to HP IEEE-695
debugging format. */
/* Different kinds of types. */
enum debug_type_kind
{
/* Not used. */
DEBUG_KIND_ILLEGAL,
/* Indirect via a pointer. */
DEBUG_KIND_INDIRECT,
/* Void. */
DEBUG_KIND_VOID,
/* Integer. */
DEBUG_KIND_INT,
/* Floating point. */
DEBUG_KIND_FLOAT,
/* Complex. */
DEBUG_KIND_COMPLEX,
/* Boolean. */
DEBUG_KIND_BOOL,
/* Struct. */
DEBUG_KIND_STRUCT,
/* Union. */
DEBUG_KIND_UNION,
/* Class. */
DEBUG_KIND_CLASS,
/* Union class (can this really happen?). */
DEBUG_KIND_UNION_CLASS,
/* Enumeration type. */
DEBUG_KIND_ENUM,
/* Pointer. */
DEBUG_KIND_POINTER,
/* Function. */
DEBUG_KIND_FUNCTION,
/* Reference. */
DEBUG_KIND_REFERENCE,
/* Range. */
DEBUG_KIND_RANGE,
/* Array. */
DEBUG_KIND_ARRAY,
/* Set. */
DEBUG_KIND_SET,
/* Based pointer. */
DEBUG_KIND_OFFSET,
/* Method. */
DEBUG_KIND_METHOD,
/* Const qualified type. */
DEBUG_KIND_CONST,
/* Volatile qualified type. */
DEBUG_KIND_VOLATILE,
/* Named type. */
DEBUG_KIND_NAMED,
/* Tagged type. */
DEBUG_KIND_TAGGED
};
/* Different kinds of variables. */
enum debug_var_kind
{
/* Not used. */
DEBUG_VAR_ILLEGAL,
/* A global variable. */
DEBUG_GLOBAL,
/* A static variable. */
DEBUG_STATIC,
/* A local static variable. */
DEBUG_LOCAL_STATIC,
/* A local variable. */
DEBUG_LOCAL,
/* A register variable. */
DEBUG_REGISTER
};
/* Different kinds of function parameters. */
enum debug_parm_kind
{
/* Not used. */
DEBUG_PARM_ILLEGAL,
/* A stack based parameter. */
DEBUG_PARM_STACK,
/* A register parameter. */
DEBUG_PARM_REG,
/* A stack based reference parameter. */
DEBUG_PARM_REFERENCE,
/* A register reference parameter. */
DEBUG_PARM_REF_REG
};
/* Different kinds of visibility. */
enum debug_visibility
{
/* A public field (e.g., a field in a C struct). */
DEBUG_VISIBILITY_PUBLIC,
/* A protected field. */
DEBUG_VISIBILITY_PROTECTED,
/* A private field. */
DEBUG_VISIBILITY_PRIVATE,
/* A field which should be ignored. */
DEBUG_VISIBILITY_IGNORE
};
/* A type. */
typedef struct debug_type *debug_type;
#define DEBUG_TYPE_NULL ((debug_type) NULL)
/* A field in a struct or union. */
typedef struct debug_field *debug_field;
#define DEBUG_FIELD_NULL ((debug_field) NULL)
/* A base class for an object. */
typedef struct debug_baseclass *debug_baseclass;
#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL)
/* A method of an object. */
typedef struct debug_method *debug_method;
#define DEBUG_METHOD_NULL ((debug_method) NULL)
/* The arguments to a method function of an object. These indicate
which method to run. */
typedef struct debug_method_variant *debug_method_variant;
#define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL)
/* This structure is passed to debug_write. It holds function
pointers that debug_write will call based on the accumulated
debugging information. */
struct debug_write_fns
{
/* This is called at the start of each new compilation unit with the
name of the main file in the new unit. */
boolean (*start_compilation_unit) PARAMS ((PTR, const char *));
/* This is called at the start of each source file within a
compilation unit, before outputting any global information for
that file. The argument is the name of the file. */
boolean (*start_source) PARAMS ((PTR, const char *));
/* Each writer must keep a stack of types. */
/* Push an empty type onto the type stack. This type can appear if
there is a reference to a type which is never defined. */
boolean (*empty_type) PARAMS ((PTR));
/* Push a void type onto the type stack. */
boolean (*void_type) PARAMS ((PTR));
/* Push an integer type onto the type stack, given the size and
whether it is unsigned. */
boolean (*int_type) PARAMS ((PTR, unsigned int, boolean));
/* Push a floating type onto the type stack, given the size. */
boolean (*float_type) PARAMS ((PTR, unsigned int));
/* Push a complex type onto the type stack, given the size. */
boolean (*complex_type) PARAMS ((PTR, unsigned int));
/* Push a boolean type onto the type stack, given the size. */
boolean (*bool_type) PARAMS ((PTR, unsigned int));
/* Push an enum type onto the type stack, given the tag, a NULL
terminated array of names and the associated values. If there is
no tag, the tag argument will be NULL. If this is an undefined
enum, the names and values arguments will be NULL. */
boolean (*enum_type) PARAMS ((PTR, const char *, const char **,
bfd_signed_vma *));
/* Pop the top type on the type stack, and push a pointer to that
type onto the type stack. */
boolean (*pointer_type) PARAMS ((PTR));
/* Push a function type onto the type stack. The second argument
indicates the number of argument types that have been pushed onto
the stack. If the number of argument types is passed as -1, then
the argument types of the function are unknown, and no types have
been pushed onto the stack. The third argument is true if the
function takes a variable number of arguments. The return type
of the function is pushed onto the type stack below the argument
types, if any. */
boolean (*function_type) PARAMS ((PTR, int, boolean));
/* Pop the top type on the type stack, and push a reference to that
type onto the type stack. */
boolean (*reference_type) PARAMS ((PTR));
/* Pop the top type on the type stack, and push a range of that type
with the given lower and upper bounds onto the type stack. */
boolean (*range_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma));
/* Push an array type onto the type stack. The top type on the type
stack is the range, and the next type on the type stack is the
element type. These should be popped before the array type is
pushed. The arguments are the lower bound, the upper bound, and
whether the array is a string. */
boolean (*array_type) PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma,
boolean));
/* Pop the top type on the type stack, and push a set of that type
onto the type stack. The argument indicates whether this set is
a bitstring. */
boolean (*set_type) PARAMS ((PTR, boolean));
/* Push an offset type onto the type stack. The top type on the
type stack is the target type, and the next type on the type
stack is the base type. These should be popped before the offset
type is pushed. */
boolean (*offset_type) PARAMS ((PTR));
/* Push a method type onto the type stack. If the second argument
is true, the top type on the stack is the class to which the
method belongs; otherwise, the class must be determined by the
class to which the method is attached. The third argument is the
number of argument types; these are pushed onto the type stack in
reverse order (the first type popped is the last argument to the
method). A value of -1 for the third argument means that no
argument information is available. The fourth argument is true
if the function takes a variable number of arguments. The next
type on the type stack below the domain and the argument types is
the return type of the method. All these types must be popped,
and then the method type must be pushed. */
boolean (*method_type) PARAMS ((PTR, boolean, int, boolean));
/* Pop the top type off the type stack, and push a const qualified
version of that type onto the type stack. */
boolean (*const_type) PARAMS ((PTR));
/* Pop the top type off the type stack, and push a volatile
qualified version of that type onto the type stack. */
boolean (*volatile_type) PARAMS ((PTR));
/* Start building a struct. This is followed by calls to the
struct_field function, and finished by a call to the
end_struct_type function. The second argument is the tag; this
will be NULL if there isn't one. If the second argument is NULL,
the third argument is a constant identifying this struct for use
with tag_type. The fourth argument is true for a struct, false
for a union. The fifth argument is the size. If this is an
undefined struct or union, the size will be 0 and struct_field
will not be called before end_struct_type is called. */
boolean (*start_struct_type) PARAMS ((PTR, const char *, unsigned int,
boolean, unsigned int));
/* Add a field to the struct type currently being built. The type
of the field should be popped off the type stack. The arguments
are the name, the bit position, the bit size (may be zero if the
field is not packed), and the visibility. */
boolean (*struct_field) PARAMS ((PTR, const char *, bfd_vma, bfd_vma,
enum debug_visibility));
/* Finish building a struct, and push it onto the type stack. */
boolean (*end_struct_type) PARAMS ((PTR));
/* Start building a class. This is followed by calls to several
functions: struct_field, class_static_member, class_baseclass,
class_start_method, class_method_variant,
class_static_method_variant, and class_end_method. The class is
finished by a call to end_class_type. The first five arguments
are the same as for start_struct_type. The sixth argument is
true if there is a virtual function table; if there is, the
seventh argument is true if the virtual function table can be
found in the type itself, and is false if the type of the object
holding the virtual function table should be popped from the type
stack. */
boolean (*start_class_type) PARAMS ((PTR, const char *, unsigned int,
boolean, unsigned int, boolean,
boolean));
/* Add a static member to the class currently being built. The
arguments are the field name, the physical name, and the
visibility. The type must be popped off the type stack. */
boolean (*class_static_member) PARAMS ((PTR, const char *, const char *,
enum debug_visibility));
/* Add a baseclass to the class currently being built. The type of
the baseclass must be popped off the type stack. The arguments
are the bit position, whether the class is virtual, and the
visibility. */
boolean (*class_baseclass) PARAMS ((PTR, bfd_vma, boolean,
enum debug_visibility));
/* Start adding a method to the class currently being built. This
is followed by calls to class_method_variant and
class_static_method_variant to describe different variants of the
method which take different arguments. The method is finished
with a call to class_end_method. The argument is the method
name. */
boolean (*class_start_method) PARAMS ((PTR, const char *));
/* Describe a variant to the class method currently being built.
The type of the variant must be popped off the type stack. The
second argument is the physical name of the function. The
following arguments are the visibility, whether the variant is
const, whether the variant is volatile, the offset in the virtual
function table, and whether the context is on the type stack
(below the variant type). */
boolean (*class_method_variant) PARAMS ((PTR, const char *,
enum debug_visibility,
boolean, boolean,
bfd_vma, boolean));
/* Describe a static variant to the class method currently being
built. The arguments are the same as for class_method_variant,
except that the last two arguments are omitted. The type of the
variant must be popped off the type stack. */
boolean (*class_static_method_variant) PARAMS ((PTR, const char *,
enum debug_visibility,
boolean, boolean));
/* Finish describing a class method. */
boolean (*class_end_method) PARAMS ((PTR));
/* Finish describing a class, and push it onto the type stack. */
boolean (*end_class_type) PARAMS ((PTR));
/* Push a type on the stack which was given a name by an earlier
call to typdef. */
boolean (*typedef_type) PARAMS ((PTR, const char *));
/* Push a tagged type on the stack which was defined earlier. If
the second argument is not NULL, the type was defined by a call
to tag. If the second argument is NULL, the type was defined by
a call to start_struct_type or start_class_type with a tag of
NULL and the number of the third argument. Either way, the
fourth argument is the tag kind. Note that this may be called
for a struct (class) being defined, in between the call to
start_struct_type (start_class_type) and the call to
end_struct_type (end_class_type). */
boolean (*tag_type) PARAMS ((PTR, const char *, unsigned int,
enum debug_type_kind));
/* Pop the type stack, and typedef it to the given name. */
boolean (*typdef) PARAMS ((PTR, const char *));
/* Pop the type stack, and declare it as a tagged struct or union or
enum or whatever. The tag passed down here is redundant, since
was also passed when enum_type, start_struct_type, or
start_class_type was called. */
boolean (*tag) PARAMS ((PTR, const char *));
/* This is called to record a named integer constant. */
boolean (*int_constant) PARAMS ((PTR, const char *, bfd_vma));
/* This is called to record a named floating point constant. */
boolean (*float_constant) PARAMS ((PTR, const char *, double));
/* This is called to record a typed integer constant. The type is
popped off the type stack. */
boolean (*typed_constant) PARAMS ((PTR, const char *, bfd_vma));
/* This is called to record a variable. The type is popped off the
type stack. */
boolean (*variable) PARAMS ((PTR, const char *, enum debug_var_kind,
bfd_vma));
/* Start writing out a function. The return type must be popped off
the stack. The boolean is true if the function is global. This
is followed by calls to function_parameter, followed by block
information. */
boolean (*start_function) PARAMS ((PTR, const char *, boolean));
/* Record a function parameter for the current function. The type
must be popped off the stack. */
boolean (*function_parameter) PARAMS ((PTR, const char *,
enum debug_parm_kind, bfd_vma));
/* Start writing out a block. There is at least one top level block
per function. Blocks may be nested. The argument is the
starting address of the block. */
boolean (*start_block) PARAMS ((PTR, bfd_vma));
/* Finish writing out a block. The argument is the ending address
of the block. */
boolean (*end_block) PARAMS ((PTR, bfd_vma));
/* Finish writing out a function. */
boolean (*end_function) PARAMS ((PTR));
/* Record line number information for the current compilation unit. */
boolean (*lineno) PARAMS ((PTR, const char *, unsigned long, bfd_vma));
};
/* Exported functions. */
/* The first argument to most of these functions is a handle. This
handle is returned by the debug_init function. The purpose of the
handle is to permit the debugging routines to not use static
variables, and hence to be reentrant. This would be useful for a
program which wanted to handle two executables simultaneously. */
/* Return a debugging handle. */
extern PTR debug_init PARAMS ((void));
/* Set the source filename. This implicitly starts a new compilation
unit. */
extern boolean debug_set_filename PARAMS ((PTR, const char *));
/* Change source files to the given file name. This is used for
include files in a single compilation unit. */
extern boolean debug_start_source PARAMS ((PTR, const char *));
/* Record a function definition. This implicitly starts a function
block. The debug_type argument is the type of the return value.
The boolean indicates whether the function is globally visible.
The bfd_vma is the address of the start of the function. Currently
the parameter types are specified by calls to
debug_record_parameter. */
extern boolean debug_record_function
PARAMS ((PTR, const char *, debug_type, boolean, bfd_vma));
/* Record a parameter for the current function. */
extern boolean debug_record_parameter
PARAMS ((PTR, const char *, debug_type, enum debug_parm_kind, bfd_vma));
/* End a function definition. The argument is the address where the
function ends. */
extern boolean debug_end_function PARAMS ((PTR, bfd_vma));
/* Start a block in a function. All local information will be
recorded in this block, until the matching call to debug_end_block.
debug_start_block and debug_end_block may be nested. The argument
is the address at which this block starts. */
extern boolean debug_start_block PARAMS ((PTR, bfd_vma));
/* Finish a block in a function. This matches the call to
debug_start_block. The argument is the address at which this block
ends. */
extern boolean debug_end_block PARAMS ((PTR, bfd_vma));
/* Associate a line number in the current source file with a given
address. */
extern boolean debug_record_line PARAMS ((PTR, unsigned long, bfd_vma));
/* Start a named common block. This is a block of variables that may
move in memory. */
extern boolean debug_start_common_block PARAMS ((PTR, const char *));
/* End a named common block. */
extern boolean debug_end_common_block PARAMS ((PTR, const char *));
/* Record a named integer constant. */
extern boolean debug_record_int_const PARAMS ((PTR, const char *, bfd_vma));
/* Record a named floating point constant. */
extern boolean debug_record_float_const PARAMS ((PTR, const char *, double));
/* Record a typed constant with an integral value. */
extern boolean debug_record_typed_const
PARAMS ((PTR, const char *, debug_type, bfd_vma));
/* Record a label. */
extern boolean debug_record_label
PARAMS ((PTR, const char *, debug_type, bfd_vma));
/* Record a variable. */
extern boolean debug_record_variable
PARAMS ((PTR, const char *, debug_type, enum debug_var_kind, bfd_vma));
/* Make an indirect type. The first argument is a pointer to the
location where the real type will be placed. The second argument
is the type tag, if there is one; this may be NULL; the only
purpose of this argument is so that debug_get_type_name can return
something useful. This function may be used when a type is
referenced before it is defined. */
extern debug_type debug_make_indirect_type
PARAMS ((PTR, debug_type *, const char *));
/* Make a void type. */
extern debug_type debug_make_void_type PARAMS ((PTR));
/* Make an integer type of a given size. The boolean argument is true
if the integer is unsigned. */
extern debug_type debug_make_int_type PARAMS ((PTR, unsigned int, boolean));
/* Make a floating point type of a given size. FIXME: On some
platforms, like an Alpha, you probably need to be able to specify
the format. */
extern debug_type debug_make_float_type PARAMS ((PTR, unsigned int));
/* Make a boolean type of a given size. */
extern debug_type debug_make_bool_type PARAMS ((PTR, unsigned int));
/* Make a complex type of a given size. */
extern debug_type debug_make_complex_type PARAMS ((PTR, unsigned int));
/* Make a structure type. The second argument is true for a struct,
false for a union. The third argument is the size of the struct.
The fourth argument is a NULL terminated array of fields. */
extern debug_type debug_make_struct_type
PARAMS ((PTR, boolean, bfd_vma, debug_field *));
/* Make an object type. The first three arguments after the handle
are the same as for debug_make_struct_type. The next arguments are
a NULL terminated array of base classes, a NULL terminated array of
methods, the type of the object holding the virtual function table
if it is not this object, and a boolean which is true if this
object has its own virtual function table. */
extern debug_type debug_make_object_type
PARAMS ((PTR, boolean, bfd_vma, debug_field *, debug_baseclass *,
debug_method *, debug_type, boolean));
/* Make an enumeration type. The arguments are a null terminated
array of strings, and an array of corresponding values. */
extern debug_type debug_make_enum_type
PARAMS ((PTR, const char **, bfd_signed_vma *));
/* Make a pointer to a given type. */
extern debug_type debug_make_pointer_type
PARAMS ((PTR, debug_type));
/* Make a function type. The second argument is the return type. The
third argument is a NULL terminated array of argument types. The
fourth argument is true if the function takes a variable number of
arguments. If the third argument is NULL, then the argument types
are unknown. */
extern debug_type debug_make_function_type
PARAMS ((PTR, debug_type, debug_type *, boolean));
/* Make a reference to a given type. */
extern debug_type debug_make_reference_type PARAMS ((PTR, debug_type));
/* Make a range of a given type from a lower to an upper bound. */
extern debug_type debug_make_range_type
PARAMS ((PTR, debug_type, bfd_signed_vma, bfd_signed_vma));
/* Make an array type. The second argument is the type of an element
of the array. The third argument is the type of a range of the
array. The fourth and fifth argument are the lower and upper
bounds, respectively (if the bounds are not known, lower should be
0 and upper should be -1). The sixth argument is true if this
array is actually a string, as in C. */
extern debug_type debug_make_array_type
PARAMS ((PTR, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
boolean));
/* Make a set of a given type. For example, a Pascal set type. The
boolean argument is true if this set is actually a bitstring, as in
CHILL. */
extern debug_type debug_make_set_type PARAMS ((PTR, debug_type, boolean));
/* Make a type for a pointer which is relative to an object. The
second argument is the type of the object to which the pointer is
relative. The third argument is the type that the pointer points
to. */
extern debug_type debug_make_offset_type
PARAMS ((PTR, debug_type, debug_type));
/* Make a type for a method function. The second argument is the
return type. The third argument is the domain. The fourth
argument is a NULL terminated array of argument types. The fifth
argument is true if the function takes a variable number of
arguments, in which case the array of argument types indicates the
types of the first arguments. The domain and the argument array
may be NULL, in which case this is a stub method and that
information is not available. Stabs debugging uses this, and gets
the argument types from the mangled name. */
extern debug_type debug_make_method_type
PARAMS ((PTR, debug_type, debug_type, debug_type *, boolean));
/* Make a const qualified version of a given type. */
extern debug_type debug_make_const_type PARAMS ((PTR, debug_type));
/* Make a volatile qualified version of a given type. */
extern debug_type debug_make_volatile_type PARAMS ((PTR, debug_type));
/* Make an undefined tagged type. For example, a struct which has
been mentioned, but not defined. */
extern debug_type debug_make_undefined_tagged_type
PARAMS ((PTR, const char *, enum debug_type_kind));
/* Make a base class for an object. The second argument is the base
class type. The third argument is the bit position of this base
class in the object. The fourth argument is whether this is a
virtual class. The fifth argument is the visibility of the base
class. */
extern debug_baseclass debug_make_baseclass
PARAMS ((PTR, debug_type, bfd_vma, boolean, enum debug_visibility));
/* Make a field for a struct. The second argument is the name. The
third argument is the type of the field. The fourth argument is
the bit position of the field. The fifth argument is the size of
the field (it may be zero). The sixth argument is the visibility
of the field. */
extern debug_field debug_make_field
PARAMS ((PTR, const char *, debug_type, bfd_vma, bfd_vma,
enum debug_visibility));
/* Make a static member of an object. The second argument is the
name. The third argument is the type of the member. The fourth
argument is the physical name of the member (i.e., the name as a
global variable). The fifth argument is the visibility of the
member. */
extern debug_field debug_make_static_member
PARAMS ((PTR, const char *, debug_type, const char *,
enum debug_visibility));
/* Make a method. The second argument is the name, and the third
argument is a NULL terminated array of method variants. Each
method variant is a method with this name but with different
argument types. */
extern debug_method debug_make_method
PARAMS ((PTR, const char *, debug_method_variant *));
/* Make a method variant. The second argument is the physical name of
the function. The third argument is the type of the function,
probably constructed by debug_make_method_type. The fourth
argument is the visibility. The fifth argument is whether this is
a const function. The sixth argument is whether this is a volatile
function. The seventh argument is the index in the virtual
function table, if any. The eighth argument is the virtual
function context. */
extern debug_method_variant debug_make_method_variant
PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean,
boolean, bfd_vma, debug_type));
/* Make a static method argument. The arguments are the same as for
debug_make_method_variant, except that the last two are omitted
since a static method can not also be virtual. */
extern debug_method_variant debug_make_static_method_variant
PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean,
boolean));
/* Name a type. This returns a new type with an attached name. */
extern debug_type debug_name_type PARAMS ((PTR, const char *, debug_type));
/* Give a tag to a type, such as a struct or union. This returns a
new type with an attached tag. */
extern debug_type debug_tag_type PARAMS ((PTR, const char *, debug_type));
/* Record the size of a given type. */
extern boolean debug_record_type_size PARAMS ((PTR, debug_type, unsigned int));
/* Find a named type. */
extern debug_type debug_find_named_type PARAMS ((PTR, const char *));
/* Find a tagged type. */
extern debug_type debug_find_tagged_type
PARAMS ((PTR, const char *, enum debug_type_kind));
/* Get the kind of a type. */
extern enum debug_type_kind debug_get_type_kind PARAMS ((PTR, debug_type));
/* Get the name of a type. */
extern const char *debug_get_type_name PARAMS ((PTR, debug_type));
/* Get the size of a type. */
extern bfd_vma debug_get_type_size PARAMS ((PTR, debug_type));
/* Get the return type of a function or method type. */
extern debug_type debug_get_return_type PARAMS ((PTR, debug_type));
/* Get the NULL terminated array of parameter types for a function or
method type (actually, parameter types are not currently stored for
function types). This may be used to determine whether a method
type is a stub method or not. The last argument points to a
boolean which is set to true if the function takes a variable
number of arguments. */
extern const debug_type *debug_get_parameter_types PARAMS ((PTR,
debug_type,
boolean *));
/* Get the target type of a pointer or reference or const or volatile
type. */
extern debug_type debug_get_target_type PARAMS ((PTR, debug_type));
/* Get the NULL terminated array of fields for a struct, union, or
class. */
extern const debug_field *debug_get_fields PARAMS ((PTR, debug_type));
/* Get the type of a field. */
extern debug_type debug_get_field_type PARAMS ((PTR, debug_field));
/* Get the name of a field. */
extern const char *debug_get_field_name PARAMS ((PTR, debug_field));
/* Get the bit position of a field within the containing structure.
If the field is a static member, this will return (bfd_vma) -1. */
extern bfd_vma debug_get_field_bitpos PARAMS ((PTR, debug_field));
/* Get the bit size of a field. If the field is a static member, this
will return (bfd_vma) -1. */
extern bfd_vma debug_get_field_bitsize PARAMS ((PTR, debug_field));
/* Get the visibility of a field. */
extern enum debug_visibility debug_get_field_visibility
PARAMS ((PTR, debug_field));
/* Get the physical name of a field, if it is a static member. If the
field is not a static member, this will return NULL. */
extern const char *debug_get_field_physname PARAMS ((PTR, debug_field));
/* Write out the recorded debugging information. This takes a set of
function pointers which are called to do the actual writing. The
first PTR is the debugging handle. The second PTR is a handle
which is passed to the functions. */
extern boolean debug_write PARAMS ((PTR, const struct debug_write_fns *, PTR));
#endif /* DEBUG_H */

View File

@ -1,90 +0,0 @@
/* Defs for interface to demanglers.
Copyright 1992, 1995, 1996 Free Software Foundation, Inc.
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, 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. */
#if !defined (DEMANGLE_H)
#define DEMANGLE_H
#ifdef IN_GCC
#include "gansidecl.h"
#define PARAMS(ARGS) PROTO(ARGS)
#else /* ! IN_GCC */
#include <ansidecl.h>
#endif /* IN_GCC */
/* Options passed to cplus_demangle (in 2nd parameter). */
#define DMGL_NO_OPTS 0 /* For readability... */
#define DMGL_PARAMS (1 << 0) /* Include function args */
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */
#define DMGL_AUTO (1 << 8)
#define DMGL_GNU (1 << 9)
#define DMGL_LUCID (1 << 10)
#define DMGL_ARM (1 << 11)
/* If none of these are set, use 'current_demangling_style' as the default. */
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM)
/* Enumeration of possible demangling styles.
Lucid and ARM styles are still kept logically distinct, even though
they now both behave identically. The resulting style is actual the
union of both. I.E. either style recognizes both "__pt__" and "__rf__"
for operator "->", even though the first is lucid style and the second
is ARM style. (FIXME?) */
extern enum demangling_styles
{
unknown_demangling = 0,
auto_demangling = DMGL_AUTO,
gnu_demangling = DMGL_GNU,
lucid_demangling = DMGL_LUCID,
arm_demangling = DMGL_ARM
} current_demangling_style;
/* Define string names for the various demangling styles. */
#define AUTO_DEMANGLING_STYLE_STRING "auto"
#define GNU_DEMANGLING_STYLE_STRING "gnu"
#define LUCID_DEMANGLING_STYLE_STRING "lucid"
#define ARM_DEMANGLING_STYLE_STRING "arm"
/* Some macros to test what demangling style is active. */
#define CURRENT_DEMANGLING_STYLE current_demangling_style
#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)
#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)
#define ARM_DEMANGLING (CURRENT_DEMANGLING_STYLE & DMGL_ARM)
extern char *
cplus_demangle PARAMS ((const char *mangled, int options));
extern int
cplus_demangle_opname PARAMS ((const char *opname, char *result, int options));
extern const char *
cplus_mangle_opname PARAMS ((const char *opname, int options));
/* Note: This sets global state. FIXME if you care about multi-threading. */
extern void
set_cplus_marker_for_demangling PARAMS ((int ch));
#endif /* DEMANGLE_H */

View File

@ -1,266 +0,0 @@
/* filemode.c -- make a string describing file modes
Copyright (C) 1985, 90, 91, 94, 95, 1997 Free Software Foundation, Inc.
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, 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 "bfd.h"
#include "bucomm.h"
static char ftypelet PARAMS ((unsigned long));
static void setst PARAMS ((unsigned long, char *));
/* filemodestring - fill in string STR with an ls-style ASCII
representation of the st_mode field of file stats block STATP.
10 characters are stored in STR; no terminating null is added.
The characters stored in STR are:
0 File type. 'd' for directory, 'c' for character
special, 'b' for block special, 'm' for multiplex,
'l' for symbolic link, 's' for socket, 'p' for fifo,
'-' for any other file type
1 'r' if the owner may read, '-' otherwise.
2 'w' if the owner may write, '-' otherwise.
3 'x' if the owner may execute, 's' if the file is
set-user-id, '-' otherwise.
'S' if the file is set-user-id, but the execute
bit isn't set.
4 'r' if group members may read, '-' otherwise.
5 'w' if group members may write, '-' otherwise.
6 'x' if group members may execute, 's' if the file is
set-group-id, '-' otherwise.
'S' if it is set-group-id but not executable.
7 'r' if any user may read, '-' otherwise.
8 'w' if any user may write, '-' otherwise.
9 'x' if any user may execute, 't' if the file is "sticky"
(will be retained in swap space after execution), '-'
otherwise.
'T' if the file is sticky but not executable. */
#if 0
/* This is not used; only mode_string is used. */
void
filemodestring (statp, str)
struct stat *statp;
char *str;
{
mode_string ((unsigned long) statp->st_mode, str);
}
#endif
/* Get definitions for the file permission bits. */
#ifndef S_IRWXU
#define S_IRWXU 0700
#endif
#ifndef S_IRUSR
#define S_IRUSR 0400
#endif
#ifndef S_IWUSR
#define S_IWUSR 0200
#endif
#ifndef S_IXUSR
#define S_IXUSR 0100
#endif
#ifndef S_IRWXG
#define S_IRWXG 0070
#endif
#ifndef S_IRGRP
#define S_IRGRP 0040
#endif
#ifndef S_IWGRP
#define S_IWGRP 0020
#endif
#ifndef S_IXGRP
#define S_IXGRP 0010
#endif
#ifndef S_IRWXO
#define S_IRWXO 0007
#endif
#ifndef S_IROTH
#define S_IROTH 0004
#endif
#ifndef S_IWOTH
#define S_IWOTH 0002
#endif
#ifndef S_IXOTH
#define S_IXOTH 0001
#endif
/* Like filemodestring, but only the relevant part of the `struct stat'
is given as an argument. */
void
mode_string (mode, str)
unsigned long mode;
char *str;
{
str[0] = ftypelet ((unsigned long) mode);
str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-';
str[2] = (mode & S_IWUSR) != 0 ? 'w' : '-';
str[3] = (mode & S_IXUSR) != 0 ? 'x' : '-';
str[4] = (mode & S_IRGRP) != 0 ? 'r' : '-';
str[5] = (mode & S_IWGRP) != 0 ? 'w' : '-';
str[6] = (mode & S_IXGRP) != 0 ? 'x' : '-';
str[7] = (mode & S_IROTH) != 0 ? 'r' : '-';
str[8] = (mode & S_IWOTH) != 0 ? 'w' : '-';
str[9] = (mode & S_IXOTH) != 0 ? 'x' : '-';
setst ((unsigned long) mode, str);
}
/* Return a character indicating the type of file described by
file mode BITS:
'd' for directories
'b' for block special files
'c' for character special files
'm' for multiplexor files
'l' for symbolic links
's' for sockets
'p' for fifos
'-' for any other file type. */
#ifndef S_ISDIR
#ifdef S_IFDIR
#define S_ISDIR(i) (((i) & S_IFMT) == S_IFDIR)
#else /* ! defined (S_IFDIR) */
#define S_ISDIR(i) (((i) & 0170000) == 040000)
#endif /* ! defined (S_IFDIR) */
#endif /* ! defined (S_ISDIR) */
#ifndef S_ISBLK
#ifdef S_IFBLK
#define S_ISBLK(i) (((i) & S_IFMT) == S_IFBLK)
#else /* ! defined (S_IFBLK) */
#define S_ISBLK(i) 0
#endif /* ! defined (S_IFBLK) */
#endif /* ! defined (S_ISBLK) */
#ifndef S_ISCHR
#ifdef S_IFCHR
#define S_ISCHR(i) (((i) & S_IFMT) == S_IFCHR)
#else /* ! defined (S_IFCHR) */
#define S_ISCHR(i) 0
#endif /* ! defined (S_IFCHR) */
#endif /* ! defined (S_ISCHR) */
#ifndef S_ISFIFO
#ifdef S_IFIFO
#define S_ISFIFO(i) (((i) & S_IFMT) == S_IFIFO)
#else /* ! defined (S_IFIFO) */
#define S_ISFIFO(i) 0
#endif /* ! defined (S_IFIFO) */
#endif /* ! defined (S_ISFIFO) */
#ifndef S_ISSOCK
#ifdef S_IFSOCK
#define S_ISSOCK(i) (((i) & S_IFMT) == S_IFSOCK)
#else /* ! defined (S_IFSOCK) */
#define S_ISSOCK(i) 0
#endif /* ! defined (S_IFSOCK) */
#endif /* ! defined (S_ISSOCK) */
#ifndef S_ISLNK
#ifdef S_IFLNK
#define S_ISLNK(i) (((i) & S_IFMT) == S_IFLNK)
#else /* ! defined (S_IFLNK) */
#define S_ISLNK(i) 0
#endif /* ! defined (S_IFLNK) */
#endif /* ! defined (S_ISLNK) */
static char
ftypelet (bits)
unsigned long bits;
{
if (S_ISDIR (bits))
return 'd';
if (S_ISLNK (bits))
return 'l';
if (S_ISBLK (bits))
return 'b';
if (S_ISCHR (bits))
return 'c';
if (S_ISSOCK (bits))
return 's';
if (S_ISFIFO (bits))
return 'p';
#ifdef S_IFMT
#ifdef S_IFMPC
if ((bits & S_IFMT) == S_IFMPC
|| (bits & S_IFMT) == S_IFMPB)
return 'm';
#endif
#ifdef S_IFNWK
if ((bits & S_IFMT) == S_IFNWK)
return 'n';
#endif
#endif
return '-';
}
/* Set the 's' and 't' flags in file attributes string CHARS,
according to the file mode BITS. */
static void
setst (bits, chars)
unsigned long bits;
char *chars;
{
#ifdef S_ISUID
if (bits & S_ISUID)
{
if (chars[3] != 'x')
/* Set-uid, but not executable by owner. */
chars[3] = 'S';
else
chars[3] = 's';
}
#endif
#ifdef S_ISGID
if (bits & S_ISGID)
{
if (chars[6] != 'x')
/* Set-gid, but not executable by group. */
chars[6] = 'S';
else
chars[6] = 's';
}
#endif
#ifdef S_ISVTX
if (bits & S_ISVTX)
{
if (chars[9] != 'x')
/* Sticky, but not executable by others. */
chars[9] = 'T';
else
chars[9] = 't';
}
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -1,138 +0,0 @@
/* IEEE Standard 695-1980 "Universal Format for Object Modules" header file
Contributed by Cygnus Support. */
#define N_W_VARIABLES 8
#define Module_Beginning 0xe0
typedef struct ieee_module {
char *processor;
char *module_name;
} ieee_module_begin_type;
#define Address_Descriptor 0xec
typedef struct ieee_address {
bfd_vma number_of_bits_mau;
bfd_vma number_of_maus_in_address;
unsigned char byte_order;
#define IEEE_LITTLE 0xcc
#define IEEE_BIG 0xcd
} ieee_address_descriptor_type;
typedef union ieee_w_variable {
file_ptr offset[N_W_VARIABLES];
struct {
file_ptr extension_record;
file_ptr environmental_record;
file_ptr section_part;
file_ptr external_part;
file_ptr debug_information_part;
file_ptr data_part;
file_ptr trailer_part;
file_ptr me_record;
} r;
} ieee_w_variable_type;
typedef enum ieee_record
{
ieee_number_start_enum = 0x00,
ieee_number_end_enum=0x7f,
ieee_number_repeat_start_enum = 0x80,
ieee_number_repeat_end_enum = 0x88,
ieee_number_repeat_4_enum = 0x84,
ieee_number_repeat_3_enum = 0x83,
ieee_number_repeat_2_enum = 0x82,
ieee_number_repeat_1_enum = 0x81,
ieee_module_beginning_enum = 0xe0,
ieee_module_end_enum = 0xe1,
ieee_extension_length_1_enum = 0xde,
ieee_extension_length_2_enum = 0xdf,
ieee_section_type_enum = 0xe6,
ieee_section_alignment_enum = 0xe7,
ieee_external_symbol_enum = 0xe8,
ieee_comma = 0x90,
ieee_external_reference_enum = 0xe9,
ieee_set_current_section_enum = 0xe5,
ieee_address_descriptor_enum = 0xec,
ieee_load_constant_bytes_enum = 0xed,
ieee_load_with_relocation_enum = 0xe4,
ieee_variable_A_enum = 0xc1,
ieee_variable_B_enum = 0xc2,
ieee_variable_C_enum = 0xc3,
ieee_variable_D_enum = 0xc4,
ieee_variable_E_enum = 0xc5,
ieee_variable_F_enum = 0xc6,
ieee_variable_G_enum = 0xc7,
ieee_variable_H_enum = 0xc8,
ieee_variable_I_enum = 0xc9,
ieee_variable_J_enum = 0xca,
ieee_variable_K_enum = 0xcb,
ieee_variable_L_enum = 0xcc,
ieee_variable_M_enum = 0xcd,
ieee_variable_N_enum = 0xce,
ieee_variable_O_enum = 0xcf,
ieee_variable_P_enum = 0xd0,
ieee_variable_Q_enum = 0xd1,
ieee_variable_R_enum = 0xd2,
ieee_variable_S_enum = 0xd3,
ieee_variable_T_enum = 0xd4,
ieee_variable_U_enum = 0xd5,
ieee_variable_V_enum = 0xd6,
ieee_variable_W_enum = 0xd7,
ieee_variable_X_enum = 0xd8,
ieee_variable_Y_enum = 0xd9,
ieee_variable_Z_enum = 0xda,
ieee_function_plus_enum = 0xa5,
ieee_function_minus_enum = 0xa6,
ieee_function_signed_open_b_enum = 0xba,
ieee_function_signed_close_b_enum = 0xbb,
ieee_function_unsigned_open_b_enum = 0xbc,
ieee_function_unsigned_close_b_enum = 0xbd,
ieee_function_either_open_b_enum = 0xbe,
ieee_function_either_close_b_enum = 0xbf,
ieee_record_seperator_enum = 0xdb,
ieee_e2_first_byte_enum = 0xe2,
ieee_section_size_enum = 0xe2d3,
ieee_physical_region_size_enum = 0xe2c1,
ieee_region_base_address_enum = 0xe2c2,
ieee_mau_size_enum = 0xe2c6,
ieee_m_value_enum = 0xe2cd,
ieee_section_base_address_enum = 0xe2cc,
ieee_asn_record_enum = 0xe2ce,
ieee_section_offset_enum = 0xe2d2,
ieee_value_starting_address_enum = 0xe2c7,
ieee_assign_value_to_variable_enum = 0xe2d7,
ieee_set_current_pc_enum = 0xe2d0,
ieee_value_record_enum = 0xe2c9,
ieee_nn_record = 0xf0,
ieee_at_record_enum = 0xf1,
ieee_ty_record_enum = 0xf2,
ieee_attribute_record_enum = 0xf1c9,
ieee_atn_record_enum = 0xf1ce,
ieee_external_reference_info_record_enum = 0xf1d8,
ieee_weak_external_reference_enum= 0xf4,
ieee_repeat_data_enum = 0xf7,
ieee_bb_record_enum = 0xf8,
ieee_be_record_enum = 0xf9
} ieee_record_enum_type;
typedef struct ieee_section {
unsigned int section_index;
unsigned int section_type;
char *section_name;
unsigned int parent_section_index;
unsigned int sibling_section_index;
unsigned int context_index;
} ieee_section_type;
#define IEEE_REFERENCE_BASE 11
#define IEEE_PUBLIC_BASE 32
#define IEEE_SECTION_NUMBER_BASE 1

View File

@ -1,180 +0,0 @@
/* Function declarations for libiberty.
Written by Cygnus Support, 1994.
The libiberty library provides a number of functions which are
missing on some operating systems. We do not declare those here,
to avoid conflicts with the system header files on operating
systems that do support those functions. In this file we only
declare those functions which are specific to libiberty. */
#ifndef LIBIBERTY_H
#define LIBIBERTY_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ansidecl.h"
/* Build an argument vector from a string. Allocates memory using
malloc. Use freeargv to free the vector. */
extern char **buildargv PARAMS ((char *));
/* Free a vector returned by buildargv. */
extern void freeargv PARAMS ((char **));
/* Duplicate an argument vector. Allocates memory using malloc. Use
freeargv to free the vector. */
extern char **dupargv PARAMS ((char **));
/* Return the last component of a path name. Note that we can't use a
prototype here because the parameter is declared inconsistently
across different systems, sometimes as "char *" and sometimes as
"const char *" */
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__)
extern char *basename PARAMS ((const char *));
#else
extern char *basename ();
#endif
/* Concatenate an arbitrary number of strings, up to (char *) NULL.
Allocates memory using xmalloc. */
extern char *concat PARAMS ((const char *, ...));
/* Check whether two file descriptors refer to the same file. */
extern int fdmatch PARAMS ((int fd1, int fd2));
/* Get the amount of time the process has run, in microseconds. */
extern long get_run_time PARAMS ((void));
/* Choose a temporary directory to use for scratch files. */
extern char *choose_temp_base PARAMS ((void));
/* Allocate memory filled with spaces. Allocates using malloc. */
extern const char *spaces PARAMS ((int count));
/* Return the maximum error number for which strerror will return a
string. */
extern int errno_max PARAMS ((void));
/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
"EINVAL"). */
extern const char *strerrno PARAMS ((int));
/* Given the name of an errno value, return the value. */
extern int strtoerrno PARAMS ((const char *));
/* ANSI's strerror(), but more robust. */
extern char *xstrerror PARAMS ((int));
/* Return the maximum signal number for which strsignal will return a
string. */
extern int signo_max PARAMS ((void));
/* Return a signal message string for a signal number
(e.g., strsignal (SIGHUP) returns something like "Hangup"). */
/* This is commented out as it can conflict with one in system headers.
We still document its existence though. */
/*extern const char *strsignal PARAMS ((int));*/
/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
"SIGHUP"). */
extern const char *strsigno PARAMS ((int));
/* Given the name of a signal, return its number. */
extern int strtosigno PARAMS ((const char *));
/* Register a function to be run by xexit. Returns 0 on success. */
extern int xatexit PARAMS ((void (*fn) (void)));
/* Exit, calling all the functions registered with xatexit. */
#ifndef __GNUC__
extern void xexit PARAMS ((int status));
#else
void xexit PARAMS ((int status)) __attribute__ ((noreturn));
#endif
/* Set the program name used by xmalloc. */
extern void xmalloc_set_program_name PARAMS ((const char *));
/* Allocate memory without fail. If malloc fails, this will print a
message to stderr (using the name set by xmalloc_set_program_name,
if any) and then call xexit. */
#ifdef ANSI_PROTOTYPES
/* Get a definition for size_t. */
#include <stddef.h>
#endif
extern PTR xmalloc PARAMS ((size_t));
/* Reallocate memory without fail. This works like xmalloc.
FIXME: We do not declare the parameter types for the same reason as
xmalloc. */
extern PTR xrealloc PARAMS ((PTR, size_t));
/* Allocate memory without fail and set it to zero. This works like
xmalloc. */
extern PTR xcalloc PARAMS ((size_t, size_t));
/* Copy a string into a memory buffer without fail. */
extern char *xstrdup PARAMS ((const char *));
/* hex character manipulation routines */
#define _hex_array_size 256
#define _hex_bad 99
extern char _hex_value[_hex_array_size];
extern void hex_init PARAMS ((void));
#define hex_p(c) (hex_value (c) != _hex_bad)
/* If you change this, note well: Some code relies on side effects in
the argument being performed exactly once. */
#define hex_value(c) (_hex_value[(unsigned char) (c)])
/* Definitions used by the pexecute routine. */
#define PEXECUTE_FIRST 1
#define PEXECUTE_LAST 2
#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
#define PEXECUTE_SEARCH 4
#define PEXECUTE_VERBOSE 8
/* Execute a program. */
extern int pexecute PARAMS ((const char *, char * const *, const char *,
const char *, char **, char **, int));
/* Wait for pexecute to finish. */
extern int pwait PARAMS ((int, int *, int));
#ifdef __cplusplus
}
#endif
#endif /* ! defined (LIBIBERTY_H) */

View File

@ -1,90 +0,0 @@
/* $Header$ */
/*
* LinuxThreads specific stuff.
*/
#include <sys/types.h>
#include <assert.h>
#include <limits.h> /* PTHREAD_THREADS_MAX */
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sched.h>
#include "linuxthreads.h"
#define AT_INT(intval) *((int32_t*)(intval))
/*
* Internal LinuxThreads variables.
* Official interface exposed to GDB.
*/
#if 1
extern volatile int __pthread_threads_debug;
extern volatile char __pthread_handles;
extern char __pthread_initial_thread;
/*extern volatile Elf32_Sym* __pthread_manager_thread;*/
extern const int __pthread_sizeof_handle;
extern const int __pthread_offsetof_descr;
extern const int __pthread_offsetof_pid;
extern volatile int __pthread_handles_num;
#endif /* 0 */
/*
* Notify others.
*/
int
linuxthreads_notify_others( const int signotify)
{
const pid_t mypid = getpid();
//const pthread_t mytid = pthread_self();
int i;
int threadcount = 0;
int threads[PTHREAD_THREADS_MAX];
int pid;
TRACE_FPRINTF((stderr, "theadcount:%d\n", __pthread_handles_num));
if (__pthread_handles_num==2) {
/* no threads beside the initial thread */
return 0;
}
/*assert(maxthreads>=3);
assert(maxthreads>=__pthread_handles_num+2);*/
// take the initial thread with us
pid = AT_INT(&__pthread_initial_thread + __pthread_offsetof_pid);
if (pid!=mypid && pid!=0)
threads[threadcount++] = pid;
// don't know why, but always handles[0]==handles[1]
for (i=1; i<__pthread_handles_num; ++i) {
const int descr = AT_INT(&__pthread_handles+i*__pthread_sizeof_handle+__pthread_offsetof_descr);
assert(descr!=0);
pid = AT_INT(descr+__pthread_offsetof_pid);
if (pid!=mypid && pid!=0)
threads[threadcount++] = pid;
}
/* TRACE_FPRINTF((stderr, "Stopping threads...")); */
//for (i=0; i<threadcount; ++i) {
// /* TRACE_FPRINTF((stderr, "%d ", threads[i])); */
// fflush(stdout);
// kill(threads[i], SIGSTOP); /* Tell thread to stop */
//}
/* TRACE_FPRINTF((stderr, " done!\n")); */
for (i=0; i<threadcount; ++i) {
TRACE_FPRINTF((stderr, "--- NOTIFYING %d\n", threads[i]));
kill(threads[i], signotify); /* Tell to print stack trace */
/* TRACE_FPRINTF((stderr, "--- WAITING FOR %d\n", threads[i])); */
/*pause(); Wait for confirmation. */
}
for (i=0; i<threadcount; ++i)
sched_yield();
for (i=0; i<threadcount; ++i) {
TRACE_FPRINTF((stderr, "--- KILLING %d\n", threads[i]));
kill(threads[i], SIGKILL); /* Tell thread die :) */
}
return __pthread_handles_num;
}

View File

@ -1,28 +0,0 @@
/* $Header$ */
/*
* LinuxThreads specific stuff.
*/
#ifndef pstack_linuxthreads_h_
#define pstack_linuxthreads_h_
#include <pthread.h>
#include "pstacktrace.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Tell other threads to dump stacks...
*/
int
linuxthreads_notify_others( const int signotify);
#ifdef __cplusplus
}
#endif
#endif /* pstack_linuxthreads_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +0,0 @@
/* $Header$ */
#ifndef pstack_pstack_h_
#define pstack_pstack_h_
#include "pstacktrace.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Install the stack-trace-on-SEGV handler....
*/
extern int
pstack_install_segv_action( const char* path_format);
#ifdef __cplusplus
}
#endif
#endif /* pstack_pstack_h_ */

View File

@ -1,24 +0,0 @@
/* $Header$ */
/*
* Debugging macros.
*/
#ifndef pstacktrace_h_
#define pstacktrace_h_
#define PSTACK_DEBUG 1
#undef PSTACK_DEBUG
#ifdef PSTACK_DEBUG
# define TRACE_PUTC(a) putc a
# define TRACE_FPUTS(a) fputs a
# define TRACE_FPRINTF(a) fprintf a
#else /* PSTACK_DEBUG */
# define TRACE_PUTC(a) (void)0
# define TRACE_FPUTS(a) (void)0
# define TRACE_FPRINTF(a) (void)0
#endif /* !PSTACK_DEBUG */
#endif /* pstacktrace_h_ */

View File

@ -1,462 +0,0 @@
/* rddbg.c -- Read debugging information into a generic form.
Copyright (C) 1995, 96, 1997 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
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. */
/* This file reads debugging information into a generic form. This
file knows how to dig the debugging information out of an object
file. */
#include <bfd.h>
#include "bucomm.h"
#include <libiberty.h>
#include "debug.h"
#include "budbg.h"
static boolean read_section_stabs_debugging_info
PARAMS ((bfd *, asymbol **, long, PTR, boolean *));
static boolean read_symbol_stabs_debugging_info
PARAMS ((bfd *, asymbol **, long, PTR, boolean *));
static boolean read_ieee_debugging_info PARAMS ((bfd *, PTR, boolean *));
static void save_stab PARAMS ((int, int, bfd_vma, const char *));
static void stab_context PARAMS ((void));
static void free_saved_stabs PARAMS ((void));
/* Read debugging information from a BFD. Returns a generic debugging
pointer. */
PTR
read_debugging_info (abfd, syms, symcount)
bfd *abfd;
asymbol **syms;
long symcount;
{
PTR dhandle;
boolean found;
dhandle = debug_init ();
if (dhandle == NULL)
return NULL;
if (! read_section_stabs_debugging_info (abfd, syms, symcount, dhandle,
&found))
return NULL;
if (bfd_get_flavour (abfd) == bfd_target_aout_flavour)
{
if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle,
&found))
return NULL;
}
if (bfd_get_flavour (abfd) == bfd_target_ieee_flavour)
{
if (! read_ieee_debugging_info (abfd, dhandle, &found))
return NULL;
}
/* Try reading the COFF symbols if we didn't find any stabs in COFF
sections. */
if (! found
&& bfd_get_flavour (abfd) == bfd_target_coff_flavour
&& symcount > 0)
{
#if 0
/*
* JZ: Do we need coff?
*/
if (! parse_coff (abfd, syms, symcount, dhandle))
#else
fprintf (stderr, "%s: COFF support temporarily disabled\n",
bfd_get_filename (abfd));
return NULL;
#endif
return NULL;
found = true;
}
if (! found)
{
fprintf (stderr, "%s: no recognized debugging information\n",
bfd_get_filename (abfd));
return NULL;
}
return dhandle;
}
/* Read stabs in sections debugging information from a BFD. */
static boolean
read_section_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
bfd *abfd;
asymbol **syms;
long symcount;
PTR dhandle;
boolean *pfound;
{
static struct
{
const char *secname;
const char *strsecname;
} names[] = { { ".stab", ".stabstr" } };
unsigned int i;
PTR shandle;
*pfound = false;
shandle = NULL;
for (i = 0; i < sizeof names / sizeof names[0]; i++)
{
asection *sec, *strsec;
sec = bfd_get_section_by_name (abfd, names[i].secname);
strsec = bfd_get_section_by_name (abfd, names[i].strsecname);
if (sec != NULL && strsec != NULL)
{
bfd_size_type stabsize, strsize;
bfd_byte *stabs, *strings;
bfd_byte *stab;
bfd_size_type stroff, next_stroff;
stabsize = bfd_section_size (abfd, sec);
stabs = (bfd_byte *) xmalloc (stabsize);
if (! bfd_get_section_contents (abfd, sec, stabs, 0, stabsize))
{
fprintf (stderr, "%s: %s: %s\n",
bfd_get_filename (abfd), names[i].secname,
bfd_errmsg (bfd_get_error ()));
return false;
}
strsize = bfd_section_size (abfd, strsec);
strings = (bfd_byte *) xmalloc (strsize);
if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize))
{
fprintf (stderr, "%s: %s: %s\n",
bfd_get_filename (abfd), names[i].strsecname,
bfd_errmsg (bfd_get_error ()));
return false;
}
if (shandle == NULL)
{
shandle = start_stab (dhandle, abfd, true, syms, symcount);
if (shandle == NULL)
return false;
}
*pfound = true;
stroff = 0;
next_stroff = 0;
for (stab = stabs; stab < stabs + stabsize; stab += 12)
{
bfd_size_type strx;
int type;
int other;
int desc;
bfd_vma value;
/* This code presumes 32 bit values. */
strx = bfd_get_32 (abfd, stab);
type = bfd_get_8 (abfd, stab + 4);
other = bfd_get_8 (abfd, stab + 5);
desc = bfd_get_16 (abfd, stab + 6);
value = bfd_get_32 (abfd, stab + 8);
if (type == 0)
{
/* Special type 0 stabs indicate the offset to the
next string table. */
stroff = next_stroff;
next_stroff += value;
}
else
{
char *f, *s;
f = NULL;
s = (char *) strings + stroff + strx;
while (s[strlen (s) - 1] == '\\'
&& stab + 12 < stabs + stabsize)
{
char *p;
stab += 12;
p = s + strlen (s) - 1;
*p = '\0';
s = concat (s,
((char *) strings
+ stroff
+ bfd_get_32 (abfd, stab)),
(const char *) NULL);
/* We have to restore the backslash, because, if
the linker is hashing stabs strings, we may
see the same string more than once. */
*p = '\\';
if (f != NULL)
free (f);
f = s;
}
save_stab (type, desc, value, s);
if (! parse_stab (dhandle, shandle, type, desc, value, s))
{
#if 0
/*
* JZ: skip the junk.
*/
stab_context ();
free_saved_stabs ();
return false;
#endif
}
/* Don't free f, since I think the stabs code
expects strings to hang around. This should be
straightened out. FIXME. */
}
}
free_saved_stabs ();
free (stabs);
/* Don't free strings, since I think the stabs code expects
the strings to hang around. This should be straightened
out. FIXME. */
}
}
if (shandle != NULL)
{
if (! finish_stab (dhandle, shandle))
return false;
}
return true;
}
/* Read stabs in the symbol table. */
static boolean
read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
bfd *abfd;
asymbol **syms;
long symcount;
PTR dhandle;
boolean *pfound;
{
PTR shandle;
asymbol **ps, **symend;
shandle = NULL;
symend = syms + symcount;
for (ps = syms; ps < symend; ps++)
{
symbol_info i;
bfd_get_symbol_info (abfd, *ps, &i);
if (i.type == '-')
{
const char *s;
char *f;
if (shandle == NULL)
{
shandle = start_stab (dhandle, abfd, false, syms, symcount);
if (shandle == NULL)
return false;
}
*pfound = true;
s = i.name;
f = NULL;
while (s[strlen (s) - 1] == '\\'
&& ps + 1 < symend)
{
char *sc, *n;
++ps;
sc = xstrdup (s);
sc[strlen (sc) - 1] = '\0';
n = concat (sc, bfd_asymbol_name (*ps), (const char *) NULL);
free (sc);
if (f != NULL)
free (f);
f = n;
s = n;
}
save_stab (i.stab_type, i.stab_desc, i.value, s);
if (! parse_stab (dhandle, shandle, i.stab_type, i.stab_desc,
i.value, s))
{
stab_context ();
free_saved_stabs ();
return false;
}
/* Don't free f, since I think the stabs code expects
strings to hang around. This should be straightened out.
FIXME. */
}
}
free_saved_stabs ();
if (shandle != NULL)
{
if (! finish_stab (dhandle, shandle))
return false;
}
return true;
}
/* Read IEEE debugging information. */
static boolean
read_ieee_debugging_info (abfd, dhandle, pfound)
bfd *abfd;
PTR dhandle;
boolean *pfound;
{
asection *dsec;
bfd_size_type size;
bfd_byte *contents;
/* The BFD backend puts the debugging information into a section
named .debug. */
dsec = bfd_get_section_by_name (abfd, ".debug");
if (dsec == NULL)
return true;
size = bfd_section_size (abfd, dsec);
contents = (bfd_byte *) xmalloc (size);
if (! bfd_get_section_contents (abfd, dsec, contents, 0, size))
return false;
if (! parse_ieee (dhandle, abfd, contents, size))
return false;
free (contents);
*pfound = true;
return true;
}
/* Record stabs strings, so that we can give some context for errors. */
#define SAVE_STABS_COUNT (16)
struct saved_stab
{
int type;
int desc;
bfd_vma value;
char *string;
};
static struct saved_stab saved_stabs[SAVE_STABS_COUNT];
static int saved_stabs_index;
/* Save a stabs string. */
static void
save_stab (type, desc, value, string)
int type;
int desc;
bfd_vma value;
const char *string;
{
if (saved_stabs[saved_stabs_index].string != NULL)
free (saved_stabs[saved_stabs_index].string);
saved_stabs[saved_stabs_index].type = type;
saved_stabs[saved_stabs_index].desc = desc;
saved_stabs[saved_stabs_index].value = value;
saved_stabs[saved_stabs_index].string = xstrdup (string);
saved_stabs_index = (saved_stabs_index + 1) % SAVE_STABS_COUNT;
}
/* Provide context for an error. */
static void
stab_context ()
{
int i;
fprintf (stderr, "Last stabs entries before error:\n");
fprintf (stderr, "n_type n_desc n_value string\n");
i = saved_stabs_index;
do
{
struct saved_stab *stabp;
stabp = saved_stabs + i;
if (stabp->string != NULL)
{
const char *s;
s = bfd_get_stab_name (stabp->type);
if (s != NULL)
fprintf (stderr, "%-6s", s);
else if (stabp->type == 0)
fprintf (stderr, "HdrSym");
else
fprintf (stderr, "%-6d", stabp->type);
fprintf (stderr, " %-6d ", stabp->desc);
fprintf_vma (stderr, stabp->value);
if (stabp->type != 0)
fprintf (stderr, " %s", stabp->string);
fprintf (stderr, "\n");
}
i = (i + 1) % SAVE_STABS_COUNT;
}
while (i != saved_stabs_index);
}
/* Free the saved stab strings. */
static void
free_saved_stabs ()
{
int i;
for (i = 0; i < SAVE_STABS_COUNT; i++)
{
if (saved_stabs[i].string != NULL)
{
free (saved_stabs[i].string);
saved_stabs[i].string = NULL;
}
}
saved_stabs_index = 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,6 @@ mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la
LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
mysqld_LDADD = libndb.la \
@MYSQLD_EXTRA_LDFLAGS@ \
@pstack_libs@ \
@mysql_plugin_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
$(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@

View File

@ -70,10 +70,8 @@
#endif
/* stack traces are only supported on linux intel */
#if defined(__linux__) && defined(__i386__) && defined(USE_PSTACK)
#if defined(__linux__) && defined(__i386__)
#define HAVE_STACK_TRACE_ON_SEGV
#include "../pstack/pstack.h"
char pstack_file_name[80];
#endif /* __linux__ */
/* We have HAVE_purify below as this speeds up the shutdown of MySQL */
@ -2779,14 +2777,6 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
if (!opt_bootstrap)
create_pid_file();
#ifdef HAVE_STACK_TRACE_ON_SEGV
if (opt_do_pstack)
{
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid());
pstack_install_segv_action(pstack_file_name);
}
#endif /* HAVE_STACK_TRACE_ON_SEGV */
/*
signal to start_signal_handler that we are ready
This works by waiting for start_signal_handler to free mutex,
@ -5963,9 +5953,10 @@ struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_STACK_TRACE_ON_SEGV
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.",
&opt_do_pstack, &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure. "
"This option is deprecated and has no effect; a symbolic stack trace will "
"be printed after a crash whenever possible.", &opt_do_pstack, &opt_do_pstack,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_STACK_TRACE_ON_SEGV */
{"engine-condition-pushdown",
OPT_ENGINE_CONDITION_PUSHDOWN,
@ -8654,6 +8645,13 @@ mysqld_get_one_option(int optid,
lower_case_table_names= argument ? atoi(argument) : 1;
lower_case_table_names_used= 1;
break;
#ifdef HAVE_STACK_TRACE_ON_SEGV
case OPT_DO_PSTACK:
sql_print_warning("'--enable-pstack' is deprecated and will be removed "
"in a future release. A symbolic stack trace will be "
"printed after a crash whenever possible.");
break;
#endif
#if defined(ENABLED_DEBUG_SYNC)
case OPT_DEBUG_SYNC_TIMEOUT:
/*