🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8905

gdb and Sun C++

#8905
From: Tony Olsson
Date: Fri, 17 Jul 1992 12:42
348 lines
17553 bytes
Hi,

I'm trying to use gdb version 4.6 to debug C++ code generated by Sun
C++ version 2.1. I'm using an Sun ELC with SunOS 4.1.2 generic kernel.

Please send a reply so I know that you have recieved my letter and if
it is a known problem, how can I proceed. Unfortunally I can not use
'gcc -x c++', I have to use Sun CC. This problem did not exist in gdb
4.0 but the support for C++ was not to good in gdb 4.0, I was hopping
to use gdb to debug C++ code.

-- Tony


<<< Tony Olsson, SoftLab ab	Phone : +46 13 21 24 70			>>>
<<< Teknikringen 14		Fax   : +46 13 21 33 14			>>>
<<< S-583 30 Linkoping		Email : tony@softlab.se			>>>
<<< SWEDEN			UUCP  : uunet!mcsun!seunet!heffa!tony	>>>

----------

Below is a sample of what causes gdb to core dump:

	tony@wolf(test8): cat > t.cc
	#include <stdio.h>
	 
	main()
	{
	  printf("Hello world\n");
	}
	tony@wolf(test8): CC t.cc -o t -g
	tony@wolf(test8): nm t
	000022d8 t -lg
	00004000 d __DYNAMIC
	000040c8 D ___LinkInHead
	00004100 D ___head
	000022d8 T ___start_libm
	00002290 t _crt1.o
	000022d8 t _crt2.o
	00004108 D _edata
	00004108 B _end
	000040a0 D _environ
	00002558 T _etext
	000022a8 T _main
	000022a4 T cg87_used
	00002020 t crt0.o
	000022e0 t head.o
	00002020 T start
	00002290 T start_float
	000022a8 t t.o
	tony@wolf(test8): gdb t
	GDB is free software and you are welcome to distribute copies of it
	 under certain conditions; type "show copying" to see the conditions.
	There is absolutely no warranty for GDB; type "show warranty" for details.
	GDB 4.6, Copyright 1992 Free Software Foundation, Inc...Segmentation fault (core dumped)
	tony@wolf(test8):

However when I run gcc with c++ option everything seems allright:

	tony@wolf(test8): gcc -x c++ t.cc -o t -g
	In file included from t.cc:1:
	/usr/local/lib/g++-include/stdio.h:54: warning: `#pragma once' is obsolete
	tony@wolf(test8): gcc -v
	Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.1/specs
	gcc version 2.1
	tony@wolf(test8): nm t
	00002448 t -lg
	00004000 d __DYNAMIC
	000022d0 t __GLOBAL_$D$xyzzy.cc
	000022d0 T __GLOBAL_$D$xyzzy.cc
	000022dc T __GLOBAL_$I$xyzzy.cc
	000022d0 t __GLOBAL_$I$xyzzy.cc
	000040d0 D ___1xyzzy__
	000040a8 D ___CTOR_LIST__
	0000000c ? ___CTOR_LIST__
	000040b8 D ___DTOR_LIST__
	00000000 ? ___DTOR_LIST__
	000040d8 B ___dli
	000040e0 B ___dlp
	00002398 T ___do_global_cleanup
	00002348 T ___do_global_init
	000022f0 T ___main
	000040c8 D ___main_reference
	000040d8 D _edata
	000040e8 B _end
	000040a0 D _environ
	000027cc T _etext
	00002324 T _exit
	00000000 ? _fini
	00000000 ? _init
	000022a0 T _main
	00002290 t cca08142.o
	00002020 t crt0.o
	00002290 t gcc2_compiled.
	00002290 t gcc2_compiled.
	000022f0 t gcc_compiled.
	000022d0 t gcc_compiled.
	000022f0 t gnulib3.o
	00002020 T start
	00002290 t t.o
	000022d0 t xyzzy.o
	tony@wolf(test8): gdb t
	GDB is free software and you are welcome to distribute copies of it
	 under certain conditions; type "show copying" to see the conditions.
	There is absolutely no warranty for GDB; type "show warranty" for details.
	GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
	(gdb) run
	Starting program: /home/heffa/projects/.disk1/N/usr/tony/test/newDOI/test8/t 
	Hello world
 
	Program exited normally.
	(gdb) q
	tony@wolf(test8):

I have compiled gdb distribution 4.6 as follows (it's quite large but
I want to give you as much information as possible, I do not send the
Makefiles because they are generated by 'configure sun4'):

	local@wolf(gdb-4.6): configure sun4
	Created "Makefile" in /usr/local/src/GNU/gdb-4.6
	local@wolf(gdb-4.6): make
	echo "# !Automatically generated from ./functions.def"\
	  "- DO NOT EDIT!" >needed2.awk
	grep '^DEFVAR(' < ./functions.def \
	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk
	grep '^DEFFUNC(' < ./functions.def \
	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk
	cc -c -g -I. -I./../include  ./dummy.c
	(cc  dummy.o  ) >errors 2>&1 || true
	rm -f a.out dummy.o
	echo "/* !Automatically generated from ./functions.def"\
	  "- DO NOT EDIT! */" >config.h
	awk -f needed2.awk <errors >>config.h
	cc -c -g -I. -I./../include  basename.c
	cc -c -g -I. -I./../include  getopt.c
	cc -c -g -I. -I./../include  getopt1.c
	cc -c -g -I. -I./../include  obstack.c
	cc -c -g -I. -I./../include  spaces.c
	cc -c -g -I. -I./../include  concat.c
	cc -c -g -I. -I./../include  fdmatch.c
	cc -c -g -I. -I./../include  argv.c
	cc -c -g -I. -I./../include  strerror.c
	cc -c -g -I. -I./../include  strsignal.c
	echo "# !Automatically generated from ./functions.def"\
	  "- DO NOT EDIT!" >needed.awk
	grep '^DEF(' < ./functions.def \
	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf \"\1\.o " }|' \
	    >>needed.awk
	awk -f needed.awk <errors >needed-list
	echo  >>needed-list
	cc -c -g -I. -I./../include  memmove.c
	cc -c -g -I. -I./../include  strtoul.c
	cc -c -g -I. -I./../include  alloca.c
	rm -rf libiberty.a
	ar qc libiberty.a \
	  basename.o getopt.o getopt1.o obstack.o spaces.o concat.o  fdmatch.o argv.o strerror.o strsignal.o memmove.o strtoul.o alloca.o
	ranlib libiberty.a
	cc -c -g -I. -I./../include -DHAVE_MMAP mcalloc.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mfree.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmalloc.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmcheck.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmemalign.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmstats.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmtrace.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mrealloc.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mvalloc.c
	cc -c -g -I. -I./../include -DHAVE_MMAP mmap-sup.c
	cc -c -g -I. -I./../include -DHAVE_MMAP attach.c
	cc -c -g -I. -I./../include -DHAVE_MMAP detach.c
	cc -c -g -I. -I./../include -DHAVE_MMAP keys.c
	cc -c -g -I. -I./../include -DHAVE_MMAP sbrk-sup.c
	rm -rf libmmalloc.a
	ar qc libmmalloc.a mcalloc.o mfree.o mmalloc.o mmcheck.o mmemalign.o mmstats.o  mmtrace.o mrealloc.o mvalloc.o mmap-sup.o attach.o detach.o  keys.o sbrk-sup.o
	ranlib libmmalloc.a
	cc -c -g   -I. -I. -I./../include  libbfd.c
	cc -c -g   -I. -I. -I./../include  opncls.c
	cc -c -g   -I. -I. -I./../include  bfd.c
	cc -c -g   -I. -I. -I./../include  archive.c
	cc -g -c   -I. -I. -I./../include  -DMINIMIZE=0 -DDEFAULT_VECTOR=sunos_big_vec targets.c
	cc -c -g   -I. -I. -I./../include  cache.c
	cc -c -g   -I. -I. -I./../include  archures.c
	cc -c -g   -I. -I. -I./../include  core.c
	cc -c -g   -I. -I. -I./../include  section.c
	cc -c -g   -I. -I. -I./../include  format.c
	cc -c -g   -I. -I. -I./../include  syms.c
	cc -c -g   -I. -I. -I./../include  reloc.c
	cc -c -g   -I. -I. -I./../include  init.c
	cc -c -g   -I. -I. -I./../include  ctor.c
	cc -c -g   -I. -I. -I./../include  seclet.c
	cc -c -g   -I. -I. -I./../include  oasys.c
	cc -c -g   -I. -I. -I./../include  ieee.c
	cc -c -g   -I. -I. -I./../include  srec.c
	cc -c -g   -I. -I. -I./../include  elf.c
	cc -c -g   -I. -I. -I./../include  stab-syms.c
	cc -c -g   -I. -I. -I./../include  aout64.c
	cc -c -g   -I. -I. -I./../include  aout32.c
	cc -c -g   -I. -I. -I./../include  demo64.c
	cc -c -g   -I. -I. -I./../include  sunos.c
	cc -c -g   -I. -I. -I./../include  newsos3.c
	cc -c -g   -I. -I. -I./../include  i386aout.c
	cc -c -g   -I. -I. -I./../include  bout.c
	cc -c -g   -I. -I. -I./../include  coff-i960.c
	cc -c -g   -I. -I. -I./../include  coff-a29k.c
	cc -c -g   -I. -I. -I./../include  coff-m68k.c
	cc -c -g   -I. -I. -I./../include  coff-i386.c
	cc -c -g   -I. -I. -I./../include  coff-m88k.c
	cc -c -g   -I. -I. -I./../include  coff-mips.c
	cc -c -g   -I. -I. -I./../include  coff-rs6000.c
	cc -c -g   -I. -I. -I./../include  coff-h8300.c
	cc -c -g   -I. -I. -I./../include  coff-msym.c
	cc -c -g   -I. -I. -I./../include  hppa.c
	cc -c -g   -I. -I. -I./../include  i386linux.c
	cc -c -g   -I. -I. -I./../include  cpu-h8300.c
	cc -c -g   -I. -I. -I./../include  cpu-i960.c
	cc -c -g   -I. -I. -I./../include  cpu-sparc.c
	cc -c -g   -I. -I. -I./../include  cpu-m68k.c
	cc -c -g   -I. -I. -I./../include  cpu-m88k.c
	cc -c -g   -I. -I. -I./../include  cpu-vax.c
	cc -c -g   -I. -I. -I./../include  cpu-mips.c
	cc -c -g   -I. -I. -I./../include  cpu-a29k.c
	cc -c -g   -I. -I. -I./../include  cpu-i386.c
	cc -c -g   -I. -I. -I./../include  cpu-rs6000.c
	cc -c -g   -I. -I. -I./../include  cpu-hppa.c
	rm -f libbfd.a
	ar qc libbfd.a libbfd.o opncls.o bfd.o archive.o targets.o cache.o  archures.o core.o section.o format.o syms.o reloc.o init.o ctor.o seclet.o oasys.o ieee.o srec.o elf.o stab-syms.o aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o  coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o  coff-mips.o coff-rs6000.o coff-h8300.o coff-msym.o hppa.o i386linux.o cpu-h8300.o cpu-i960.o cpu-sparc.o cpu-m68k.o cpu-m88k.o  cpu-vax.o cpu-mips.o cpu-a29k.o cpu-i386.o cpu-rs6000.o cpu-hppa.o  
	ranlib libbfd.a
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE readline.c
	"readline.c", line 3885: warning: illegal combination of pointer and integer, op =
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE history.c
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE funmap.c
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE keymaps.c
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE ./../glob/tilde.c
	cc -c -g    -I. -I./../  -DVOID_SIGHANDLER -DVI_MODE vi_mode.c
	rm -f libreadline.a
	ar qc libreadline.a readline.o history.o funmap.o keymaps.o tilde.o vi_mode.o
	ranlib libreadline.a
	Glob doesn't make yet, but readline uses a piece of its src
	cc -c -g      -I. -I. -I./../include -I./../readline  main.c
	cc -c -g      -I. -I. -I./../include -I./../readline  blockframe.c
	cc -c -g      -I. -I. -I./../include -I./../readline  breakpoint.c
	cc -c -g      -I. -I. -I./../include -I./../readline  findvar.c
	cc -c -g      -I. -I. -I./../include -I./../readline  stack.c
	cc -c -g      -I. -I. -I./../include -I./../readline  source.c
	cc -c -g      -I. -I. -I./../include -I./../readline  values.c
	cc -c -g      -I. -I. -I./../include -I./../readline  eval.c
	cc -c -g      -I. -I. -I./../include -I./../readline  valops.c
	cc -c -g      -I. -I. -I./../include -I./../readline  valarith.c
	cc -c -g      -I. -I. -I./../include -I./../readline  valprint.c
	cc -c -g      -I. -I. -I./../include -I./../readline  printcmd.c
	cc -c -g      -I. -I. -I./../include -I./../readline  symtab.c
	cc -c -g      -I. -I. -I./../include -I./../readline  symfile.c
	cc -c -g      -I. -I. -I./../include -I./../readline  symmisc.c
	cc -c -g      -I. -I. -I./../include -I./../readline  infcmd.c
	cc -c -g      -I. -I. -I./../include -I./../readline  infrun.c
	cc -c -g      -I. -I. -I./../include -I./../readline  remote.c
	cc -c -g      -I. -I. -I./../include -I./../readline  command.c
	cc -c -g      -I. -I. -I./../include -I./../readline  utils.c
	cc -c -g      -I. -I. -I./../include -I./../readline  expprint.c
	cc -c -g      -I. -I. -I./../include -I./../readline  environ.c
	echo 'char *version = "4.6";' >version.c
	cc -c -g      -I. -I. -I./../include -I./../readline  version.c
	cc -c -g      -I. -I. -I./../include -I./../readline  gdbtypes.c
	cc -c -g      -I. -I. -I./../include -I./../readline  copying.c
	cc -c -g      -I. -I. -I./../include -I./../readline  exec.c
	cc -c -g      -I. -I. -I./../include -I./../readline  sparc-tdep.c
	cc -c -g      -I. -I. -I./../include -I./../readline  sparc-pinsn.c
	cc -c -g      -I. -I. -I./../include -I./../readline  solib.c
	cc -c -g      -I. -I. -I./../include -I./../readline  infptrace.c
	cc -c -g      -I. -I. -I./../include -I./../readline  sparc-xdep.c
	cc -c -g      -I. -I. -I./../include -I./../readline  ser-termios.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -DDEMANGLING_STYLE="gnu" \
	  `echo ./cplus-dem.c | sed 's,^\./,,'`
	cc -c -g      -I. -I. -I./../include -I./../readline  mem-break.c
	cc -c -g      -I. -I. -I./../include -I./../readline  target.c
	cc -c -g      -I. -I. -I./../include -I./../readline  inftarg.c
	cc -c -g      -I. -I. -I./../include -I./../readline  ieee-float.c
	cc -c -g      -I. -I. -I./../include -I./../readline  putenv.c
	cc -c -g      -I. -I. -I./../include -I./../readline  parse.c
	cc -c -g      -I. -I. -I./../include -I./../readline  language.c
	cc -c -g      -I. -I. -I./../include -I./../readline  c-exp.tab.c
	cc -c -g      -I. -I. -I./../include -I./../readline  m2-exp.tab.c
	cc -c -g      -I. -I. -I./../include -I./../readline  buildsym.c
	cc -c -g      -I. -I. -I./../include -I./../readline  objfiles.c
	cc -c -g      -I. -I. -I./../include -I./../readline  minsyms.c
	cc -c -g      -I. -I. -I./../include -I./../readline  maint.c
	cc -c -g      -I. -I. -I./../include -I./../readline  demangle.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./dbxread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./coffread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./elfread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./dwarfread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./xcoffread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./mipsread.c
	cc -c -g      -I. -I. -I./../include -I./../readline  core.c
	cc -c -g      -I. -I. -I./../include -I./../readline  inflow.c
	./munch  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 symfile.o symmisc.o infcmd.o infrun.o remote.o  command.o utils.o expprint.o environ.o version.o gdbtypes.o  copying..o exec.o sparc-tdep.o sparc-pinsn.o solib.o infptrace.o sparc-xdep.o ser-termios.o cplus-dem.o mem-break.o target.o  inftarg.o ieee-float.o putenv.o parse.o language.o c-exp.tab.o m2-exp.tab.o  buildsym.o objfiles.o minsyms.o maint.o demangle.o  dbxread.
o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o core.o inflow.o > init.c
	cc -c -g      -I. -I. -I./../include -I./../readline  init.c
	cc    -o gdb \
	  init.o 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 symfile.o symmisc.o infcmd.o infrun.o remote.o  command.o utils.o expprint.o environ.o version.o gdbtypes.o  copying..o exec.o sparc-tdep.o sparc-pinsn.o solib.o infptrace.o sparc-xdep.o ser-termios.o cplus-dem.o mem-break.o target.o  inftarg.o ieee-float.o putenv.o parse.o language.o c-exp.tab.o m2-exp.tab.o  buildsym.o objfiles.o minsyms.o maint.o demangle.o  dbxread.
o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o core.o inflow.o     ./../bfd/libbfd.a  ./../readline/libreadline.a -ltermcap ./../mmalloc/libmmalloc.a ./../libiberty/libiberty.a    
	make subdir_do DO=all "DODIRS=doc"
	local@wolf(gdb-4.6): make install
	for i in /usr/local  /usr/local  /usr/local/bin  /usr/local/lib  /usr/local/lib  /usr/local/include  /usr/local/lib  /usr/local/lib/doc  /usr/local/man  /usr/local/man/man1  /usr/local/man/man5 ; do \
	        echo Making $i... ; \
	        if [ ! -d $i ] ; then \
	                if mkdir $i ; then \
	                        true ; \
	                else \
	                        exit 1 ; \
	                fi ; \
	        else \
	                true ; \
	        fi ; \
	done
	Making /usr/local...
	Making /usr/local...
	Making /usr/local/bin...
	Making /usr/local/lib...
	Making /usr/local/lib...
	Making /usr/local/include...
	Making /usr/local/lib...
	Making /usr/local/lib/doc...
	Making /usr/local/man...
	Making /usr/local/man/man1...
	Making /usr/local/man/man5...
	install -c libmmalloc.a /usr/local/lib/libmmalloc.a.n
	ranlib /usr/local/lib/libmmalloc.a.n
	mv -f /usr/local/lib/libmmalloc.a.n /usr/local/lib/libmmalloc.a
	install -c libiberty.a /usr/local/lib/libiberty.a.n
	ranlib /usr/local/lib/libiberty.a.n
	mv -f /usr/local/lib/libiberty.a.n /usr/local/lib/libiberty.a
	install -c libbfd.a /usr/local/lib/libbfd.a
	ranlib /usr/local/lib/libbfd.a
	install -c ./../include/bfd.h /usr/local/include/bfd.h
	[ -z "" ] || install -c ./../include/bfd.h /bfd.h
	install -c libreadline.a /usr/local/lib/libreadline.a
	ranlib /usr/local/lib/libreadline.a
	[ -d /usr/local/include/readline ] || mkdir /usr/local/include/readline
	install -c ./readline.h /usr/local/include/readline/readline.h
	install -c ./keymaps.h /usr/local/include/readline/keymaps.h
	install -c ./chardefs.h /usr/local/include/readline/chardefs.h
	install -c gdb /usr/local/bin/gdb
	install -c ./gdb.1 /usr/local/man/man1/gdb.1
	make subdir_do DO=install "DODIRS=doc"
	install -c ./configure.man /usr/local/man/man1/configure.1
	local@wolf(gdb-4.6): 
Technical Details
Message-ID: <9207170842.AA06426@softlab.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!softlab.SE!tony

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,42098d2dbf83f689,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-07-17 19:32:28 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!softlab.SE!tony
From: tony@softlab.SE (Tony Olsson)
Subject: gdb and Sun C++
Message-ID: <9207170842.AA06426@softlab.se>
Sender: gnulists@ai.mit.edu
Reply-To: tony@softlab.se
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 17 Jul 1992 12:42:00 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 347