summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <>2003-04-19 14:43:52 +0000
committernobody <>2003-04-19 14:43:52 +0000
commitd8cb789e25d4d2d7c90d921b572cf67523cab070 (patch)
tree0f79b3c1cf67dc07a54a109ffa36812ad6628eec
parent291862d73dc6b445dae7638c7490d74473dea27c (diff)
downloadbinutils-gdb-carlton_dictionary-20030416-merge.tar.gz
This commit was manufactured by cvs2svn to create tagcarlton_dictionary-20030416-merge
'carlton_dictionary-20030416-merge'. Sprout from kettenis_i386newframe-20030419-branch 2003-04-19 14:43:51 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from master 2003-04-16 15:22:02 UTC Mark Kettenis <kettenis@gnu.org> '* i386-linux-nat.c: Add some whitespace to make things more': ChangeLog Makefile.in Makefile.tpl bfd/ChangeLog bfd/format.c bfd/version.h configure configure.in gdb/ChangeLog gdb/core-regset.c gdb/gdb_indent.sh gdb/i386-tdep.c gdb/remote.c gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/args.exp gdb/testsuite/gdb.base/completion.exp gdb/thread-db.c gdb/values.c gdb/version.in libiberty/ChangeLog libiberty/Makefile.in libiberty/config.in libiberty/configure libiberty/configure.in libiberty/functions.texi Delete: gdb/gdb_gcore.sh libiberty/snprintf.c libiberty/vsnprintf.c
-rw-r--r--ChangeLog22
-rw-r--r--Makefile.in8
-rw-r--r--Makefile.tpl8
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/format.c4
-rw-r--r--bfd/version.h2
-rwxr-xr-xconfigure6
-rw-r--r--configure.in6
-rw-r--r--gdb/ChangeLog67
-rw-r--r--gdb/core-regset.c109
-rwxr-xr-xgdb/gdb_gcore.sh81
-rwxr-xr-xgdb/gdb_indent.sh2
-rw-r--r--gdb/i386-tdep.c134
-rw-r--r--gdb/remote.c3
-rw-r--r--gdb/rs6000-tdep.c5
-rw-r--r--gdb/s390-tdep.c10
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.base/args.exp12
-rw-r--r--gdb/testsuite/gdb.base/completion.exp18
-rw-r--r--gdb/thread-db.c125
-rw-r--r--gdb/values.c4
-rw-r--r--gdb/version.in2
-rw-r--r--libiberty/ChangeLog11
-rw-r--r--libiberty/Makefile.in14
-rw-r--r--libiberty/config.in6
-rwxr-xr-xlibiberty/configure160
-rw-r--r--libiberty/configure.in4
-rw-r--r--libiberty/functions.texi26
-rw-r--r--libiberty/snprintf.c65
-rw-r--r--libiberty/vsnprintf.c149
30 files changed, 339 insertions, 738 deletions
diff --git a/ChangeLog b/ChangeLog
index 3008cc64edb..d9688b1e0af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,25 +1,3 @@
-2003-04-18 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
- * Makefile.tpl (MAKEINFOFLAGS): Default to --split-size=5000000.
- * Makefile.in: Regenerate.
-
-2003-04-18 Jakub Jelinek <jakub@redhat.com>
-
- * configure.in (powerpc64*-*-linux*): Remove.
- * configure: Rebuilt.
-
-2003-04-17 Phil Edwards <pme@gcc.gnu.org>
-
- * Makefile.tpl (GCC_STRAP_TARGETS): New variable containing all the
- previous bootstrap targets, plus bubblestrap, quickstrap, cleanstrap,
- and restrap.
- * Makefile.in: Regenerate.
-
-2003-04-16 Richard Earnshaw <rearnsha@arm.com>
-
- * configure.in (arm-*-netbsdelf*): Enable building java libraries.
- * configure: Regenerated.
-
2003-04-11 Alexandre Oliva <aoliva@redhat.com>
* libtool.m4 (lt_cv_deplibs_check_method): Use pass_all on mips*.
diff --git a/Makefile.in b/Makefile.in
index 1b993f59e9c..f70250dd8d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -203,8 +203,7 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
# This just becomes part of the MAKEINFO definition passed down to
# sub-makes. It lets flags be given on the command line while still
# using the makeinfo from the object tree.
-# (Default to avoid splitting info files by setting the threshold high.)
-MAKEINFOFLAGS = --split-size=5000000
+MAKEINFOFLAGS =
EXPECT = `if [ -f $$r/expect/expect ] ; \
then echo $$r/expect/expect ; \
@@ -7265,9 +7264,8 @@ all-gcc: configure-gcc
# In theory, on an SMP all those dependencies can be resolved
# in parallel.
#
-GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
-.PHONY: $(GCC_STRAP_TARGETS)
-$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
+.PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
+bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap: all-bootstrap configure-gcc
@r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
diff --git a/Makefile.tpl b/Makefile.tpl
index 314c44977d8..72e24983c57 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -206,8 +206,7 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
# This just becomes part of the MAKEINFO definition passed down to
# sub-makes. It lets flags be given on the command line while still
# using the makeinfo from the object tree.
-# (Default to avoid splitting info files by setting the threshold high.)
-MAKEINFOFLAGS = --split-size=5000000
+MAKEINFOFLAGS =
EXPECT = `if [ -f $$r/expect/expect ] ; \
then echo $$r/expect/expect ; \
@@ -1190,9 +1189,8 @@ all-gcc: configure-gcc
# In theory, on an SMP all those dependencies can be resolved
# in parallel.
#
-GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
-.PHONY: $(GCC_STRAP_TARGETS)
-$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
+.PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
+bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap: all-bootstrap configure-gcc
@r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 00042678430..1650199eb43 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,8 +1,3 @@
-2003-04-18 Nick Clifton <nickc@redhat.com>
-
- * format.c (bfd_check_format_matches): Only check associated
- vector if the matching_vector has been created.
-
2003-04-15 Alexandre Oliva <aoliva@redhat.com>
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Fix typo in
diff --git a/bfd/format.c b/bfd/format.c
index 6415b8d57bc..655ccd9f08f 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -305,9 +305,7 @@ bfd_check_format_matches (abfd, format, matching)
}
}
- if (match_count > 1
- && bfd_associated_vector != NULL
- && matching)
+ if (match_count > 1 && bfd_associated_vector != NULL)
{
const bfd_target * const *assoc = bfd_associated_vector;
diff --git a/bfd/version.h b/bfd/version.h
index 0d88243137f..4c25ee8d2c1 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030419
+#define BFD_VERSION_DATE 20030416
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_string@
diff --git a/configure b/configure
index 045ad147f73..3fc3a727846 100755
--- a/configure
+++ b/configure
@@ -1009,7 +1009,6 @@ case "${target}" in
# Skip some stuff that's unsupported on some NetBSD configurations.
case "${target}" in
i*86-*-netbsdelf*) ;;
- arm*-*-netbsdelf*) ;;
*)
noconfigdirs="$noconfigdirs ${libgcj}"
;;
@@ -1267,6 +1266,11 @@ case "${target}" in
powerpc-*-eabi)
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ powerpc64*-*-linux*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ # not yet ported.
+ noconfigdirs="$noconfigdirs target-libffi"
+ ;;
rs6000-*-lynxos*)
noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
;;
diff --git a/configure.in b/configure.in
index f695982d796..45239e2fa8f 100644
--- a/configure.in
+++ b/configure.in
@@ -349,7 +349,6 @@ case "${target}" in
# Skip some stuff that's unsupported on some NetBSD configurations.
case "${target}" in
i*86-*-netbsdelf*) ;;
- arm*-*-netbsdelf*) ;;
*)
noconfigdirs="$noconfigdirs ${libgcj}"
;;
@@ -607,6 +606,11 @@ case "${target}" in
powerpc-*-eabi)
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ powerpc64*-*-linux*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ # not yet ported.
+ noconfigdirs="$noconfigdirs target-libffi"
+ ;;
rs6000-*-lynxos*)
noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
;;
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad86a9055ca..fcd5d478271 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,70 +1,3 @@
-2003-04-19 Mark Kettenis <kettenis@gnu.org>
-
- * i386-tdep.c (i386_num_register_names): New variable.
- (i386_num_mmx_regs): Renamed from mmx_num_regs.
- (MM0_REGNUM): Remove redundant parentheses in define.
- (i386_mmx_regnum_p): Use i386_mmx_regnum instead of mmx_num_regs.
- (i386_fp_regnum_p, i386_fpc_regnum_p, i386_sse_regnum_p,
- i386_mxcsr_regnum_p): Remove redundant parentheses.
- (i386_register_name): Use i386_num_register_names.
-
- * i386-tdep.c (i386_extract_return_value,
- i386_store_return_value): Correct check for availability of
- floating-point registers.
-
- * i386-tdep.c (i386_frame_num_args): Remove function.
- (i386_gdbarch_init): Set frame_num_args to frame_num_args_unknown.
-
- * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Renamed from
- mmx_regnum_to_fp_regnum. Adjust all callers.
-
- * i386-tdep.c (i386_get_longjmp_target): Use
- TYPE_LENGTH(builtin_type_void_func_ptr) instead of TARGET_PTR_BIT
- and TARGET_CHAR_BIT. Use extract_typed_address instead of
- extract_address.
-
-2003-04-19 Mark Kettenis <kettenis@gnu.org>
-
- * core-regset.c: Update comments to reflect reality. Re-order
- includes.
- (fetch_core_registers): Use switch instead of if. Remove
- redundant prototype.
-
-2003-04-18 Jim Blandy <jimb@redhat.com>
-
- * s390-tdep.c (s390_frame_align): New function.
- (s390_gdbarch_init): Register it with the gdbarch object.
-
-2003-04-17 Richard Henderson <rth@redhat.com>
-
- * remote.c (minitelnet): Don't redeclare escape_count, echo_check.
-
-2003-04-17 Michael Snyder <msnyder@redhat.com>
- Karen Bennet <bennet@redhat.com>
-
- Committed by Elena Zannoni <ezannoni@redhat.com>
- * gdb_gcore.sh: New script to create a core dump of a process.
-
-2003-04-17 Elena Zannoni <ezannoni@redhat.com>
-
- * values.c (value_being_returned): Don't fetch the return
- value if the return type is void.
-
-2003-04-17 Jeff Johnston <jjohnstn@redhat.com>
-
- * thread-db.c: Reindented.
-
-2003-04-17 Jeff Johnston <jjohnstn@redhat.com>
-
- * gdb_indent.sh: Recognize td_thrhandle_t, td_event_msg_t,
- td_thr_events_t, td_notify_t, td_thr_iter_f, and td_thrinfo_t
- as types.
-
-2003-04-16 Kevin Buettner <kevinb@redhat.com>
-
- * rs6000-tdep.c (rs6000_gdbarch_init): For the SysV ABI, set
- the size of ``long double'' to 16, instead of 8.
-
2003-04-16 Mark Kettenis <kettenis@gnu.org>
* i386-linux-nat.c: Add some whitespace to make things more
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 0600837e1a0..16cfde5be66 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -1,6 +1,5 @@
/* Machine independent GDB support for core files on systems using "regsets".
-
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,43 +19,66 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This file is used by most systems that use ELF for their core
- dumps. This includes most systems that have SVR4-ish variant of
- /proc. For these systems, the registers are laid out the same way
- in core files as in the gregset_t and fpregset_t structures that
- are used in the interaction with /proc (Irix 4 is an exception and
- therefore doesn't use this file). Quite a few systems without a
- SVR4-ish /proc define these structures too, and can make use of
- this code too. */
+
+/* N O T E S
+
+ This file is used by most systems that implement /proc. For these systems,
+ the general registers are laid out the same way in both the core file and
+ the gregset_p structure. The current exception to this is Irix-4.*, where
+ the gregset_p structure is split up into two pieces in the core file.
+
+ The general register and floating point register sets are manipulated by
+ separate ioctl's. This file makes the assumption that if FP0_REGNUM is
+ defined, then support for the floating point register set is desired,
+ regardless of whether or not the actual target has floating point hardware.
+
+ */
#include "defs.h"
-#include "command.h"
-#include "gdbcore.h"
-#include "inferior.h"
-#include "target.h"
-#include <fcntl.h>
-#include <errno.h>
-#include "gdb_string.h"
#include <time.h>
#ifdef HAVE_SYS_PROCFS_H
#include <sys/procfs.h>
#endif
+#include <fcntl.h>
+#include <errno.h>
+#include "gdb_string.h"
-/* Prototypes for supply_gregset etc. */
+#include "inferior.h"
+#include "target.h"
+#include "command.h"
+#include "gdbcore.h"
+
+/* Prototypes for supply_gregset etc. */
#include "gregset.h"
-/* Provide registers to GDB from a core file.
+static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
+
+void _initialize_core_regset (void);
+
+/*
+
+ GLOBAL FUNCTION
- CORE_REG_SECT points to an array of bytes, which are the contents
- of a `note' from a core file which BFD thinks might contain
- register contents. CORE_REG_SIZE is its size.
+ fetch_core_registers -- fetch current registers from core file
- WHICH says which register set corelow suspects this is:
- 0 --- the general-purpose register set, in gregset_t format
- 2 --- the floating-point register set, in fpregset_t format
+ SYNOPSIS
- REG_ADDR is ignored. */
+ void fetch_core_registers (char *core_reg_sect,
+ unsigned core_reg_size,
+ int which, CORE_ADDR reg_addr)
+
+ DESCRIPTION
+
+ Read the values of either the general register set (WHICH equals 0)
+ or the floating point register set (WHICH equals 2) from the core
+ file data (pointed to by CORE_REG_SECT), and update gdb's idea of
+ their current values. The CORE_REG_SIZE parameter is compared to
+ the size of the gregset or fpgregset structures (as appropriate) to
+ validate the size of the structure from the core file. The
+ REG_ADDR parameter is ignored.
+
+ */
static void
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
@@ -65,40 +87,36 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
gdb_gregset_t gregset;
gdb_fpregset_t fpregset;
- switch (which)
+ if (which == 0)
{
- case 0:
if (core_reg_size != sizeof (gregset))
- warning ("Wrong size gregset in core file.");
+ {
+ warning ("wrong size gregset struct in core file");
+ }
else
{
- memcpy (&gregset, core_reg_sect, sizeof (gregset));
+ memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
supply_gregset (&gregset);
}
- break;
-
- case 2:
+ }
+ else if (which == 2)
+ {
if (core_reg_size != sizeof (fpregset))
- warning ("Wrong size fpregset in core file.");
+ {
+ warning ("wrong size fpregset struct in core file");
+ }
else
{
- memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
+ memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
if (FP0_REGNUM >= 0)
supply_fpregset (&fpregset);
}
- break;
-
- default:
- /* We've covered all the kinds of registers we know about here,
- so this must be something we wouldn't know what to do with
- anyway. Just ignore it. */
- break;
}
}
-/* Register that we are able to handle ELF core file formats using
- standard procfs "regset" structures. */
+/* Register that we are able to handle ELF file formats using standard
+ procfs "regset" structures. */
static struct core_fns regset_core_fns =
{
@@ -109,9 +127,6 @@ static struct core_fns regset_core_fns =
NULL /* next */
};
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern void _initialize_core_regset (void);
-
void
_initialize_core_regset (void)
{
diff --git a/gdb/gdb_gcore.sh b/gdb/gdb_gcore.sh
deleted file mode 100755
index 9b428081aed..00000000000
--- a/gdb/gdb_gcore.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-# Copyright 2003 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.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-#
-# gcore.sh
-# Script to generate a core file of a running program.
-# It starts up gdb, attaches to the given PID and invokes the gcore command.
-#
-
-if [ "$#" -eq "0" ]
-then
- echo "usage: gcore [-o filename] pid"
- exit 2
-fi
-
-# Need to check for -o option, but set default basename to "core".
-name=core
-
-if [ "$1" = "-o" ]
-then
- if [ "$#" -lt "3" ]
- then
- # Not enough arguments.
- echo "usage: gcore [-o filename] pid"
- exit 2
- fi
- name=$2
-
- # Shift over to start of pid list
- shift; shift
-fi
-
-# Initialise return code.
-rc=0
-
-# Loop through pids
-for pid in $*
-do
- # Write gdb script for pid $pid.
-
- # Avoid need for temporary files by using funky "here
- # document" feature of sh.
-
- /usr/bin/gdb > /dev/null << EOF
- attach $pid
- gcore $name.$pid
- detach
- quit
-EOF
-
- if [ -r $name.$pid ] ; then
- rc=0
- else
- echo gcore: failed to create $name.$pid
- rc=1
- break
- fi
-
-
-done
-
-exit $rc
-
diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh
index b21016107ad..555098c1081 100755
--- a/gdb/gdb_indent.sh
+++ b/gdb/gdb_indent.sh
@@ -75,8 +75,6 @@ types="\
-T FILE \
-T bfd -T asection -T pid_t \
-T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
--T td_thrhandle_t -T td_event_msg_t -T td_thr_events_t \
--T td_notify_t -T td_thr_iter_f -T td_thrinfo_t \
`cat *.h | sed -n \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 2406e3ffefc..475f89c2033 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -46,7 +46,6 @@
/* Names of the registers. The first 10 registers match the register
numbering scheme used by GCC for stabs and DWARF. */
-
static char *i386_register_names[] =
{
"eax", "ecx", "edx", "ebx",
@@ -62,9 +61,6 @@ static char *i386_register_names[] =
"mxcsr"
};
-static const int i386_num_register_names =
- (sizeof (i386_register_names) / sizeof (*i386_register_names));
-
/* MMX registers. */
static char *i386_mmx_names[] =
@@ -72,17 +68,14 @@ static char *i386_mmx_names[] =
"mm0", "mm1", "mm2", "mm3",
"mm4", "mm5", "mm6", "mm7"
};
-
-static const int i386_num_mmx_regs =
- (sizeof (i386_mmx_names) / sizeof (i386_mmx_names[0]));
-
-#define MM0_REGNUM NUM_REGS
+static const int mmx_num_regs = (sizeof (i386_mmx_names)
+ / sizeof (i386_mmx_names[0]));
+#define MM0_REGNUM (NUM_REGS)
static int
-i386_mmx_regnum_p (int regnum)
+i386_mmx_regnum_p (int reg)
{
- return (regnum >= MM0_REGNUM
- && regnum < MM0_REGNUM + i386_num_mmx_regs);
+ return (reg >= MM0_REGNUM && reg < MM0_REGNUM + mmx_num_regs);
}
/* FP register? */
@@ -91,14 +84,14 @@ int
i386_fp_regnum_p (int regnum)
{
return (regnum < NUM_REGS
- && (FP0_REGNUM && FP0_REGNUM <= regnum && regnum < FPC_REGNUM));
+ && (FP0_REGNUM && FP0_REGNUM <= (regnum) && (regnum) < FPC_REGNUM));
}
int
i386_fpc_regnum_p (int regnum)
{
return (regnum < NUM_REGS
- && (FPC_REGNUM <= regnum && regnum < XMM0_REGNUM));
+ && (FPC_REGNUM <= (regnum) && (regnum) < XMM0_REGNUM));
}
/* SSE register? */
@@ -107,14 +100,14 @@ int
i386_sse_regnum_p (int regnum)
{
return (regnum < NUM_REGS
- && (XMM0_REGNUM <= regnum && regnum < MXCSR_REGNUM));
+ && (XMM0_REGNUM <= (regnum) && (regnum) < MXCSR_REGNUM));
}
int
i386_mxcsr_regnum_p (int regnum)
{
return (regnum < NUM_REGS
- && regnum == MXCSR_REGNUM);
+ && (regnum == MXCSR_REGNUM));
}
/* Return the name of register REG. */
@@ -122,13 +115,14 @@ i386_mxcsr_regnum_p (int regnum)
const char *
i386_register_name (int reg)
{
- if (reg >= 0 && reg < i386_num_register_names)
- return i386_register_names[reg];
-
+ if (reg < 0)
+ return NULL;
if (i386_mmx_regnum_p (reg))
return i386_mmx_names[reg - MM0_REGNUM];
+ if (reg >= sizeof (i386_register_names) / sizeof (*i386_register_names))
+ return NULL;
- return NULL;
+ return i386_register_names[reg];
}
/* Convert stabs register number REG to the appropriate register
@@ -606,6 +600,80 @@ i386_saved_pc_after_call (struct frame_info *frame)
return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
}
+/* Return number of args passed to a frame.
+ Can return -1, meaning no way to tell. */
+
+static int
+i386_frame_num_args (struct frame_info *fi)
+{
+#if 1
+ return -1;
+#else
+ /* This loses because not only might the compiler not be popping the
+ args right after the function call, it might be popping args from
+ both this call and a previous one, and we would say there are
+ more args than there really are. */
+
+ int retpc;
+ unsigned char op;
+ struct frame_info *pfi;
+
+ /* On the i386, the instruction following the call could be:
+ popl %ecx - one arg
+ addl $imm, %esp - imm/4 args; imm may be 8 or 32 bits
+ anything else - zero args. */
+
+ int frameless;
+
+ frameless = FRAMELESS_FUNCTION_INVOCATION (fi);
+ if (frameless)
+ /* In the absence of a frame pointer, GDB doesn't get correct
+ values for nameless arguments. Return -1, so it doesn't print
+ any nameless arguments. */
+ return -1;
+
+ pfi = get_prev_frame (fi);
+ if (pfi == 0)
+ {
+ /* NOTE: This can happen if we are looking at the frame for
+ main, because DEPRECATED_FRAME_CHAIN_VALID won't let us go
+ into start. If we have debugging symbols, that's not really
+ a big deal; it just means it will only show as many arguments
+ to main as are declared. */
+ return -1;
+ }
+ else
+ {
+ retpc = pfi->pc;
+ op = read_memory_integer (retpc, 1);
+ if (op == 0x59) /* pop %ecx */
+ return 1;
+ else if (op == 0x83)
+ {
+ op = read_memory_integer (retpc + 1, 1);
+ if (op == 0xc4)
+ /* addl $<signed imm 8 bits>, %esp */
+ return (read_memory_integer (retpc + 2, 1) & 0xff) / 4;
+ else
+ return 0;
+ }
+ else if (op == 0x81) /* `add' with 32 bit immediate. */
+ {
+ op = read_memory_integer (retpc + 1, 1);
+ if (op == 0xc4)
+ /* addl $<imm 32>, %esp */
+ return read_memory_integer (retpc + 2, 4) / 4;
+ else
+ return 0;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+#endif
+}
+
/* Parse the first few instructions the function to see what registers
were stored.
@@ -833,7 +901,7 @@ i386_get_longjmp_target (CORE_ADDR *pc)
char buf[8];
CORE_ADDR sp, jb_addr;
int jb_pc_offset = gdbarch_tdep (current_gdbarch)->jb_pc_offset;
- int len = TYPE_LENGTH (builtin_type_void_func_ptr);
+ int len = TARGET_PTR_BIT / TARGET_CHAR_BIT;
/* If JB_PC_OFFSET is -1, we have no way to find out where the
longjmp will land. */
@@ -844,11 +912,11 @@ i386_get_longjmp_target (CORE_ADDR *pc)
if (target_read_memory (sp + len, buf, len))
return 0;
- jb_addr = extract_typed_address (buf, builtin_type_void_func_ptr);
+ jb_addr = extract_address (buf, len);
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
return 0;
- *pc = extract_typed_address (buf, builtin_type_void_func_ptr);
+ *pc = extract_address (buf, len);
return 1;
}
@@ -898,7 +966,7 @@ i386_extract_return_value (struct type *type, struct regcache *regcache,
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
- if (FP0_REGNUM < 0)
+ if (FP0_REGNUM == 0)
{
warning ("Cannot find floating-point return value.");
memset (valbuf, 0, len);
@@ -956,7 +1024,7 @@ i386_store_return_value (struct type *type, struct regcache *regcache,
ULONGEST fstat;
char buf[FPU_REG_RAW_SIZE];
- if (FP0_REGNUM < 0)
+ if (FP0_REGNUM == 0)
{
warning ("Cannot set floating-point return value.");
return;
@@ -1073,21 +1141,19 @@ i386_register_type (struct gdbarch *gdbarch, int regnum)
}
/* Map a cooked register onto a raw register or memory. For the i386,
- the MMX registers need to be mapped onto floating-point registers. */
+ the MMX registers need to be mapped onto floating point registers. */
static int
-i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum)
+mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum)
{
int mmxi;
ULONGEST fstat;
int tos;
int fpi;
-
mmxi = regnum - MM0_REGNUM;
regcache_raw_read_unsigned (regcache, FSTAT_REGNUM, &fstat);
tos = (fstat >> 11) & 0x7;
fpi = (mmxi + tos) % 8;
-
return (FP0_REGNUM + fpi);
}
@@ -1098,10 +1164,9 @@ i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
if (i386_mmx_regnum_p (regnum))
{
char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE);
- int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
-
- /* Extract (always little endian). */
+ int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum);
regcache_raw_read (regcache, fpnum, mmx_buf);
+ /* Extract (always little endian). */
memcpy (buf, mmx_buf, REGISTER_RAW_SIZE (regnum));
}
else
@@ -1115,8 +1180,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if (i386_mmx_regnum_p (regnum))
{
char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE);
- int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
-
+ int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum);
/* Read ... */
regcache_raw_read (regcache, fpnum, mmx_buf);
/* ... Modify ... (always little endian). */
@@ -1538,7 +1602,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_frame_chain (gdbarch, i386_frame_chain);
set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_frame_saved_pc);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386_saved_pc_after_call);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+ set_gdbarch_frame_num_args (gdbarch, i386_frame_num_args);
set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp);
/* Wire in the MMX registers. */
diff --git a/gdb/remote.c b/gdb/remote.c
index 902cb5fc62d..5edea010275 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5745,6 +5745,9 @@ minitelnet (void)
int status;
int quit_count = 0;
+ extern int escape_count; /* global shared by readsocket */
+ extern int echo_check; /* ditto */
+
escape_count = 0;
echo_check = -1;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 9f553687ec4..b70917e126f 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2895,10 +2895,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- if (sysv_abi)
- set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
- else
- set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 415fde7b480..e50a46d9875 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1664,15 +1664,6 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
}
-static CORE_ADDR
-s390_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
-{
- /* Both the 32- and 64-bit ABI's say that the stack pointer should
- always be aligned on an eight-byte boundary. */
- return (addr & -8);
-}
-
-
static int
s390_use_struct_convention (int gcc_p, struct type *value_type)
{
@@ -1871,7 +1862,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Parameters for inferior function calls. */
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_frame_align (gdbarch, s390_frame_align);
set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_deprecated_push_return_address (gdbarch,
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ace1507cf4..e9dbd6217fe 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,12 +1,3 @@
-2003-04-16 Kevin Buettner <kevinb@redhat.com>
-
- * gdb.base/args.exp: Invoke gdb_load for simulator targets.
-
-2003-04-16 Elena Zannoni <ezannoni@redhat.com>
-
- * gdb.base/completion.exp: Make 'info func mark' complete on 'info
- func marke' instead. Update test name.
-
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp
index 4f50ef0cff6..e481ecb1e86 100644
--- a/gdb/testsuite/gdb.base/args.exp
+++ b/gdb/testsuite/gdb.base/args.exp
@@ -31,15 +31,6 @@ if [target_info exists noargs] {
return;
}
-# No loading needs to be done when the target is `exec'. Some targets
-# require that the program be loaded, however.
-proc args_load {} {
- global binfile
- if [target_info exists is_simulator] {
- gdb_load ${binfile}
- }
-}
-
set testfile "args"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
@@ -56,7 +47,6 @@ set GDBFLAGS "--args $binfile 1 3"
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-args_load
gdb_test "run" \
"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
"correct args printed"
@@ -68,7 +58,6 @@ set GDBFLAGS "--args $binfile 1 '' 3"
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-args_load
gdb_test "run" \
"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
"correct args printed, one empty"
@@ -80,7 +69,6 @@ set GDBFLAGS "--args $binfile 1 '' '' 3"
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-args_load
gdb_test "run" \
"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
"correct args printed, two empty"
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 9c721b113f6..38bbd4b73c9 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -701,10 +701,10 @@ gdb_expect {
timeout { fail "(timeout) complete 'file ./gdb.base/compl'" }
}
-send_gdb "info func marke\t"
+send_gdb "info func mark\t"
sleep 1
gdb_expect {
- -re "^info func marke.*r$"\
+ -re "^info func mark.*er$"\
{
send_gdb "\t\t"
sleep 3
@@ -713,17 +713,17 @@ gdb_expect {
{ send_gdb "\n"
gdb_expect {
-re "All functions matching regular expression \"marker\":.*File.*break.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\
- { pass "complete 'info func marke'"}
- -re ".*$gdb_prompt $" { fail "complete 'info func marke'"}
- timeout {fail "(timeout) complete 'info func marke'"}
+ { pass "complete 'info func mar'"}
+ -re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
+ timeout {fail "(timeout) complete 'info func mar'"}
}
}
- -re ".*$gdb_prompt $" { fail "complete 'info func marke'"}
- timeout {fail "(timeout) complete 'info func marke'"}
+ -re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
+ timeout {fail "(timeout) complete 'info func mar'"}
}
}
- -re ".*$gdb_prompt $" { fail "complete 'info func marke'" }
- timeout { fail "(timeout) complete 'info func marke'" }
+ -re ".*$gdb_prompt $" { fail "complete 'info func mar'" }
+ timeout { fail "(timeout) complete 'info func mar'" }
}
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index bac464151fa..808c29570f6 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -54,7 +54,7 @@ static struct target_ops thread_db_ops;
static struct target_ops *target_beneath;
/* Pointer to the next function on the objfile event chain. */
-static void (*target_new_objfile_chain) (struct objfile * objfile);
+static void (*target_new_objfile_chain) (struct objfile *objfile);
/* Non-zero if we're using this module's target vector. */
static int using_thread_db;
@@ -80,16 +80,15 @@ static td_thragent_t *thread_agent;
static td_err_e (*td_init_p) (void);
-static td_err_e (*td_ta_new_p) (struct ps_prochandle * ps,
- td_thragent_t **ta);
+static td_err_e (*td_ta_new_p) (struct ps_prochandle *ps, td_thragent_t **ta);
static td_err_e (*td_ta_map_id2thr_p) (const td_thragent_t *ta, thread_t pt,
td_thrhandle_t *__th);
-static td_err_e (*td_ta_map_lwp2thr_p) (const td_thragent_t *ta,
- lwpid_t lwpid, td_thrhandle_t *th);
+static td_err_e (*td_ta_map_lwp2thr_p) (const td_thragent_t *ta, lwpid_t lwpid,
+ td_thrhandle_t *th);
static td_err_e (*td_ta_thr_iter_p) (const td_thragent_t *ta,
- td_thr_iter_f *callback, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
+ td_thr_iter_f *callback,
+ void *cbdata_p, td_thr_state_e state,
+ int ti_pri, sigset_t *ti_sigmask_p,
unsigned int ti_user_flags);
static td_err_e (*td_ta_event_addr_p) (const td_thragent_t *ta,
td_event_e event, td_notify_t *ptr);
@@ -109,12 +108,12 @@ static td_err_e (*td_thr_setfpregs_p) (const td_thrhandle_t *th,
const gdb_prfpregset_t *fpregs);
static td_err_e (*td_thr_setgregs_p) (const td_thrhandle_t *th,
prgregset_t gregs);
-static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th,
- int event);
+static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, int event);
static td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
- void *map_address,
- size_t offset, void **address);
+ void *map_address,
+ size_t offset,
+ void **address);
/* Location of the thread creation event breakpoint. The code at this
location in the child process will be called by the pthread library
@@ -151,8 +150,8 @@ static void attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
struct private_thread_info
{
/* Cached thread state. */
- unsigned int th_valid:1;
- unsigned int ti_valid:1;
+ unsigned int th_valid : 1;
+ unsigned int ti_valid : 1;
td_thrhandle_t th;
td_thrinfo_t ti;
@@ -256,7 +255,7 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *infop)
err = td_thr_get_info_p (thp, &ti);
if (err != TD_OK)
- error ("thread_get_info_callback: cannot get thread info: %s",
+ error ("thread_get_info_callback: cannot get thread info: %s",
thread_db_err_str (err));
/* Fill the cache. */
@@ -298,8 +297,7 @@ thread_db_map_id2thr (struct thread_info *thread_info, int fatal)
{
if (fatal)
error ("Cannot find thread %ld: %s",
- (long) GET_THREAD (thread_info->ptid),
- thread_db_err_str (err));
+ (long) GET_THREAD (thread_info->ptid), thread_db_err_str (err));
}
else
thread_info->private->th_valid = 1;
@@ -313,13 +311,12 @@ thread_db_get_info (struct thread_info *thread_info)
if (thread_info->private->ti_valid)
return &thread_info->private->ti;
- if (!thread_info->private->th_valid)
+ if (! thread_info->private->th_valid)
thread_db_map_id2thr (thread_info, 1);
- err =
- td_thr_get_info_p (&thread_info->private->th, &thread_info->private->ti);
+ err = td_thr_get_info_p (&thread_info->private->th, &thread_info->private->ti);
if (err != TD_OK)
- error ("thread_db_get_info: cannot get thread info: %s",
+ error ("thread_db_get_info: cannot get thread info: %s",
thread_db_err_str (err));
thread_info->private->ti_valid = 1;
@@ -384,9 +381,9 @@ thread_db_load (void)
handle = dlopen (LIBTHREAD_DB_SO, RTLD_NOW);
if (handle == NULL)
{
- fprintf_filtered (gdb_stderr, "\n\ndlopen failed on '%s' - %s\n",
+ fprintf_filtered (gdb_stderr, "\n\ndlopen failed on '%s' - %s\n",
LIBTHREAD_DB_SO, dlerror ());
- fprintf_filtered (gdb_stderr,
+ fprintf_filtered (gdb_stderr,
"GDB will not be able to debug pthreads.\n\n");
return 0;
}
@@ -656,7 +653,7 @@ thread_db_new_objfile (struct objfile *objfile)
break;
}
-quit:
+ quit:
if (target_new_objfile_chain)
target_new_objfile_chain (objfile);
}
@@ -707,7 +704,7 @@ thread_db_attach (char *args, int from_tty)
/* ...and perform the remaining initialization steps. */
enable_thread_event_reporting ();
- thread_db_find_new_threads ();
+ thread_db_find_new_threads();
}
static void
@@ -792,7 +789,7 @@ check_event (ptid_t ptid)
err = td_thr_get_info_p (msg.th_p, &ti);
if (err != TD_OK)
- error ("check_event: cannot get thread info: %s",
+ error ("check_event: cannot get thread info: %s",
thread_db_err_str (err));
ptid = BUILD_THREAD (ti.ti_tid, GET_PID (ptid));
@@ -867,7 +864,8 @@ thread_db_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
static int
thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+ struct mem_attrib *attrib,
+ struct target_ops *target)
{
struct cleanup *old_chain = save_inferior_ptid ();
int xfer;
@@ -882,9 +880,7 @@ thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
inferior_ptid = lwp_from_thread (inferior_ptid);
}
- xfer =
- target_beneath->to_xfer_memory (memaddr, myaddr, len, write, attrib,
- target);
+ xfer = target_beneath->to_xfer_memory (memaddr, myaddr, len, write, attrib, target);
do_cleanups (old_chain);
return xfer;
@@ -1025,18 +1021,16 @@ thread_db_thread_alive (ptid_t ptid)
thread_info = find_thread_pid (ptid);
thread_db_map_id2thr (thread_info, 0);
- if (!thread_info->private->th_valid)
+ if (! thread_info->private->th_valid)
return 0;
err = td_thr_validate_p (&thread_info->private->th);
if (err != TD_OK)
return 0;
- if (!thread_info->private->ti_valid)
+ if (! thread_info->private->ti_valid)
{
- err =
- td_thr_get_info_p (&thread_info->private->th,
- &thread_info->private->ti);
+ err = td_thr_get_info_p (&thread_info->private->th, &thread_info->private->ti);
if (err != TD_OK)
return 0;
thread_info->private->ti_valid = 1;
@@ -1064,7 +1058,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
err = td_thr_get_info_p (th_p, &ti);
if (err != TD_OK)
- error ("find_new_threads_callback: cannot get thread info: %s",
+ error ("find_new_threads_callback: cannot get thread info: %s",
thread_db_err_str (err));
if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
@@ -1103,10 +1097,9 @@ thread_db_pid_to_str (ptid_t ptid)
thread_info = find_thread_pid (ptid);
thread_db_map_id2thr (thread_info, 0);
- if (!thread_info->private->th_valid)
+ if (! thread_info->private->th_valid)
{
- snprintf (buf, sizeof (buf), "Thread %ld (Missing)",
- GET_THREAD (ptid));
+ snprintf (buf, sizeof (buf), "Thread %ld (Missing)", GET_THREAD (ptid));
return buf;
}
@@ -1120,8 +1113,7 @@ thread_db_pid_to_str (ptid_t ptid)
else
{
snprintf (buf, sizeof (buf), "Thread %ld (%s)",
- (long) ti_p->ti_tid,
- thread_db_state_str (ti_p->ti_state));
+ (long) ti_p->ti_tid, thread_db_state_str (ti_p->ti_state));
}
return buf;
@@ -1138,7 +1130,7 @@ thread_db_pid_to_str (ptid_t ptid)
static CORE_ADDR
thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
- CORE_ADDR offset)
+ CORE_ADDR offset)
{
if (is_thread (ptid))
{
@@ -1149,20 +1141,20 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
struct thread_info *thread_info;
/* glibc doesn't provide the needed interface. */
- if (!td_thr_tls_get_addr_p)
- error ("Cannot find thread-local variables in this thread library.");
+ if (! td_thr_tls_get_addr_p)
+ error ("Cannot find thread-local variables in this thread library.");
/* Get the address of the link map for this objfile. */
lm = svr4_fetch_objfile_link_map (objfile);
/* Whoops, we couldn't find one. Bail out. */
if (!lm)
- {
- if (objfile_is_library)
- error ("Cannot find shared library `%s' link_map in dynamic"
+ {
+ if (objfile_is_library)
+ error ("Cannot find shared library `%s' link_map in dynamic"
" linker's module list", objfile->name);
else
- error ("Cannot find executable file `%s' link_map in dynamic"
+ error ("Cannot find executable file `%s' link_map in dynamic"
" linker's module list", objfile->name);
}
@@ -1177,21 +1169,21 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
#ifdef THREAD_DB_HAS_TD_NOTALLOC
/* The memory hasn't been allocated, yet. */
if (err == TD_NOTALLOC)
- {
- /* Now, if libthread_db provided the initialization image's
- address, we *could* try to build a non-lvalue value from
- the initialization image. */
- if (objfile_is_library)
- error ("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the shared library `%s'\n"
- "for the thread %ld",
+ {
+ /* Now, if libthread_db provided the initialization image's
+ address, we *could* try to build a non-lvalue value from
+ the initialization image. */
+ if (objfile_is_library)
+ error ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the shared library `%s'\n"
+ "for the thread %ld",
objfile->name, (long) GET_THREAD (ptid));
- else
- error ("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the executable `%s'\n"
- "for the thread %ld",
+ else
+ error ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the executable `%s'\n"
+ "for the thread %ld",
objfile->name, (long) GET_THREAD (ptid));
}
#endif
@@ -1203,12 +1195,14 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
error ("Cannot find thread-local storage for thread %ld, "
"shared library %s:\n%s",
(long) GET_THREAD (ptid),
- objfile->name, thread_db_err_str (err));
+ objfile->name,
+ thread_db_err_str (err));
else
error ("Cannot find thread-local storage for thread %ld, "
"executable file %s:\n%s",
(long) GET_THREAD (ptid),
- objfile->name, thread_db_err_str (err));
+ objfile->name,
+ thread_db_err_str (err));
}
/* Cast assuming host == target. Joy. */
@@ -1216,8 +1210,7 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
}
if (target_beneath->to_get_thread_local_address)
- return target_beneath->to_get_thread_local_address (ptid, objfile,
- offset);
+ return target_beneath->to_get_thread_local_address (ptid, objfile, offset);
error ("Cannot find thread-local values on this target.");
}
diff --git a/gdb/values.c b/gdb/values.c
index 88c6a61037b..8b1d013a0e1 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1240,9 +1240,7 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
- /* If the function returns void, don't bother fetching the return value. */
- if (TYPE_CODE (valtype) != TYPE_CODE_VOID)
- EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
+ EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
return val;
}
diff --git a/gdb/version.in b/gdb/version.in
index 47a3e49edaa..66652974149 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2003-04-19-cvs
+2003-04-16-cvs
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 027fe91c0f1..1e290a559a1 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,14 +1,3 @@
-2003-04-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * configure.in (funcs, AC_CHECK_FUNCS): Add snprintf and
- vsnprintf.
- * snprintf.c, vsnprintf.c: New files.
- * Makefile.in (CFILES): Add snprintf.c and vsnprintf.c.
- (CONFIGURED_OFILES): Add snprintf.o and vsnprintf.o.
- Regenerate dependencies.
-
- * functions.texi, configure, config.in: Regenerated.
-
2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* mempcpy.c, stpcpy.c, stpncpy.c: New files.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index d73ab2fef77..af512a2b1fa 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -147,12 +147,12 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
pex-unix.c pex-win32.c \
physmem.c putenv.c \
random.c regex.c rename.c rindex.c \
- safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \
+ safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \
strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c \
strstr.c strtod.c strtol.c strtoul.c \
ternary.c tmpnam.c \
- vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \
+ vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
waitpid.c \
xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
@@ -191,11 +191,11 @@ CONFIGURED_OFILES = asprintf.o atexit.o \
pex-unix.o pex-win32.o \
putenv.o \
random.o rename.o rindex.o \
- setenv.o sigsetmask.o snprintf.o stpcpy.o stpncpy.o strcasecmp.o \
- strchr.o strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o \
- strtod.o strtol.o strtoul.o \
+ setenv.o sigsetmask.o stpcpy.o stpncpy.o strcasecmp.o strchr.o \
+ strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o \
+ strtol.o strtoul.o \
tmpnam.o \
- vasprintf.o vfork.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o \
+ vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \
waitpid.o
# These files are installed if the library has been configured to do so.
@@ -486,7 +486,6 @@ rename.o: config.h $(INCDIR)/ansidecl.h
safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
setenv.o: config.h $(INCDIR)/ansidecl.h
sigsetmask.o: $(INCDIR)/ansidecl.h
-snprintf.o: $(INCDIR)/ansidecl.h
sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/sort.h
spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
@@ -511,7 +510,6 @@ vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
vfork.o: $(INCDIR)/ansidecl.h
vfprintf.o: $(INCDIR)/ansidecl.h
vprintf.o: $(INCDIR)/ansidecl.h
-vsnprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
vsprintf.o: $(INCDIR)/ansidecl.h
waitpid.o: config.h
xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
diff --git a/libiberty/config.in b/libiberty/config.in
index 1cc6d6132e5..0efae6d901e 100644
--- a/libiberty/config.in
+++ b/libiberty/config.in
@@ -150,9 +150,6 @@
/* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK
-/* Define if you have the snprintf function. */
-#undef HAVE_SNPRINTF
-
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
@@ -219,9 +216,6 @@
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
-/* Define if you have the vsnprintf function. */
-#undef HAVE_VSNPRINTF
-
/* Define if you have the vsprintf function. */
#undef HAVE_VSPRINTF
diff --git a/libiberty/configure b/libiberty/configure
index f1ba0c85832..ed8b3886625 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -1716,7 +1716,6 @@ funcs="$funcs random"
funcs="$funcs rename"
funcs="$funcs rindex"
funcs="$funcs setenv"
-funcs="$funcs snprintf"
funcs="$funcs sigsetmask"
funcs="$funcs stpcpy"
funcs="$funcs stpncpy"
@@ -1733,7 +1732,6 @@ funcs="$funcs tmpnam"
funcs="$funcs vasprintf"
funcs="$funcs vfprintf"
funcs="$funcs vprintf"
-funcs="$funcs vsnprintf"
funcs="$funcs vsprintf"
funcs="$funcs waitpid"
@@ -1751,12 +1749,12 @@ if test "x" = "y"; then
for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1755: checking for $ac_func" >&5
+echo "configure:1753: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1760 "configure"
+#line 1758 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1779,7 +1777,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1806,12 +1804,12 @@ done
for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1810: checking for $ac_func" >&5
+echo "configure:1808: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1815 "configure"
+#line 1813 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1834,7 +1832,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1861,12 +1859,12 @@ done
for ac_func in memmove mempcpy memset putenv random rename rindex sigsetmask
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1865: checking for $ac_func" >&5
+echo "configure:1863: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1870 "configure"
+#line 1868 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1889,7 +1887,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1916,12 +1914,12 @@ done
for ac_func in strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1920: checking for $ac_func" >&5
+echo "configure:1918: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1925 "configure"
+#line 1923 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1944,7 +1942,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1971,12 +1969,12 @@ done
for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1975: checking for $ac_func" >&5
+echo "configure:1973: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1980 "configure"
+#line 1978 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1999,7 +1997,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2026,12 +2024,12 @@ done
for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2030: checking for $ac_func" >&5
+echo "configure:2028: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2035 "configure"
+#line 2033 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2054,7 +2052,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2078,15 +2076,15 @@ else
fi
done
- for ac_func in sysconf times sbrk gettimeofday ffs snprintf vsnprintf
+ for ac_func in sysconf times sbrk gettimeofday ffs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2085: checking for $ac_func" >&5
+echo "configure:2083: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2090 "configure"
+#line 2088 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2109,7 +2107,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2136,12 +2134,12 @@ done
for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2140: checking for $ac_func" >&5
+echo "configure:2138: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2145 "configure"
+#line 2143 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2164,7 +2162,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2191,12 +2189,12 @@ done
for ac_func in realpath canonicalize_file_name
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2195: checking for $ac_func" >&5
+echo "configure:2193: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2200 "configure"
+#line 2198 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2219,7 +2217,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2453,7 +2451,7 @@ if test -z "${setobjs}"; then
# We haven't set the list of objects yet. Use the standard autoconf
# tests. This will only work if the compiler works.
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2457: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2455: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2464,12 +2462,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2468 "configure"
+#line 2466 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -2495,19 +2493,19 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2499: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2497: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
for ac_func in $funcs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2506: checking for $ac_func" >&5
+echo "configure:2504: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2511 "configure"
+#line 2509 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2530,7 +2528,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2557,12 +2555,12 @@ done
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2561: checking whether alloca needs Cray hooks" >&5
+echo "configure:2559: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2566 "configure"
+#line 2564 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -2587,12 +2585,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2591: checking for $ac_func" >&5
+echo "configure:2589: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2596 "configure"
+#line 2594 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2615,7 +2613,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2641,7 +2639,7 @@ fi
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2645: checking stack direction for C alloca" >&5
+echo "configure:2643: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2649,7 +2647,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 2653 "configure"
+#line 2651 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -2668,7 +2666,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -2690,17 +2688,17 @@ EOF
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2694: checking for vfork.h" >&5
+echo "configure:2692: checking for vfork.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2699 "configure"
+#line 2697 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2725,18 +2723,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2729: checking for working vfork" >&5
+echo "configure:2727: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2735: checking for vfork" >&5
+echo "configure:2733: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2740 "configure"
+#line 2738 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -2759,7 +2757,7 @@ vfork();
; return 0; }
EOF
-if { (eval echo configure:2763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vfork=yes"
else
@@ -2781,7 +2779,7 @@ fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
-#line 2785 "configure"
+#line 2783 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -2876,7 +2874,7 @@ main() {
}
}
EOF
-if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_vfork_works=yes
else
@@ -2908,12 +2906,12 @@ fi
for ac_func in _doprnt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2912: checking for $ac_func" >&5
+echo "configure:2910: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2917 "configure"
+#line 2915 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2936,7 +2934,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2966,12 +2964,12 @@ done
for ac_func in _doprnt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2970: checking for $ac_func" >&5
+echo "configure:2968: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2975 "configure"
+#line 2973 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2994,7 +2992,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3022,19 +3020,19 @@ done
for v in $vars; do
echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:3026: checking for $v" >&5
+echo "configure:3024: checking for $v" >&5
if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3031 "configure"
+#line 3029 "configure"
#include "confdefs.h"
int *p;
int main() {
extern int $v []; p = $v;
; return 0; }
EOF
-if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "libiberty_cv_var_$v=yes"
else
@@ -3060,12 +3058,12 @@ EOF
for ac_func in $checkfuncs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3064: checking for $ac_func" >&5
+echo "configure:3062: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3069 "configure"
+#line 3067 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3088,7 +3086,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3113,12 +3111,12 @@ fi
done
echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
-echo "configure:3117: checking whether canonicalize_file_name must be declared" >&5
+echo "configure:3115: checking whether canonicalize_file_name must be declared" >&5
if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3122 "configure"
+#line 3120 "configure"
#include "confdefs.h"
#include "confdefs.h"
@@ -3140,7 +3138,7 @@ int main() {
char *(*pfn) = (char *(*)) canonicalize_file_name
; return 0; }
EOF
-if { (eval echo configure:3144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libiberty_cv_decl_needed_canonicalize_file_name=no
else
@@ -3176,17 +3174,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3180: checking for $ac_hdr" >&5
+echo "configure:3178: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3185 "configure"
+#line 3183 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3215,12 +3213,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3219: checking for $ac_func" >&5
+echo "configure:3217: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3224 "configure"
+#line 3222 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3243,7 +3241,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3268,7 +3266,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3272: checking for working mmap" >&5
+echo "configure:3270: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3276,7 +3274,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3280 "configure"
+#line 3278 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3416,7 +3414,7 @@ main()
}
EOF
-if { (eval echo configure:3420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -3440,7 +3438,7 @@ fi
echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3444: checking for working strncmp" >&5
+echo "configure:3442: checking for working strncmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3448,7 +3446,7 @@ else
ac_cv_func_strncmp_works=no
else
cat > conftest.$ac_ext <<EOF
-#line 3452 "configure"
+#line 3450 "configure"
#include "confdefs.h"
/* Test by Jim Wilson and Kaveh Ghazi.
@@ -3512,7 +3510,7 @@ main ()
}
EOF
-if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strncmp_works=yes
else
diff --git a/libiberty/configure.in b/libiberty/configure.in
index e142cf501c8..d6c2649feb4 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -185,7 +185,6 @@ funcs="$funcs random"
funcs="$funcs rename"
funcs="$funcs rindex"
funcs="$funcs setenv"
-funcs="$funcs snprintf"
funcs="$funcs sigsetmask"
funcs="$funcs stpcpy"
funcs="$funcs stpncpy"
@@ -202,7 +201,6 @@ funcs="$funcs tmpnam"
funcs="$funcs vasprintf"
funcs="$funcs vfprintf"
funcs="$funcs vprintf"
-funcs="$funcs vsnprintf"
funcs="$funcs vsprintf"
funcs="$funcs waitpid"
@@ -223,7 +221,7 @@ if test "x" = "y"; then
AC_CHECK_FUNCS(strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr)
AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
- AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs snprintf vsnprintf)
+ AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl)
AC_CHECK_FUNCS(realpath canonicalize_file_name)
AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 4261d864676..bb35549df19 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -673,19 +673,6 @@ be the value @code{1}).
@end deftypefn
-@c snprintf.c:28
-@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...)
-
-This function is similar to sprintf, but it will print at most @var{n}
-characters. On error the return value is -1, otherwise it returns the
-number of characters that would have been printed had @var{n} been
-sufficiently large, regardless of the actual value of @var{n}. Note
-some pre-C99 system libraries do not implement this correctly so users
-cannot generally rely on the return value if the system version of
-this function is used.
-
-@end deftypefn
-
@c spaces.c:22
@deftypefn Extension char* spaces (int @var{count})
@@ -942,19 +929,6 @@ nonstandard but common function @code{_doprnt}.
@end deftypefn
-@c vsnprintf.c:28
-@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap})
-
-This function is similar to vsprintf, but it will print at most
-@var{n} characters. On error the return value is -1, otherwise it
-returns the number of characters that would have been printed had
-@var{n} been sufficiently large, regardless of the actual value of
-@var{n}. Note some pre-C99 system libraries do not implement this
-correctly so users cannot generally rely on the return value if the
-system version of this function is used.
-
-@end deftypefn
-
@c waitpid.c:3
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
diff --git a/libiberty/snprintf.c b/libiberty/snprintf.c
deleted file mode 100644
index 89164695b50..00000000000
--- a/libiberty/snprintf.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Implement the snprintf function.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
-
-This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not cause
-the resulting executable to be covered by the GNU General Public License.
-This exception does not however invalidate any other reasons why
-the executable file might be covered by the GNU General Public License. */
-
-/*
-
-@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...)
-
-This function is similar to sprintf, but it will print at most @var{n}
-characters. On error the return value is -1, otherwise it returns the
-number of characters that would have been printed had @var{n} been
-sufficiently large, regardless of the actual value of @var{n}. Note
-some pre-C99 system libraries do not implement this correctly so users
-cannot generally rely on the return value if the system version of
-this function is used.
-
-@end deftypefn
-
-*/
-
-#include "ansidecl.h"
-
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#include <stddef.h>
-#else
-#include <varargs.h>
-#define size_t unsigned long
-#endif
-
-int vsnprintf PARAMS ((char *, size_t, const char *, va_list));
-
-int
-snprintf VPARAMS ((char *s, size_t n, const char *format, ...))
-{
- int result;
- VA_OPEN (ap, format);
- VA_FIXEDARG (ap, char *, s);
- VA_FIXEDARG (ap, size_t, n);
- VA_FIXEDARG (ap, const char *, format);
- result = vsnprintf (s, n, format, ap);
- VA_CLOSE (ap);
- return result;
-}
diff --git a/libiberty/vsnprintf.c b/libiberty/vsnprintf.c
deleted file mode 100644
index 9328e430097..00000000000
--- a/libiberty/vsnprintf.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Implement the vsnprintf function.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
-
-This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not cause
-the resulting executable to be covered by the GNU General Public License.
-This exception does not however invalidate any other reasons why
-the executable file might be covered by the GNU General Public License. */
-
-/*
-
-@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap})
-
-This function is similar to vsprintf, but it will print at most
-@var{n} characters. On error the return value is -1, otherwise it
-returns the number of characters that would have been printed had
-@var{n} been sufficiently large, regardless of the actual value of
-@var{n}. Note some pre-C99 system libraries do not implement this
-correctly so users cannot generally rely on the return value if the
-system version of this function is used.
-
-@end deftypefn
-
-*/
-
-#include "config.h"
-#include "ansidecl.h"
-
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include "libiberty.h"
-
-/* This implementation relies on a working vasprintf. */
-int
-vsnprintf (s, n, format, ap)
- char * s;
- size_t n;
- const char *format;
- va_list ap;
-{
- char *buf = 0;
- int result = vasprintf (&buf, format, ap);
-
- if (!buf)
- return -1;
- if (result < 0)
- {
- free (buf);
- return -1;
- }
-
- result = strlen (buf);
- if (n > 0)
- {
- strncpy (s, buf, n);
- if (n - 1 < (size_t) result)
- s[n - 1] = 0;
- }
- free (buf);
- return result;
-}
-
-#ifdef TEST
-/* Set the buffer to a known state. */
-#define CLEAR(BUF) do { memset ((BUF), 'X', sizeof (BUF)); (BUF)[14] = '\0'; } while (0)
-/* For assertions. */
-#define VERIFY(P) do { if (!(P)) abort(); } while (0)
-
-static int ATTRIBUTE_PRINTF_3
-checkit VPARAMS ((char *s, size_t n, const char *format, ...))
-{
- int result;
- VA_OPEN (ap, format);
- VA_FIXEDARG (ap, char *, s);
- VA_FIXEDARG (ap, size_t, n);
- VA_FIXEDARG (ap, const char *, format);
- result = vsnprintf (s, n, format, ap);
- VA_CLOSE (ap);
- return result;
-}
-
-extern int main PARAMS ((void));
-int
-main ()
-{
- char buf[128];
- int status;
-
- CLEAR (buf);
- status = checkit (buf, 10, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "foobar:9") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 9, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "foobar:9") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 8, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "foobar:") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 7, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "foobar") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 6, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "fooba") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 2, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "f") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 1, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "") == 0);
-
- CLEAR (buf);
- status = checkit (buf, 0, "%s:%d", "foobar", 9);
- VERIFY (status==8 && strcmp (buf, "XXXXXXXXXXXXXX") == 0);
-
- return 0;
-}
-#endif /* TEST */