[gnu.gdb.bug] GDB 3.4 - Incompatibility with Sun's cc

tli%sargas.usc.edu@USC.EDU (Tony Li) (11/15/89)

Configuration: Sun 4/60 (Sparcstation 1), SunOS 4.0.3c, gdb 3.4, 
	gcc 1.36

Problem: gdb does not seem to treat binaries generated by SunOS cc the
	same as binaries from gcc.  

Reproduce by:  Compile the following program with both SunOS cc and
	gcc:
		main () {
			printf ("Hello world.\n");
		}

	Next, debug the resulting binaries, executing the following
	commands in each case:
	
		break main	
		run
		next

	For the gcc compiled binary, after giving the 'next' command,
	the printf executes and the next statement is the final line
	of the program.  For the SunOS cc compiled binary, giving the
	'next' command produces:

		(gdb) next
		0x4084 in etext ()

Tony

tiemann@LURCH.STANFORD.EDU (Michael Tiemann) (11/15/89)

   Date: Tue, 14 Nov 89 22:50:31 PST
   From: tli%sargas.usc.edu@usc.edu (Tony Li)


   Configuration: Sun 4/60 (Sparcstation 1), SunOS 4.0.3c, gdb 3.4, 
	   gcc 1.36

   Problem: gdb does not seem to treat binaries generated by SunOS cc the
	   same as binaries from gcc.  

   Reproduce by:  Compile the following program with both SunOS cc and
	   gcc:
		   main () {
			   printf ("Hello world.\n");
		   }

	   Next, debug the resulting binaries, executing the following
	   commands in each case:

		   break main	
		   run
		   next

	   For the gcc compiled binary, after giving the 'next' command,
	   the printf executes and the next statement is the final line
	   of the program.  For the SunOS cc compiled binary, giving the
	   'next' command produces:

		   (gdb) next
		   0x4084 in etext ()

   Tony

This problem has to do with dynamic linking, which GDB does not
understand.  Compile with -Bstatic using SunCC and then see what you
get.

Michael

tli%sargas.usc.edu@USC.EDU (Tony Li) (11/15/89)

Works like a charm.  Thank you very much.

Is there work underfoot to fix this?  Or at least document it?

Tony

kingdon@AI.MIT.EDU (Jim Kingdon) (11/16/89)

    Is there work underfoot to fix [lack of support for Sun shared
    libraries]?  

I have some code, but none really does the whole job (e.g. lets you
say "break printf").  I may merge it anyway, after we have a stable
GDB release, on the theory that it's better than nothing.  If anyone
wants to work on this, let me know.

    Or at least document it?

When GDB is installed, a message is printed warning about this
problem.