* source.c (find_source_lines): Always use code that was #ifdef
authorJim Kingdon <jkingdon@engr.sgi.com>
Sat, 14 May 1994 19:37:57 +0000 (19:37 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Sat, 14 May 1994 19:37:57 +0000 (19:37 +0000)
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.

* 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.

33 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/config/a29k/xm-ultra3.h
gdb/config/alpha/xm-alpha.h
gdb/config/arm/xm-arm.h
gdb/config/i386/xm-i386bsd.h
gdb/config/i386/xm-i386m3.h
gdb/config/i386/xm-i386mach.h
gdb/config/i386/xm-sun386.h
gdb/config/i386/xm-symmetry.h
gdb/config/m68k/xm-hp300bsd.h
gdb/config/m68k/xm-hp300hpux.h
gdb/config/m68k/xm-news.h
gdb/config/m68k/xm-sun3.h
gdb/config/m68k/xm-sun3os4.h
gdb/config/m88k/xm-dgux.h
gdb/config/mips/xm-irix3.h
gdb/config/mips/xm-mips.h
gdb/config/mips/xm-mipsm3.h
gdb/config/mips/xm-news-mips.h
gdb/config/ns32k/xm-ns32km3.h
gdb/config/pa/xm-hppab.h
gdb/config/rs6000/xm-rs6000.h
gdb/config/sparc/xm-sparc.h
gdb/config/sparc/xm-sun4os4.h
gdb/config/sparc/xm-sun4sol2.h
gdb/config/vax/xm-vax.h
gdb/config/xm-lynx.h
gdb/config/xm-sysv4.h
gdb/fork-child.c
gdb/main.c
gdb/printcmd.c
gdb/utils.c

index 8a1ce0753aac623f695cba0fe98a10679991fae6..1c411a4e2cb658edc53af8a672bbd00696403e00 100644 (file)
@@ -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.
index 1ec257d7bd9f1ae7ab3d735f31b90f517371cfcf..2277c052cf8f448bd2509c1f024079890450a6dc 100644 (file)
@@ -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)
index 74ff6d37fe4242b65363b331130fee29c9fac7c3..53749a375b32351dcf1649707b9117ba6131b58e 100644 (file)
@@ -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
 
index 5274c3b31401a2f9fca38599a74ab9d5aa14fbab..b567cd44034f8e06f85668c99891084d52b39941 100644 (file)
@@ -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
 
index 70953c8de8308a50e2c4559c72e830176ed81e59..f17469da6b039b57a719910a85b1e1cbe6bd677e 100644 (file)
@@ -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.  */
 
index 8d28df0b713f3743aa1c64840afe1eb704253692..2f3d70e02f1ebb7ad95810631c1773f7eba67134 100644 (file)
@@ -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
index 639ac8df4ddb8ced2ea2427ea9d4e399335b775a..e0a44051275e680452d0cf3c1d2c4a69e7ba322d 100644 (file)
@@ -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
 
index 1681988dc5882afd99539218134969780997b078..00d67370a05c12515e69fe0980f1da61d480c7db 100644 (file)
@@ -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__!!! */
index bbc4402e6be08469f301d830dd3295a9e242977b..ab7d12fcd3ed7bbbcf7421cd2c70673be0929c36 100644 (file)
@@ -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
index a810fdfbdab0f713388aba7ceb6ac544fda1973a..b1e32d509045c049fe17bc6995e74f633d9b176e 100644 (file)
@@ -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.  */
index b4938e966bbfee264d8d45d6a6de9808876c95fb..80e04d34865cfe7118a63a31ee8b8a75d9fb9f33 100644 (file)
@@ -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
 
index 2d06edd6951f6c4e9cf297708945b8c2acd0f132..1719a69dcdeadf4be5bd75501dc942bf1ee51590 100644 (file)
@@ -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)                                               \
index 6e96115ecad576a02724ecd87488e573395c029e..db450991ff7f4d99d80a46accafcb451ec6eb564 100644 (file)
@@ -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;
 \f
index 3970929e5bbc3b439012279569a8245d4950d8a6..96a971281a502a86e837f836e3fca7893e27a9bc 100644 (file)
@@ -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
index 72af7c79fa84b32db27ba454b34e5109e16a13d1..f4db6addb7b9d862399b1ef790d53ed55c09bbc1 100644 (file)
@@ -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
index fdc82db59d3dbd95d020f57ee3cf6c1857bd2e54..c6ff6089f414510bb79e1bab7369b3e0eae9488e 100644 (file)
@@ -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.  */
 
index 2607cd1e09db8ffbeb4aa30350ff6b534a0d4958..50f79ae4b24f00fec4c4533e51493f9a4b7f520d 100644 (file)
@@ -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 *.  */
index deb52eabeb19139230feb017b4f381afeb778e55..52138af894a8540b64340f322ba224d789539dd5 100644 (file)
@@ -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>
index 17ba086187b6310f503116c225851d6c678378bf..b0b10850c05f4d5778d6f130d26a5f2fe763714a 100644 (file)
@@ -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. */
index 55ade554b0b5337ceae572eb976f72c3a218633b..269b34a2915ce6250a8719f01ef0ad3d6d6c7853 100644 (file)
@@ -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.  */
index 9300b2e58e32d8a989b6d0ca606ef751e8bcb172..ef3bc7c568382c884c0f96e8b536a20eb4029385 100644 (file)
@@ -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
 
index 21cefd23728bc63b07ee8e0b8208d74e22b54b6b..e6f66a63211889c8be96a643817d2a4f0f7ca3a3 100644 (file)
@@ -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
index b44287d4f8ba077e96b028af92ddcee788010f3c..c49c433f4e0d013f1bff4a3ea49071e5604e30e3 100644 (file)
@@ -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
index 9fc068f08c799f6a1da93e3af25f4f4adeeb2443..a804f848d0e764079bdb67668cec01ee36f8372d 100644 (file)
@@ -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
index 1f74de3b8aff694114e721060afff7abf5765c30..2981c2ee28aa761602ada58ee23a7ca998df852d 100644 (file)
@@ -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
index e06379245c5a308289939f3747283f3cc6aa414c..44d86b0193641e52232855dacaa1e5cc95955ff9 100644 (file)
@@ -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()
index 3e91b41fee6ba962ceb6f6fd1d85bcdbd1f3715c..b04b1bef712d27cf9b29006a86f0c608c2815325 100644 (file)
@@ -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.  */
 
index ed5e7ef731539951c5ad2a188b4be007a8edd8e5..5161884b78293ae60d78ba2a5553ece86f9fb9fc 100644 (file)
@@ -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
index 9c97646b4f7c2d55697d6324e23f4318af2f94a0..9d1451de1a65c6d21d2f354d4358ef907cfdfd40 100644 (file)
@@ -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
index 9ed7b71fb01592282b767acf687a116dbd7d2794..4954de2b169a19e451a2abd4f255f096ae66846b 100644 (file)
@@ -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).  */
 
index 2e819dccd94055682bc884ca0fa02464f73e996b..05dddd0c63cb47523615d155d5874df377cee748 100644 (file)
@@ -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);
 }
 \f
+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)
index d693a3ee5420cd7fa3f6ee59350e1e5cfa6cab9f..20600240df1debf3fa7d8bfcdf092260e153e688 100644 (file)
@@ -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);
 }
index 4474b83f807cc63bb90d60a43c698774f866f182..b914c5b583bdd999b44fc35c56b2ee6bfdd47cfb 100644 (file)
@@ -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);
 }
This page took 0.054924 seconds and 4 git commands to generate.