aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog30
-rw-r--r--gdb/Makefile.in21
-rw-r--r--gdb/config/a29k/xm-ultra3.h4
-rw-r--r--gdb/config/alpha/xm-alpha.h3
-rw-r--r--gdb/config/arm/xm-arm.h4
-rw-r--r--gdb/config/i386/xm-i386bsd.h4
-rw-r--r--gdb/config/i386/xm-i386m3.h6
-rw-r--r--gdb/config/i386/xm-i386mach.h6
-rw-r--r--gdb/config/i386/xm-sun386.h6
-rw-r--r--gdb/config/i386/xm-symmetry.h4
-rw-r--r--gdb/config/m68k/xm-hp300bsd.h4
-rw-r--r--gdb/config/m68k/xm-hp300hpux.h6
-rw-r--r--gdb/config/m68k/xm-news.h7
-rw-r--r--gdb/config/m68k/xm-sun3.h4
-rw-r--r--gdb/config/m68k/xm-sun3os4.h7
-rw-r--r--gdb/config/m88k/xm-dgux.h4
-rw-r--r--gdb/config/mips/xm-irix3.h4
-rw-r--r--gdb/config/mips/xm-mips.h4
-rw-r--r--gdb/config/mips/xm-mipsm3.h4
-rw-r--r--gdb/config/mips/xm-news-mips.h4
-rw-r--r--gdb/config/ns32k/xm-ns32km3.h6
-rw-r--r--gdb/config/pa/xm-hppab.h2
-rw-r--r--gdb/config/rs6000/xm-rs6000.h4
-rw-r--r--gdb/config/sparc/xm-sparc.h4
-rw-r--r--gdb/config/sparc/xm-sun4os4.h7
-rw-r--r--gdb/config/sparc/xm-sun4sol2.h7
-rw-r--r--gdb/config/vax/xm-vax.h4
-rw-r--r--gdb/config/xm-lynx.h4
-rw-r--r--gdb/config/xm-sysv4.h4
-rw-r--r--gdb/fork-child.c18
-rw-r--r--gdb/main.c52
-rw-r--r--gdb/printcmd.c29
-rw-r--r--gdb/utils.c86
33 files changed, 106 insertions, 257 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8a1ce07..1c411a4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,35 @@
+Sat May 14 09:11:44 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * source.c (find_source_lines): Always use code that was #ifdef
+ BROKEN_LARGE_ALLOCA. Do the cleanup before returning, rather than
+ leaving it on the chain. Reindent much of this function.
+ * config/sparc/{xm-sun4sol2.h,xm-sun4os4.h},
+ config/i386/{xm-sun386.h,xm-i386m3.h,xm-i386mach.h},
+ config/m68k/{sun3os4.h,xm-news.h,xm-hp300hpux.h},
+ config/ns32k/xm-ns32km3.h: Remove all references to
+ BROKEN_LARGE_ALLOCA; with the above change it is no longer needed.
+ * main.c, fork-child.c, many config files: Remove all
+ SET_STACK_LIMIT_HUGE code; with the above changes it should no
+ longer be needed.
+
+ * symtab.c (lookup_partial_symbol): Use if and abort, not assert.
+ This avoids __eprintf troubles.
+
Fri May 13 08:10:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * main.c (main): Surround in #ifndef MAIN_OVERRIDE. Move
+ initialization code which needs to be called even if we bypass the
+ command line stuff into gdb_init.
+ * utils.c (fputs_unfiltered): Surround in #ifndef
+ FPUTS_UNFILTERED_OVERRIDE.
+ * Makefile.in (libgdb.a): New target.
+
+ * utils.c: Rearrange I/O stuff a bit so that all output goes
+ through fputs_unfiltered. Use vasprintf; removes arbitrary limit
+ which made %s not work with arbitrarily large strings.
+ * printcmd.c (printf_command): Use printf_filtered, not
+ printf_unfiltered and printf, now that arbitrary limit is gone.
+
gcc -Wall lint:
* breakpoint.c (watchpoint_check): Remove unused variable b.
* stack.c (print_frame_info): Move sp and buf inside #if.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 1ec257d..2277c05 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -436,10 +436,10 @@ TARFILES = $(SFILES) $(HFILES_NO_SRCDIR) $(HFILES_WITH_SRCDIR) \
$(ALLPARAM) $(INFOFILES) $(POSSLIBS) $(REMOTE_EXAMPLES)
-OBS = version.o main.o blockframe.o breakpoint.o findvar.o stack.o thread.o \
+COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o stack.o thread.o \
source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
symtab.o symfile.o symmisc.o infcmd.o infrun.o command.o \
- utils.o expprint.o environ.o gdbtypes.o copying.o $(DEPFILES) \
+ expprint.o environ.o gdbtypes.o copying.o $(DEPFILES) \
mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \
objfiles.o minsyms.o maint.o demangle.o dbxread.o coffread.o elfread.o \
dwarfread.o mipsread.o stabsread.o core.o c-lang.o ch-lang.o m2-lang.o \
@@ -447,6 +447,10 @@ OBS = version.o main.o blockframe.o breakpoint.o findvar.o stack.o thread.o \
c-valprint.o cp-valprint.o ch-valprint.o m2-valprint.o nlmread.o \
serial.o mdebugread.o os9kread.o annotate.o
+OBS = $(COMMON_OBS) main.o utils.o
+
+LIBGDB_OBS = $(COMMON_OBS) libmain.o libutils.o
+
TSOBS = inflow.o
NTSOBS = standalone.o
@@ -553,6 +557,19 @@ gdb: $(OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
$(CC-LD) $(INTERNAL_LDFLAGS) -o gdb \
init.o $(OBS) $(TSOBS) $(ADD_FILES) $(CLIBS) $(LOADLIBES)
+libgdb.a: $(LIBGDB_OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
+ rm -f libgdb.a
+ $(AR) $(AR_FLAGS) libgdb.a $(LIBGDB_OBS) $(TSOBS) $(ADD_FILES) init.o
+ $(RANLIB) libgdb.a
+
+libmain.o: main.c
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/main.c -DMAIN_OVERRIDE \
+ -o libmain.o
+
+libutils.o: utils.c
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/utils.c -o libutils.o \
+ -DFPUTS_UNFILTERED_OVERRIDE
+
saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
#setopt load_flags $(CFLAGS) $(BFD_CFLAGS) -DHOST_SYS=SUN4_SYS
#load ./init.c $(SFILES)
diff --git a/gdb/config/a29k/xm-ultra3.h b/gdb/config/a29k/xm-ultra3.h
index 74ff6d3..53749a3 100644
--- a/gdb/config/a29k/xm-ultra3.h
+++ b/gdb/config/a29k/xm-ultra3.h
@@ -45,10 +45,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# define F_OK 0
#endif
-/* Get rid of any system-imposed stack limit if possible */
-
-#define SET_STACK_LIMIT_HUGE
-
/* System doesn't provide siginterrupt(). */
#define NO_SIGINTERRUPT
diff --git a/gdb/config/alpha/xm-alpha.h b/gdb/config/alpha/xm-alpha.h
index 5274c3b..b567cd4 100644
--- a/gdb/config/alpha/xm-alpha.h
+++ b/gdb/config/alpha/xm-alpha.h
@@ -21,9 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
-/* Get rid of any system-imposed stack limit if possible. */
-#define SET_STACK_LIMIT_HUGE
-
/* The alpha has no siginterrupt routine. */
#define NO_SIGINTERRUPT
diff --git a/gdb/config/arm/xm-arm.h b/gdb/config/arm/xm-arm.h
index 70953c8..f17469d 100644
--- a/gdb/config/arm/xm-arm.h
+++ b/gdb/config/arm/xm-arm.h
@@ -19,10 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
diff --git a/gdb/config/i386/xm-i386bsd.h b/gdb/config/i386/xm-i386bsd.h
index 8d28df0..2f3d70e 100644
--- a/gdb/config/i386/xm-i386bsd.h
+++ b/gdb/config/i386/xm-i386bsd.h
@@ -25,7 +25,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* psignal() is in <signal.h>. */
#define PSIGNAL_IN_SIGNAL_H
-
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
diff --git a/gdb/config/i386/xm-i386m3.h b/gdb/config/i386/xm-i386m3.h
index 639ac8d..e0a4405 100644
--- a/gdb/config/i386/xm-i386m3.h
+++ b/gdb/config/i386/xm-i386m3.h
@@ -24,12 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef INT_MIN
#define INT_MIN 0x80000000
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
-#define BROKEN_LARGE_ALLOCA
-
/* Do implement the attach and detach commands. */
#define ATTACH_DETACH 1
diff --git a/gdb/config/i386/xm-i386mach.h b/gdb/config/i386/xm-i386mach.h
index 1681988..00d6737 100644
--- a/gdb/config/i386/xm-i386mach.h
+++ b/gdb/config/i386/xm-i386mach.h
@@ -24,17 +24,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef INT_MIN
#define INT_MIN 0x80000000
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
#define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG))
-#define BROKEN_LARGE_ALLOCA
-
#define PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
/* <errno.h> only defines this if __STDC__!!! */
diff --git a/gdb/config/i386/xm-sun386.h b/gdb/config/i386/xm-sun386.h
index bbc4402..ab7d12f 100644
--- a/gdb/config/i386/xm-sun386.h
+++ b/gdb/config/i386/xm-sun386.h
@@ -21,12 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Get rid of any system-imposed stack limit if possible. */
-/* If I do this on SunOS 4.0.1, I get SIGSEGV's on (some) instructions which
- try to access the stack. */
-/* #define SET_STACK_LIMIT_HUGE */
-
-#define BROKEN_LARGE_ALLOCA
-
/* Enable use of alternate code for Sun's format of core dump file. */
#define NEW_SUN_CORE
diff --git a/gdb/config/i386/xm-symmetry.h b/gdb/config/i386/xm-symmetry.h
index a810fdf..b1e32d5 100644
--- a/gdb/config/i386/xm-symmetry.h
+++ b/gdb/config/i386/xm-symmetry.h
@@ -25,10 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_WAIT_STRUCT
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
#define HOST_BYTE_ORDER LITTLE_ENDIAN
/* We must fetch all the regs before storing, since we store all at once. */
diff --git a/gdb/config/m68k/xm-hp300bsd.h b/gdb/config/m68k/xm-hp300bsd.h
index b4938e9..80e04d3 100644
--- a/gdb/config/m68k/xm-hp300bsd.h
+++ b/gdb/config/m68k/xm-hp300bsd.h
@@ -28,10 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Avoid "INT_MIN redefined" preprocessor warnings by defining them here. */
#include <sys/param.h>
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */
#define ONE_PROCESS_WRITETEXT
diff --git a/gdb/config/m68k/xm-hp300hpux.h b/gdb/config/m68k/xm-hp300hpux.h
index 2d06edd..1719a69 100644
--- a/gdb/config/m68k/xm-hp300hpux.h
+++ b/gdb/config/m68k/xm-hp300hpux.h
@@ -52,12 +52,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_TERMIOS
-/* Get rid of any system-imposed stack limit if possible. */
-/* The hp9k320.h doesn't seem to have this feature. */
-/* #define SET_STACK_LIMIT_HUGE */
-/* So we'll just have to avoid big alloca's. */
-#define BROKEN_LARGE_ALLOCA
-
#define REGISTER_ADDR(u_ar0, regno) \
(unsigned int) \
(((regno) < PS_REGNUM) \
diff --git a/gdb/config/m68k/xm-news.h b/gdb/config/m68k/xm-news.h
index 6e96115..db45099 100644
--- a/gdb/config/m68k/xm-news.h
+++ b/gdb/config/m68k/xm-news.h
@@ -25,10 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_WAIT_STRUCT
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* We can't use "isatty" or "fileno" on this machine. This isn't good,
but it will have to do. */
#define ISATTY(FP) ((FP) == stdin || (FP) == stdout)
@@ -48,9 +44,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
addr = blockend + 4 * offsets[regno]; \
}
-/* NewsOS 3 apparently dies on large alloca's -- roland@ai.mit.edu. */
-#define BROKEN_LARGE_ALLOCA
-
/* NewsOS 3.3 does not define errno in <errno.h>. */
extern int errno;
diff --git a/gdb/config/m68k/xm-sun3.h b/gdb/config/m68k/xm-sun3.h
index 3970929..96a9712 100644
--- a/gdb/config/m68k/xm-sun3.h
+++ b/gdb/config/m68k/xm-sun3.h
@@ -19,10 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* Enable use of alternate code for Sun's format of core dump file. */
#define NEW_SUN_CORE
diff --git a/gdb/config/m68k/xm-sun3os4.h b/gdb/config/m68k/xm-sun3os4.h
index 72af7c7..f4db6ad 100644
--- a/gdb/config/m68k/xm-sun3os4.h
+++ b/gdb/config/m68k/xm-sun3os4.h
@@ -20,13 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "m68k/xm-sun3.h"
#define FPU
-/* Large alloca's fail because the attempt to increase the stack limit in
- main() fails because shared libraries are allocated just below the initial
- stack limit. The SunOS kernel will not allow the stack to grow into
- the area occupied by the shared libraries. Sun knows about this bug
- but has no obvious fix for it. */
-#define BROKEN_LARGE_ALLOCA
-
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
diff --git a/gdb/config/m88k/xm-dgux.h b/gdb/config/m88k/xm-dgux.h
index fdc82db..c6ff608 100644
--- a/gdb/config/m88k/xm-dgux.h
+++ b/gdb/config/m88k/xm-dgux.h
@@ -52,10 +52,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define NBPG NBPC
#define UPAGES USIZE
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
diff --git a/gdb/config/mips/xm-irix3.h b/gdb/config/mips/xm-irix3.h
index 2607cd1..50f79ae 100644
--- a/gdb/config/mips/xm-irix3.h
+++ b/gdb/config/mips/xm-irix3.h
@@ -20,10 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_TERMIO
-/* Get rid of any system-imposed stack limit if possible */
-
-#define SET_STACK_LIMIT_HUGE
-
#define HOST_BYTE_ORDER BIG_ENDIAN
/* memcpy and memset return void *, not char *. */
diff --git a/gdb/config/mips/xm-mips.h b/gdb/config/mips/xm-mips.h
index deb52ea..52138af 100644
--- a/gdb/config/mips/xm-mips.h
+++ b/gdb/config/mips/xm-mips.h
@@ -23,10 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
-/* Get rid of any system-imposed stack limit if possible */
-
-#define SET_STACK_LIMIT_HUGE
-
#ifdef ultrix
/* Needed for DECstation core files. */
#include <machine/param.h>
diff --git a/gdb/config/mips/xm-mipsm3.h b/gdb/config/mips/xm-mipsm3.h
index 17ba086..b0b1085 100644
--- a/gdb/config/mips/xm-mipsm3.h
+++ b/gdb/config/mips/xm-mipsm3.h
@@ -23,10 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
-/* Get rid of any system-imposed stack limit if possible */
-
-#define SET_STACK_LIMIT_HUGE
-
#define KERNEL_U_ADDR 0 /* Not needed. */
/* Only used for core files on DECstations. */
diff --git a/gdb/config/mips/xm-news-mips.h b/gdb/config/mips/xm-news-mips.h
index 55ade55..269b34a 100644
--- a/gdb/config/mips/xm-news-mips.h
+++ b/gdb/config/mips/xm-news-mips.h
@@ -23,10 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
#endif
-/* Get rid of any system-imposed stack limit if possible */
-
-#define SET_STACK_LIMIT_HUGE
-
#define MEM_FNS_DECLARED
/* Mips hosts need aligned va_list arguments. */
diff --git a/gdb/config/ns32k/xm-ns32km3.h b/gdb/config/ns32k/xm-ns32km3.h
index 9300b2e..ef3bc7c 100644
--- a/gdb/config/ns32k/xm-ns32km3.h
+++ b/gdb/config/ns32k/xm-ns32km3.h
@@ -24,12 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef INT_MIN
#define INT_MIN 0x80000000
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
-#define BROKEN_LARGE_ALLOCA
-
/* Do implement the attach and detach commands. */
#define ATTACH_DETACH 1
diff --git a/gdb/config/pa/xm-hppab.h b/gdb/config/pa/xm-hppab.h
index 21cefd2..e6f66a6 100644
--- a/gdb/config/pa/xm-hppab.h
+++ b/gdb/config/pa/xm-hppab.h
@@ -36,5 +36,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# define SEEK_CUR 1 /* Set file pointer to current plus "offset" */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif /* SEEK_SET */
-
-#define SET_STACK_LIMIT_HUGE
diff --git a/gdb/config/rs6000/xm-rs6000.h b/gdb/config/rs6000/xm-rs6000.h
index b44287d..c49c433 100644
--- a/gdb/config/rs6000/xm-rs6000.h
+++ b/gdb/config/rs6000/xm-rs6000.h
@@ -54,10 +54,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define USE_O_NOCTTY
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* Brain death inherited from PC's pervades. */
#undef NULL
#define NULL 0
diff --git a/gdb/config/sparc/xm-sparc.h b/gdb/config/sparc/xm-sparc.h
index 9fc068f..a804f84 100644
--- a/gdb/config/sparc/xm-sparc.h
+++ b/gdb/config/sparc/xm-sparc.h
@@ -20,10 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* Enable use of alternate code for Sun's format of core dump file. */
#define NEW_SUN_CORE
diff --git a/gdb/config/sparc/xm-sun4os4.h b/gdb/config/sparc/xm-sun4os4.h
index 1f74de3..2981c2e 100644
--- a/gdb/config/sparc/xm-sun4os4.h
+++ b/gdb/config/sparc/xm-sun4os4.h
@@ -20,13 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "sparc/xm-sparc.h"
#define FPU
-/* Large alloca's fail because the attempt to increase the stack limit in
- main() fails because shared libraries are allocated just below the initial
- stack limit. The SunOS kernel will not allow the stack to grow into
- the area occupied by the shared libraries. Sun knows about this bug
- but has no obvious fix for it. */
-#define BROKEN_LARGE_ALLOCA
-
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
diff --git a/gdb/config/sparc/xm-sun4sol2.h b/gdb/config/sparc/xm-sun4sol2.h
index e063792..44d86b0 100644
--- a/gdb/config/sparc/xm-sun4sol2.h
+++ b/gdb/config/sparc/xm-sun4sol2.h
@@ -39,13 +39,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# define NORETURN /**/
#endif
-/* Large alloca's fail because the attempt to increase the stack limit in
- main() fails because shared libraries are allocated just below the initial
- stack limit. The SunOS kernel will not allow the stack to grow into
- the area occupied by the shared libraries. Sun knows about this bug
- but has no obvious fix for it. */
-#define BROKEN_LARGE_ALLOCA
-
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
diff --git a/gdb/config/vax/xm-vax.h b/gdb/config/vax/xm-vax.h
index 3e91b41..b04b1be 100644
--- a/gdb/config/vax/xm-vax.h
+++ b/gdb/config/vax/xm-vax.h
@@ -19,10 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
diff --git a/gdb/config/xm-lynx.h b/gdb/config/xm-lynx.h
index ed5e7ef..5161884 100644
--- a/gdb/config/xm-lynx.h
+++ b/gdb/config/xm-lynx.h
@@ -25,8 +25,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define PSIGNAL_IN_SIGNAL_H
-/* Get rid of any system-imposed stack limit if possible. */
-
-#define SET_STACK_LIMIT_HUGE
-
#define MEM_FNS_DECLARED
diff --git a/gdb/config/xm-sysv4.h b/gdb/config/xm-sysv4.h
index 9c97646..9d1451d 100644
--- a/gdb/config/xm-sysv4.h
+++ b/gdb/config/xm-sysv4.h
@@ -31,10 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define USG
-/* Get rid of any system-imposed stack limit if possible. */
-
-/* #define SET_STACK_LIMIT_HUGE */
-
/* Use setpgid(0,0) to run inferior in a separate process group */
#define NEED_POSIX_SETPGID
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 9ed7b71..4954de2 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -30,13 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <signal.h>
-#ifdef SET_STACK_LIMIT_HUGE
-#include <sys/time.h>
-#include <sys/resource.h>
-
-extern int original_stack_limit;
-#endif /* SET_STACK_LIMIT_HUGE */
-
extern char **environ;
#ifndef SHELL_FILE
@@ -200,17 +193,6 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun,
if (debug_setpgrp == -1)
perror("setpgrp failed in child");
-#ifdef SET_STACK_LIMIT_HUGE
- /* Reset the stack limit back to what it was. */
- {
- struct rlimit rlim;
-
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = original_stack_limit;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* SET_STACK_LIMIT_HUGE */
-
/* Ask the tty subsystem to switch to the one we specified earlier
(or to share the current terminal, if none was specified). */
diff --git a/gdb/main.c b/gdb/main.c
index 2e819dc..05dddd0 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -56,13 +56,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/stat.h>
#include <ctype.h>
-#ifdef SET_STACK_LIMIT_HUGE
-#include <sys/time.h>
-#include <sys/resource.h>
-
-int original_stack_limit;
-#endif
-
/* Prototypes for local functions */
static char *
@@ -525,6 +518,24 @@ read_command_file (stream)
do_cleanups (cleanups);
}
+void
+gdb_init ()
+{
+ /* Run the init function of each source file */
+
+ init_cmd_lists (); /* This needs to be done first */
+ initialize_all_files ();
+ init_main (); /* But that omits this file! Do it now */
+ init_signals ();
+
+ /* We need a default language for parsing expressions, so simple things like
+ "set width 0" won't fail if no language is explicitly set in a config file
+ or implicitly set by reading an executable during startup. */
+ set_language (language_c);
+ expected_language = current_language; /* don't warn about the change. */
+}
+
+#ifndef MAIN_OVERRIDE
int
main (argc, argv)
int argc;
@@ -603,19 +614,6 @@ main (argc, argv)
getcwd (dirbuf, sizeof (dirbuf));
current_directory = dirbuf;
-#ifdef SET_STACK_LIMIT_HUGE
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca (particularly stringtab
- * in dbxread.c) does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- original_stack_limit = rlim.rlim_cur;
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* SET_STACK_LIMIT_HUGE */
-
/* Parse arguments and options. */
{
int c;
@@ -783,12 +781,7 @@ main (argc, argv)
quiet = 1;
}
- /* Run the init function of each source file */
-
- init_cmd_lists (); /* This needs to be done first */
- initialize_all_files ();
- init_main (); /* But that omits this file! Do it now */
- init_signals ();
+ gdb_init ();
/* Do these (and anything which might call wrap_here or *_filtered)
after initialize_all_files. */
@@ -869,12 +862,6 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
/* We may get more than one warning, don't double space all of them... */
warning_pre_print = "\nwarning: ";
- /* We need a default language for parsing expressions, so simple things like
- "set width 0" won't fail if no language is explicitly set in a config file
- or implicitly set by reading an executable during startup. */
- set_language (language_c);
- expected_language = current_language; /* don't warn about the change. */
-
/* Read and execute $HOME/.gdbinit file, if it exists. This is done
*before* all the command line arguments are processed; it sets
global parameters, which are independent of what file you are
@@ -1039,6 +1026,7 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
}
/* No exit -- exit is through quit_command. */
}
+#endif /* MAIN_OVERRIDE */
void
execute_user_command (c, args)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d693a3e..2060024 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1852,8 +1852,8 @@ printf_command (arg, from_tty)
{
/* Now scan the string for %-specs and see what kinds of args they want.
- argclass[I] classifies the %-specs so we can give vprintf_unfiltered something
- of the right size. */
+ argclass[I] classifies the %-specs so we can give printf_filtered
+ something of the right size. */
enum argclass {no_arg, int_arg, string_arg, double_arg, long_long_arg};
enum argclass *argclass;
@@ -1949,16 +1949,6 @@ printf_command (arg, from_tty)
if (nargs != nargs_wanted)
error ("Wrong number of arguments for specified format-string");
- /* FIXME: We should be using vprintf_filtered, but as long as it
- has an arbitrary limit that is unacceptable. Correct fix is
- for vprintf_filtered to scan down the format string so it knows
- how big a buffer it needs (perhaps by putting a vasprintf (see
- GNU C library) in libiberty).
-
- But for now, just force out any pending output, so at least the output
- appears in the correct order. */
- wrap_here ((char *)NULL);
-
/* Now actually print them. */
current_substring = substrings;
for (i = 0; i < nargs; i++)
@@ -1987,23 +1977,20 @@ printf_command (arg, from_tty)
read_memory (tem, str, j);
str[j] = 0;
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, str);
+ printf_filtered (current_substring, str);
}
break;
case double_arg:
{
double val = value_as_double (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
case long_long_arg:
#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
{
long long val = value_as_long (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
#else
@@ -2013,8 +2000,7 @@ printf_command (arg, from_tty)
{
/* FIXME: there should be separate int_arg and long_arg. */
long val = value_as_long (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
default:
@@ -2024,8 +2010,7 @@ printf_command (arg, from_tty)
current_substring += strlen (current_substring) + 1;
}
/* Print the portion of the format string after the last argument. */
- /* It would be OK to use printf_filtered here. */
- printf (last_arg);
+ printf_filtered (last_arg);
}
do_cleanups (old_cleanups);
}
diff --git a/gdb/utils.c b/gdb/utils.c
index 4474b83..b914c5b 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1148,7 +1148,7 @@ wrap_here(indent)
if (wrap_buffer[0])
{
*wrap_pointer = '\0';
- fputs (wrap_buffer, gdb_stdout);
+ fputs_unfiltered (wrap_buffer, gdb_stdout);
}
wrap_pointer = wrap_buffer;
wrap_buffer[0] = '\0';
@@ -1231,7 +1231,7 @@ fputs_maybe_filtered (linebuffer, stream, filter)
if (stream != gdb_stdout
|| (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX))
{
- fputs (linebuffer, stream);
+ fputs_unfiltered (linebuffer, stream);
return;
}
@@ -1255,7 +1255,7 @@ fputs_maybe_filtered (linebuffer, stream, filter)
if (wrap_column)
*wrap_pointer++ = '\t';
else
- putc ('\t', stream);
+ fputc_unfiltered ('\t', stream);
/* Shifting right by 3 produces the number of tab stops
we have already passed, and then adding one and
shifting left 3 advances to the next tab stop. */
@@ -1267,7 +1267,7 @@ fputs_maybe_filtered (linebuffer, stream, filter)
if (wrap_column)
*wrap_pointer++ = *lineptr;
else
- putc (*lineptr, stream);
+ fputc_unfiltered (*lineptr, stream);
chars_printed++;
lineptr++;
}
@@ -1282,7 +1282,7 @@ fputs_maybe_filtered (linebuffer, stream, filter)
if chars_per_line is right, we probably just overflowed
anyway; if it's wrong, let us keep going. */
if (wrap_column)
- putc ('\n', stream);
+ fputc_unfiltered ('\n', stream);
/* Possible new page. */
if (lines_printed >= lines_per_page - 1)
@@ -1291,9 +1291,9 @@ fputs_maybe_filtered (linebuffer, stream, filter)
/* Now output indentation and wrapped string */
if (wrap_column)
{
- fputs (wrap_indent, stream);
- *wrap_pointer = '\0'; /* Null-terminate saved stuff */
- fputs (wrap_buffer, stream); /* and eject it */
+ fputs_unfiltered (wrap_indent, stream);
+ *wrap_pointer = '\0'; /* Null-terminate saved stuff */
+ fputs_unfiltered (wrap_buffer, stream); /* and eject it */
/* FIXME, this strlen is what prevents wrap_indent from
containing tabs. However, if we recurse to print it
and count its chars, we risk trouble if wrap_indent is
@@ -1314,7 +1314,7 @@ fputs_maybe_filtered (linebuffer, stream, filter)
chars_printed = 0;
wrap_here ((char *)0); /* Spit out chars, cancel further wraps */
lines_printed++;
- putc ('\n', stream);
+ fputc_unfiltered ('\n', stream);
lineptr++;
}
}
@@ -1328,24 +1328,15 @@ fputs_filtered (linebuffer, stream)
fputs_maybe_filtered (linebuffer, stream, 1);
}
+#ifndef FPUTS_UNFILTERED_OVERRIDE
void
fputs_unfiltered (linebuffer, stream)
const char *linebuffer;
FILE *stream;
{
-#if 0
-
- /* This gets the wrap_buffer buffering wrong when called from
- gdb_readline (GDB was sometimes failing to print the prompt
- before reading input). Even at other times, it seems kind of
- misguided, especially now that printf_unfiltered doesn't use
- printf_maybe_filtered. */
-
- fputs_maybe_filtered (linebuffer, stream, 0);
-#else
fputs (linebuffer, stream);
-#endif
}
+#endif /* FPUTS_UNFILTERED_OVERRIDE */
void
putc_unfiltered (c)
@@ -1372,28 +1363,17 @@ fputc_unfiltered (c, stream)
/* Print a variable number of ARGS using format FORMAT. If this
information is going to put the amount written (since the last call
to REINITIALIZE_MORE_FILTER or the last page break) over the page size,
- print out a pause message and do a gdb_readline to get the users
- permision to continue.
+ call prompt_for_continue to get the users permision to continue.
Unlike fprintf, this function does not return a value.
We implement three variants, vfprintf (takes a vararg list and stream),
fprintf (takes a stream to write on), and printf (the usual).
- Note that this routine has a restriction that the length of the
- final output line must be less than 255 characters *or* it must be
- less than twice the size of the format string. This is a very
- arbitrary restriction, but it is an internal restriction, so I'll
- put it in. This means that the %s format specifier is almost
- useless; unless the caller can GUARANTEE that the string is short
- enough, fputs_filtered should be used instead.
-
Note also that a longjmp to top level may occur in this routine
(since prompt_for_continue may do so) so this routine should not be
called when cleanups are not in place. */
-#define MIN_LINEBUF 255
-
static void
vfprintf_maybe_filtered (stream, format, args, filter)
FILE *stream;
@@ -1401,23 +1381,15 @@ vfprintf_maybe_filtered (stream, format, args, filter)
va_list args;
int filter;
{
- char line_buf[MIN_LINEBUF+10];
- char *linebuffer = line_buf;
- int format_length;
-
- format_length = strlen (format);
-
- /* Reallocate buffer to a larger size if this is necessary. */
- if (format_length * 2 > MIN_LINEBUF)
- {
- linebuffer = alloca (10 + format_length * 2);
- }
-
- /* This won't blow up if the restrictions described above are
- followed. */
- vsprintf (linebuffer, format, args);
+ char *linebuffer;
+ struct cleanup *old_cleanups;
+ vasprintf (&linebuffer, format, args);
+ if (linebuffer == NULL)
+ fatal ("virtual memory exhausted.");
+ old_cleanups = make_cleanup (free, linebuffer);
fputs_maybe_filtered (linebuffer, stream, filter);
+ do_cleanups (old_cleanups);
}
@@ -1436,7 +1408,15 @@ vfprintf_unfiltered (stream, format, args)
char *format;
va_list args;
{
- vfprintf (stream, format, args);
+ char *linebuffer;
+ struct cleanup *old_cleanups;
+
+ vasprintf (&linebuffer, format, args);
+ if (linebuffer == NULL)
+ fatal ("virtual memory exhausted.");
+ old_cleanups = make_cleanup (free, linebuffer);
+ fputs_unfiltered (linebuffer, stream);
+ do_cleanups (old_cleanups);
}
void
@@ -1452,7 +1432,7 @@ vprintf_unfiltered (format, args)
char *format;
va_list args;
{
- vfprintf (gdb_stdout, format, args);
+ vfprintf_unfiltered (gdb_stdout, format, args);
}
/* VARARGS */
@@ -1468,8 +1448,6 @@ fprintf_filtered (va_alist)
stream = va_arg (args, FILE *);
format = va_arg (args, char *);
- /* This won't blow up if the restrictions described above are
- followed. */
vfprintf_filtered (stream, format, args);
va_end (args);
}
@@ -1487,13 +1465,11 @@ fprintf_unfiltered (va_alist)
stream = va_arg (args, FILE *);
format = va_arg (args, char *);
- /* This won't blow up if the restrictions described above are
- followed. */
vfprintf_unfiltered (stream, format, args);
va_end (args);
}
-/* Like fprintf_filtered, but prints it's result indent.
+/* Like fprintf_filtered, but prints its result indented.
Called as fprintfi_filtered (spaces, stream, format, ...); */
/* VARARGS */
@@ -1512,8 +1488,6 @@ fprintfi_filtered (va_alist)
format = va_arg (args, char *);
print_spaces_filtered (spaces, stream);
- /* This won't blow up if the restrictions described above are
- followed. */
vfprintf_filtered (stream, format, args);
va_end (args);
}