🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #71

gdb dumps core when reading GCC 2.1-produced symbol table

#71
From: Paul Eggert
Date: Fri, 10 Apr 1992 19:35
58 lines
2321 bytes
gdb dumps core when reading GCC 2.1-produced symbol table (sparc, SunOS 4.1.2).
I got this when trying to build InterViews.
Here's how to reproduce the bug.

    $ cat u.cc
    class ivResource   {
    public:
	ivResource  ();
	virtual ~ivResource  ();

	void ref() const;

	static void ref(const ivResource  *);

	void Reference() const { ref(); }
    };
    void ivResource::ref() const {}
    main() { return 0; }
    $ gcc -g u.cc
    $ gdb a.out
    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.4, Copyright 1991 Free Software Foundation, Inc...
    (gdb) b main
    Memory fault - core dumped

Apparently GCC isn't putting out the right kind of symbol table data.  I'll
submit a bug report (and patch) to bug-gcc about this GCC bug.  However, even
if GCC puts out bad data, GDB shouldn't dump core.

Here is a patch.  The old version of the code set TYPE_NAME (context) to 0,
but it is already guaranteed to be 0, so that assignment isn't necessary.

===================================================================
RCS file: buildsym.c,v
retrieving revision 4.4.1.1
retrieving revision 4.4.1.2
diff -c -r4.4.1.1 -r4.4.1.2
*** buildsym.c	1992/02/11 23:44:03	4.4.1.1
--- buildsym.c	1992/04/10 19:31:44	4.4.1.2
***************
*** 2071,2077 ****
  	      if (name == 0)
  		{
  		  complain (&invalid_cpp_type_complaint, symnum);
! 		  TYPE_NAME (context) = name;
  		}
  	      list->field.name = obconcat (prefix, name, "");
  	      p = ++(*pp);
--- 2071,2077 ----
  	      if (name == 0)
  		{
  		  complain (&invalid_cpp_type_complaint, symnum);
! 		  name = "unknown";
  		}
  	      list->field.name = obconcat (prefix, name, "");
  	      p = ++(*pp);
Technical Details
Message-ID: <9204101935.AA01857@farside.twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert
From: eggert@twinsun.COM (Paul Eggert)
Subject: gdb dumps core when reading GCC 2.1-produced symbol table
Message-ID: <9204101935.AA01857@farside.twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 10 Apr 1992 19:35:44 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 59