[gnu.gdb.bug] bug report - compiling gdb with gcc

ronald@UCDAVIS.EDU (10/11/89)

Bug report for gdb-3.3

Hardware:	Cubix QB3/386
OS:		System V Release 3.2
Versions:	gdb - 3.3
		gcc - 1.36
Configurations:	gdb - i386-sysv3.2
		gcc - i386v
Problems:	Building gdb with gcc causes gdb to memory fault and dump
		core; while building gdb with the native compiler does not.
		Also, gdb doesn't quite seem to have COFF down pat, yet
		(compare the output of gdb to the output of sdb below).
The building process:
$ cc -V
cc: command -C Software Development System 4.1.5 5/27/88
$ make
	cc -g -I.   -c main.c
	cc -g -I.   -c blockframe.c
	cc -g -I.   -c breakpoint.c
	cc -g -I.   -c findvar.c
	cc -g -I.   -c stack.c
	cc -g -I.   -c source.c
	cc -g -I.   -c values.c
	cc -g -I.   -c eval.c
	cc -g -I.   -c valops.c
	cc -g -I.   -c valarith.c
	cc -g -I.   -c valprint.c
	cc -g -I.   -c printcmd.c
	cc -g -I.   -c symtab.c
	cc -g -I.   -c symmisc.c
	cc -g -I.   -c coffread.c
	cc -g -I.   -c dbxread.c
	cc -g -I.   -c infcmd.c
	cc -g -I.   -c infrun.c
	cc -g -I.   -c remote.c
	cc -g -I.   -c command.c
	cc -g -I.   -c utils.c
	cc -c -g -I.   expread.tab.c
	mv expread.tab.o expread.o
	cc -g -I.   -c expprint.c
	cc -g -I.   -c pinsn.c
	cc -g -I.   -c environ.c
	cc -g -I.   -c version.c
	cc -g -I.   -c copying.c
	cc -g -I.   -c core.c
	cc -g -I.   -c inflow.c
	cc -g -I.   -c dep.c
	cc -g -I.   -c obstack.c
	cc -g -I.   -c regex.c
	cc -c -g -I.   -Drcheck -Dbotch=fatal_dump_core -DMSTATS malloc.c
	cd readline ; make "SYSV=-DSYSV" "CC=cc" libreadline.a
	cc -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
		-I../ readline.c
	cc -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
		-I../ history.c
	cc -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
		-I../ funmap.c
	cc -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
		 -I../ keymaps.c
	rm -f libreadline.a
	ar clq libreadline.a readline.o history.o funmap.o keymaps.o
	if [ -f /usr/bin/ranlib ]; then /usr/bin/ranlib libreadline.a; fi
	rm -f init.c
	./munch -DSYSV main.o blockframe.o breakpoint.o findvar.o stack.o source.o  values.o eval.o valops.o valarith.o valprint.o printcmd.o  symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o  command.o utils.o expread.o expprint.o pinsn.o envi
ron.o version.o  copying.o  core.o inflow.o dep.o > init.c
	cc -g -I.   -o gdb init.c main.o blockframe.o breakpoint.o findvar.o stack.o source.o  values.o eval.o valops.o valarith.o valprint.o printcmd.o  symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o  command.o utils.o expread.o expprint.o p
insn.o environ.o version.o  copying.o  core.o inflow.o dep.o readline/libreadline.a obstack.o regex.o  malloc.o -ltermcap -lPW
$ cp gdb /usr/local/bin
$ cp readline/libreadline.a /usr/local/lib

-------------------------------------------

$ gcc -v
gcc version 1.36
$ gmake -v
GNU Make version 3.56, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 1989 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

gcc -traditional -g -I.     -c main.c 
gcc -traditional -g -I.     -c blockframe.c 
gcc -traditional -g -I.     -c breakpoint.c 
gcc -traditional -g -I.     -c findvar.c 
gcc -traditional -g -I.     -c stack.c 
gcc -traditional -g -I.     -c source.c 
gcc -traditional -g -I.     -c values.c 
gcc -traditional -g -I.     -c eval.c 
gcc -traditional -g -I.     -c valops.c 
gcc -traditional -g -I.     -c valarith.c 
gcc -traditional -g -I.     -c valprint.c 
gcc -traditional -g -I.     -c printcmd.c 
gcc -traditional -g -I.     -c symtab.c 
gcc -traditional -g -I.     -c symmisc.c 
gcc -traditional -g -I.     -c coffread.c 
gcc -traditional -g -I.     -c dbxread.c 
gcc -traditional -g -I.     -c infcmd.c 
gcc -traditional -g -I.     -c infrun.c 
gcc -traditional -g -I.     -c remote.c 
gcc -traditional -g -I.     -c command.c 
gcc -traditional -g -I.     -c utils.c 
gcc -traditional -c -g -I.   expread.tab.c
mv expread.tab.o expread.o
gcc -traditional -g -I.     -c expprint.c 
gcc -traditional -g -I.     -c pinsn.c 
gcc -traditional -g -I.     -c environ.c 
gcc -traditional -g -I.     -c version.c 
gcc -traditional -g -I.     -c copying.c 
gcc -traditional -g -I.     -c core.c 
gcc -traditional -g -I.     -c inflow.c 
gcc -traditional -g -I.     -c dep.c 
gcc -traditional -g -I.     -c obstack.c 
gcc -traditional -g -I.     -c regex.c 
gcc -traditional -c -g -I.   -Drcheck -Dbotch=fatal_dump_core -DMSTATS malloc.c
cd readline ; gmake "SYSV=-DSYSV" "CC=gcc -traditional" libreadline.a
gcc -traditional -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
	-I../ readline.c
gcc -traditional -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
	-I../ history.c
gcc -traditional -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
	-I../ funmap.c
gcc -traditional -c -g -DVOID_SIGHANDLER -DSYSV -I.  -DVI_MODE \
	 -I../ keymaps.c
rm -f libreadline.a
ar clq libreadline.a readline.o history.o funmap.o keymaps.o
if [ -f /usr/bin/ranlib ]; then /usr/bin/ranlib libreadline.a; fi
rm -f init.c
./munch -DSYSV main.o blockframe.o breakpoint.o findvar.o stack.o source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o command.o utils.o expread.o expprint.o pinsn.o environ.
o version.o copying.o  core.o inflow.o dep.o > init.c
gcc -traditional -g -I.   -o gdb init.c main.o blockframe.o breakpoint.o findvar.o stack.o source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o command.o utils.o expread.o ex
pprint.o pinsn.o environ.o version.o copying.o  core.o inflow.o dep.o readline/libreadline.a obstack.o regex.o  malloc.o -ltermcap -lPW

--------------------------------------------

$ ./gdb # this one built with gcc
GDB 3.3, Copyright (C) 1989 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Setting up the environment for debugging gdb.
Function fatal not defined.
Type "help" for a list of commands.
Memory fault - core dumped
$ /usr/local/bin/gdb ./gdb core # this one built with cc
GDB 3.3, Copyright (C) 1989 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /mnt/gdb-3.3/gdb...unexpected type 11 at symnum 19132
unexpected type 11 at symnum 19133
done.
Type "help" for a list of commands.
(gdb) bt
#0  0x387c6 in strcpy ()
#1  0x4174b9 in etext ()
#2  0x27003 in init_terminal_io (terminal_name=(char *) 0x0) (readline.c line 1799)
#3  0x2623d in readline_initialize_everything () (readline.c line 1000)
#4  0x26179 in rl_initialize () (readline.c line 952)
#5  0x25793 in readline (prompt=(char *) 0x425b10 "(gdb) ") (readline.c line 258)
#6  0xf92 in command_line_input (prompt=(char *) 0x425b10 "(gdb) ", repeat=1) (main.c line 850)
#7  0xbac in command_loop () (main.c line 509)
#8  0x9da in main (Error reading memory address 0x2530ee87: Not owner (1).
(gdb) q
$ sdb ./gdb core .:./readline
Source path: .:./readline
* t
strcpy: address 0x387c6
*strcpy() has no subroutine linkage (pushl)
	Maybe strcpy(0x42ac14,0x43560f) from tgetstr()   [termcap.c] <-- My guess
	Maybe strcpy() from gcc_compiled.()
tgetstr()   [termcap.c]
init_terminal_io()   [readline.c:1799]
readline_initialize_everything()   [readline.c:1000]
rl_initialize()   [readline.c:952]
readline()   [readline.c:258]
command_line_input(prompt=(gdb) ,repeat=1)   [main.c:850]
command_loop()   [main.c:509]
main(argc=1,argv=0x7ffffdb0,envp=0x7ffffdb8)   [main.c:436]
* q
$

--
Ronald Cole               | uucp:     cvms!ronald       voice: +1 916 895 8321
Senior Software Engineer  | internet: csusac!cvms!ronald@ucdavis.edu
CVM Systems               +----------------------------------------------------
                 Excellent time to become a missing person.