🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #374

(none)

#374
From: Peggy Fieland
Date: Thu, 13 Aug 1992 20:15
113 lines
3575 bytes
On a stratus i860, using gdb-4.6 and cfront, gdb does not correctly
demangle the name of the operator when printing an error message
when trying to set a breakpoint on an operator that is NOT a
member of a class.  

Here is a sample debugging session.  The program is listed as
part of the debugging session.

maestro-tests% /usr/c++/bin/CC -g -o class class.c
CC  class.c:
cc  -L/usr/c++/lib  -o class  -g class.c -Xt -lC
maestro-tests% /net/citron/home/citron/pfieland/gdb-4.6/gdb-4.6/gdb/gdbx class
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) list 1 30
Junk at end of line specification.
(gdb) list 1
1
2       class a {
3       private:
4           int data;
5       public:
(gdb)
6           a() { data =0; }
7           a(a & val) { data = val.data; }
8           a(int val) { data = val; }
9       };
10
11      void foo( a temp)
12      {
13          a b(temp);
14          a c=temp;
15      }
(gdb)
16
17      main()
18      {
19          a   one(3);
20
21          foo(one);
22          foo(2);
23      }
24
(gdb) ptype a
type = class a {
  private:
    int data;

  public:
    a ();
    a (struct a &);
    a (int);
}
(gdb) break a::operator()
warning: the class a does not have any method named __cl
Hint: try 'a::operator()<TAB> or 'a::operator()<ESC-?>
(Note leading single quote.)
(gdb)

Here is a fix:

*** /home/tools/gnu/gdb-4.6/gdb/symtab.h	Mon Jul  6 13:11:13 1992
--- gdb-4.6/gdb/symtab.h	Tue Aug  4 11:31:31 1992
***************
*** 539,544 ****
--- 540,549 ----
  
  #define VTBL_PREFIX_P(NAME) ((NAME)[3] == CPLUS_MARKER	\
  			     && !strncmp ((NAME), "_vt", 3))
+ #define CF_OPNAME_PREFIX_P(NAME) ((NAME)[0] == '_' && (NAME)[1] == '_')
+ #define CF_VTBL_PREFIX_P(NAME) (!strncmp((NAME), "__vtbl__", CF_VTBL_PREFIX_LEN))
+ #define CF_VTBL_PREFIX_LEN  8
+ 
  
  /* Functions that work on the objects described above */
  
*** /home/tools/gnu/gdb-4.6/gdb/symtab.c	Tue Jul 14 03:34:30 1992
--- gdb-4.6/gdb/symtab.c	Thu Aug 13 11:19:41 1992
***************
*** 1649,1655 ****
  	      else
  		{
  		  char *tmp;
! 
  		  if (OPNAME_PREFIX_P (copy))
  		    {
  		      tmp = (char *)alloca (strlen (copy+3) + 9);
--- 1683,1690 ----
  	      else
  		{
  		  char *tmp;
!             /* altered by Peggy Fieland (Margaret_Fieland@vos.stratus.com)
!                to account for cfront conventions */
  		  if (OPNAME_PREFIX_P (copy))
  		    {
  		      tmp = (char *)alloca (strlen (copy+3) + 9);
***************
*** 1656,1661 ****
--- 1691,1702 ----
  		      strcpy (tmp, "operator ");
  		      strcat (tmp, copy+3);
  		    }
+             else if (CF_OPNAME_PREFIX_P(copy))
+                {
+                   tmp = (char *)alloca (strlen (q) + 10);
+                   strcpy (tmp, "operator ");
+                   strcat (tmp, q);
+                }
  		  else
  		    tmp = copy;
  		  if (tmp[0] == '~')
Technical Details
Message-ID: <9208132015.AA15955@citron.sw.stratus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
From: pfieland@citron.sw.stratus.com (Peggy Fieland)
Subject: (none)
Message-ID: <9208132015.AA15955@citron.sw.stratus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 13 Aug 1992 20:15:15 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 114