home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky gnu.g++.help:1483 comp.lang.c++:16824
- Path: sparky!uunet!kithrup!hoptoad!brendan
- From: brendan@cygnus.com (Brendan Kehoe)
- Newsgroups: gnu.g++.help,comp.lang.c++
- Subject: Re: demangeling
- Message-ID: <39219@hoptoad.uucp>
- Date: 24 Nov 92 03:50:38 GMT
- References: <9211231128.AA20601@life.ai.mit.edu>
- Sender: news@hoptoad.uucp
- Reply-To: brendan@cygnus.com (Brendan Kehoe)
- Organization: Cygnus Support, Mountain View CA; Phone +1 415 903 1400
- Lines: 158
- Nntp-Posting-Host: cygnus.com
- In-reply-to: FLEINERC%CFRUNI51.BITNET@mitvma.mit.edu's message of 23 Nov 92 08:06:00 GMT
-
- In article <9211231128.AA20601@life.ai.mit.edu> FLEINERC%CFRUNI51.BITNET@mitvma.mit.edu writes:
-
- Does there exist a program to demangle names used by C++ ?
- it should accept for example
- __ct__7ostreamFv
- and print
- ostream::ostream()
-
- If not, is someone writting such a beast ?
-
- There is, in the libiberty directory of gdb-4.7. It might be a good
- thing to include in the 2.4 release of gcc/g++; we'll see.
-
- The next release of gdb will have a demangler that you can build
- easily (the stuff in 4.7 has some trouble); in the meantime, apply
- these diffs in the libiberty directory to be able to just do
-
- ../configure __whatever__
- make demangle
-
- and have it generate the program properly.
-
-
- *** Makefile.in.~1~ Thu Nov 19 03:12:13 1992
- --- Makefile.in Thu Nov 19 03:58:24 1992
- ***************
- *** 218,224 ****
- # Create a standalone demangler if so desired ("make demangle").
-
- ! demangle: ${srcdir}/${DEMANGLER}.c
- ! ${CC} -o $@ -DMAIN ${INTERNAL_CFLAGS} \
- ! `echo ${srcdir}/${DEMANGLER}.c | sed 's,^\./,,'`
-
- ls:
- --- 218,224 ----
- # Create a standalone demangler if so desired ("make demangle").
-
- ! demangle: ${srcdir}/cplus-dem.c
- ! $(CC) -o $@ -DMAIN $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) \
- ! `echo $^ | sed 's,^\./,,'`
-
- ls:
- *** cplus-dem.c.~1~ Tue Oct 6 11:18:33 1992
- --- cplus-dem.c Thu Nov 19 03:58:27 1992
- ***************
- *** 35,38 ****
- --- 35,41 ----
- #include <stdio.h>
-
- + extern char *xmalloc ();
- + extern char *xrealloc ();
- +
- /* In order to allow a single demangler executable to demangle strings
- using various common values of CPLUS_MARKER, as well as any specific
- *************** remember_type (work, start, len)
- *** 1720,1724 ****
- }
- }
- ! tem = (char *) xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- --- 1729,1733 ----
- }
- }
- ! tem = xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- *************** string_need (s, n)
- *** 2061,2065 ****
- n = 32;
- }
- ! s->p = s->b = (char *) xmalloc (n);
- s->e = s->b + n;
- }
- --- 2070,2074 ----
- n = 32;
- }
- ! s->p = s->b = xmalloc (n);
- s->e = s->b + n;
- }
- *************** string_need (s, n)
- *** 2069,2073 ****
- n += tem;
- n *= 2;
- ! s->b = (char *) xrealloc (s->b, n);
- s->p = s->b + tem;
- s->e = s->b + n;
- --- 2078,2082 ----
- n += tem;
- n *= 2;
- ! s->b = xrealloc (s->b, n);
- s->p = s->b + tem;
- s->e = s->b + n;
- *************** demangle_it (mangled_name)
- *** 2223,2233 ****
- }
-
- ! PTR
- xmalloc (size)
- long size;
- {
- ! PTR newmem;
-
- ! if ((newmem = malloc ((int) size)) == NULL)
- {
- fprintf (stderr, "\nCan't allocate %u bytes\n", size);
- --- 2232,2242 ----
- }
-
- ! char *
- xmalloc (size)
- long size;
- {
- ! char * newmem;
-
- ! if ((newmem = (char *) malloc ((int) size)) == NULL)
- {
- fprintf (stderr, "\nCan't allocate %u bytes\n", size);
- *************** xmalloc (size)
- *** 2237,2248 ****
- }
-
- ! PTR
- xrealloc (oldmem, size)
- ! PTR oldmem;
- long size;
- {
- ! PTR newmem;
-
- ! if ((newmem = realloc ((char *) oldmem, (int) size)) == NULL)
- {
- fprintf (stderr, "\nCan't reallocate %u bytes\n", size);
- --- 2246,2257 ----
- }
-
- ! char *
- xrealloc (oldmem, size)
- ! char * oldmem;
- long size;
- {
- ! char * newmem;
-
- ! if ((newmem = (char *) realloc ((char *) oldmem, (int) size)) == NULL)
- {
- fprintf (stderr, "\nCan't reallocate %u bytes\n", size);
- *************** main (argc, argv)
- *** 2307,2310 ****
- --- 2316,2321 ----
- }
- }
- +
- + exit (0);
- }
-
-
- --
- Brendan Kehoe brendan@cygnus.com
- Cygnus Support, Mountain View, CA +1 415 903 1400
-