🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #588

gdb-4.7 patches

#588
From: Dean R. E. Long
Date: Sat, 09 Jan 1993 17:51
214 lines
5325 bytes
These patches fix a number of demangling bugs related to templates.

dl

-------------
*** gdb/symtab.c.orig	Fri Oct  9 09:44:31 1992
--- gdb/symtab.c	Fri Jan  8 22:48:48 1993
***************
*** 2490,2501 ****
    int newsize;
    int i;
  
-   /* clip symbols that cannot match */
- 
-   if (!cplus_match (symname, text, text_len)) {
-     return;
-   }
- 
    /* matches mangled, may match unmangled.  now clip any symbol names
       that we've already considered.  (This is a time optimization)  */
  
--- 2490,2495 ----
***************
*** 2516,2521 ****
--- 2510,2521 ----
  
        symname = demangled;
      } else {
+       /* clip symbols that cannot match */
+ 
+       if (!cplus_match (symname, text, text_len)) {
+ 	return;
+       }
+ 
        symname = savestring (symname, strlen (symname));
      }
  
*** libiberty/cplus-dem.c.orig	Mon Oct  5 17:42:45 1992
--- libiberty/cplus-dem.c	Sun Jan 10 01:42:17 1993
***************
*** 276,285 ****
  static void
  forget_types PARAMS ((struct work_stuff *));
  
- #if 0
  static void
  string_prepends PARAMS ((string *, string *));
- #endif
  
  /*  Translate count to integer, consuming tokens in the process.
      Conversion terminates on the first non-digit character. */
--- 276,283 ----
***************
*** 669,675 ****
      }
    string_appendn (&tname, *mangled, r);
    string_appendn (&trawname, *mangled, r);
-   string_appendn (&trawname, "", 1);
    *mangled += r;
    string_append (&tname, "<");
    /* get size of template parameter list */
--- 667,672 ----
***************
*** 688,697 ****
  	{
  	  (*mangled)++;
  	  success = do_type (work, mangled, &temp);
- 	  string_appendn (&temp, "", 1);
  	  if (success)
  	    {
! 	      string_append (&tname, temp.b);
  	    }
  	  string_delete(&temp);
  	  if (!success)
--- 685,693 ----
  	{
  	  (*mangled)++;
  	  success = do_type (work, mangled, &temp);
  	  if (success)
  	    {
! 	      string_appends (&tname, temp);
  	    }
  	  string_delete(&temp);
  	  if (!success)
***************
*** 708,717 ****
  	  is_integral = 0;
  	  done = 0;
  	  success = do_type (work, mangled, &temp);
- 	  string_appendn (&temp, "", 1);
  	  if (success)
  	    {
! 	      string_append (&tname, temp.b);
  	    }
  	  string_delete(&temp);
  	  if (!success)
--- 704,712 ----
  	  is_integral = 0;
  	  done = 0;
  	  success = do_type (work, mangled, &temp);
  	  if (success)
  	    {
! 	      string_appends (&tname, temp);
  	    }
  	  string_delete(&temp);
  	  if (!success)
***************
*** 825,832 ****
      }
    if (work -> constructor || work -> destructor)
      {
!       string_append (&tname, trawname.b);
      }
    string_delete(&trawname);
    
    if (!success)
--- 820,833 ----
      }
    if (work -> constructor || work -> destructor)
      {
!       string_appends (&tname, trawname);
      }
+   {
+     char buf[16];
+     sprintf(buf, "%d", trawname.p - trawname.b);
+     string_prepend(&trawname, buf);
+     remember_type(work, trawname.b, trawname.p - trawname.b);
+   }
    string_delete(&trawname);
    
    if (!success)
***************
*** 835,841 ****
      }
    else
      {
!       string_prepend (declp, tname.b);
        string_delete (&tname);
        
        if (work -> static_type)
--- 836,842 ----
      }
    else
      {
!       string_prepends (declp, tname);
        string_delete (&tname);
        
        if (work -> static_type)
***************
*** 842,853 ****
  	{
  	  string_append (declp, *mangled + 1);
  	  *mangled += strlen (*mangled);
- 	  success = 1;
  	}
!       else
! 	{
! 	  success = demangle_args (work, mangled, declp);
! 	}
      }
    return (success);
  }
--- 843,850 ----
  	{
  	  string_append (declp, *mangled + 1);
  	  *mangled += strlen (*mangled);
  	}
!       success = 1;
      }
    return (success);
  }
***************
*** 993,1001 ****
  	  success = 0;
  	}
      }
!   else if ((scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 'Q')))
      {
!       /* A GNU style constructor starts with "__<digit>" or "__Q". */
        work -> constructor = 1;
        *mangled = scan + 2;
      }
--- 990,998 ----
  	  success = 0;
  	}
      }
!   else if ((scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 't')))
      {
!       /* A GNU style constructor starts with "__<digit>" or "__t". */
        work -> constructor = 1;
        *mangled = scan + 2;
      }
***************
*** 2164,2171 ****
      }
  }
  
- #if 0
- 
  static void
  string_prepends (p, s)
       string *p, *s;
--- 2161,2166 ----
***************
*** 2175,2182 ****
        string_prependn (p, s->b, s->p - s->b);
      }
  }
- 
- #endif
  
  static void
  string_prependn (p, s, n)
--- 2170,2175 ----
Technical Details
Message-ID: <199301100951.AA22739@oak.ucsc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cse.ucsc.EDU!dlong

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cse.ucsc.EDU!dlong
From: dlong@cse.ucsc.EDU (Dean R. E. Long)
Subject: gdb-4.7 patches
Message-ID: <199301100951.AA22739@oak.ucsc.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 9 Jan 1993 17:51:05 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 215