🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #361

(none)

#361
From: Peggy Fieland
Date: Wed, 12 Aug 1992 19:32
92 lines
2333 bytes
Gdb-4.6 fails to properly demangle member functions whose names end
in an underscore.  The problem occurred on both a Sun Sparc and
Stratus FTX (i860).

Here is the test program

  class complex
      {
      double r;
      double i;
      public:
              complex(){};
              complex(double x,double y); 
          long funny_name_ (long l);

      };

long complex::funny_name_ (long l)
{
 return l;
}

 complex::complex(double x, double y)
{
r=x; 
i=y;

}
long plus (long l, long m)
{
 return (l + m);
}

main()
{

complex cc;

}

Here is the gdb session: 
cyclonic-tests% gdb46 cx
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) set demangle-style cfront
(gdb) info functions
All defined functions:

File complex.c:
struct complex *complex::complex(double, complex);
int funny_name___7complexFl();
int main();
int plus(long, long);

Here is the fix:


*** /home/tools/gnu/gdb-4.6/gdb/cplus-dem.c	Tue Jul 14 03:34:20 1992
--- cplus-dem.c	Mon Aug 10 09:58:32 1992
*** 894,901 ****
--- 903,920 ----
  {
    int success = 1;
    const char *scan;
+   int i;
+   
  
    scan = strstr (*mangled, "__");
+ /* Peggy Fieland. Some function names end in _s. */
+   if (scan != NULL)
+      {
+         i = strspn (scan, "_");  /* get number of _s */
+         if (i > 2)
+            scan += (i - 2); 
+      }
+  
    if (scan == NULL)
      {
        if (current_demangling_style == auto_demangling ||
***************
*** 908,913 ****
--- 927,933 ----
  	  success = 0;
  	}
      }
+ 
    else if (work -> static_type)
      {
        if (!isdigit (scan[0]) && (scan[0] != 't'))
***************
Technical Details
Message-ID: <9208121932.AA10282@cyclonic.sw.stratus.com.sw.stratus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cyclonic.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!cyclonic.sw.stratus.com!pfieland
From: pfieland@cyclonic.sw.stratus.com (Peggy Fieland)
Subject: (none)
Message-ID: <9208121932.AA10282@cyclonic.sw.stratus.com.sw.stratus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 12 Aug 1992 19:32:10 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 93