A pair of underscores "__" inside a function name let the libiberty
demangler fail. The problem is roughly at cplus-dem.c:2169 when it
tries to find the signature which begin with "__": My first thought
was to search backward from the end instead. But what about types
names in the signature with a pair of underscores? It just can't
figure out where the signature _really_ starts if not doing something
very complicated like doing backtracking after a failed parse.

BTW: Is it common sense not to use a pair of underscores in function
names? Or is it only me trying to use such function names?

Additionaly struct work_stuff *WORK is not cleaned up properly after
failure. So libiberty ends up with a core-dump (or exactly gdb or
suchalike). Here is a patch which fixes this problem:

--- gdb-4.18-vanilla/libiberty/cplus-dem.c      Thu Apr  1 22:37:06 1999
+++ gdb-4.18/libiberty/cplus-dem.c      Sat Apr 22 18:45:55 2000
@@ -3,6 +3,7 @@
    Written by James Clark ([EMAIL PROTECTED])
    Rewritten by Fred Fish ([EMAIL PROTECTED]) for ARM and Lucid demangling
    Modified by Satish Pai ([EMAIL PROTECTED]) for HP demangling
+   Minor bug fixes by Matthias Riese ([EMAIL PROTECTED])
 
 This file is part of the libiberty library.
 Libiberty is free software; you can redistribute it and/or
@@ -856,10 +857,12 @@
   if (work -> btypevec != NULL)
     {
       free ((char *) work -> btypevec);
+      work -> bsize = 0;
     }
   if (work -> ktypevec != NULL)
     {
       free ((char *) work -> ktypevec);
+      work -> ksize = 0;
     }
 }
 
@@ -880,6 +883,7 @@
     {
       free ((char *) work -> typevec);
       work -> typevec = NULL;
+      work -> typevec_size = 0;
     }
   if (work->tmpl_argvec)
     {


Best Regards
Matthias Riese

Reply via email to