Thread View: gnu.g++.help
5 messages
5 total messages
Started by Barry A. Warsaw
Tue, 01 Sep 1992 19:53
Demangler available?
Author: Barry A. Warsaw
Date: Tue, 01 Sep 1992 19:53
Date: Tue, 01 Sep 1992 19:53
7 lines
588 bytes
588 bytes
Is there a name demangler available for g++, a la the `dem' tool for SunC++? I haven't quite gotten g++'s style down yet ;-). Perhaps there is a way in gdb? Thanks. -Barry
Re: Demangler available?
Author: Brendan Kehoe
Date: Wed, 02 Sep 1992 04:02
Date: Wed, 02 Sep 1992 04:02
25 lines
1427 bytes
1427 bytes
In article <WARSAW.92Sep1145341@anthem.nlm.nih.gov> warsaw@nlm.nih.gov (Barry A. Warsaw) writes:
Is there a name demangler available for g++, a la the `dem' tool for
SunC++?
Not yet, want to write it?
Check out the file cp-dem.c in the gcc 2.2.2 distribution; you could
easily write a program which just passes strings down into cplus_demangle().
I haven't quite gotten g++'s style down yet ;-). Perhaps
there is a way in gdb?
Yup, in gdb 4.6 you can do `maint demangle blah', where blah is the symbol
to demangle. For example:
(gdb) maint demangle _$_3foov
foo::~foo(void)
Brendan
--
Brendan Kehoe brendan@cygnus.com
Cygnus Support, Palo Alto, CA +1 415 322 3811
Oooh! A handsome stranger! And me, without my shoes on.
--The Princess, The Emperor's New Clothes
Re: Demangler available?
Author: Joe Buck
Date: Thu, 03 Sep 1992 00:57
Date: Thu, 03 Sep 1992 00:57
26 lines
1525 bytes
1525 bytes
In article <34720@hoptoad.uucp> brendan@cygnus.com writes: >In article <WARSAW.92Sep1145341@anthem.nlm.nih.gov> warsaw@nlm.nih.gov (Barry A. Warsaw) writes: > > Is there a name demangler available for g++, a la the `dem' tool for > SunC++? > >Not yet, want to write it? Um, Brendan, it's already done. >Check out the file cp-dem.c in the gcc 2.2.2 distribution; you could >easily write a program which just passes strings down into cplus_demangle(). There's one included with gdb-4.6. All you have to do is "make demangle" in the gdb subdirectory and it makes it. This program can either demangle command line arguments or demangle function names on the standard input, given one per line. It would be a bit more useful to have it work the way the old g++filt that used to be in the etc directory of libg++ worked (it could be used as a filter, for example to process nm output or gprof listings); perhaps I'll post a patch to restore this behavior. It's not hard. -- Joe Buck jbuck@ohm.berkeley.edu
Re: Demangler available?
Author: Joe Buck
Date: Thu, 03 Sep 1992 01:01
Date: Thu, 03 Sep 1992 01:01
26 lines
1480 bytes
1480 bytes
In article <34720@hoptoad.uucp> brendan@cygnus.com writes: >In article <WARSAW.92Sep1145341@anthem.nlm.nih.gov> warsaw@nlm.nih.gov (Barry A. Warsaw) writes: > > Is there a name demangler available for g++, a la the `dem' tool for > SunC++? > >Not yet, want to write it? It's already been done. >Check out the file cp-dem.c in the gcc 2.2.2 distribution; you could >easily write a program which just passes strings down into cplus_demangle(). There's one included with gdb-4.6. All you have to do is "make demangle" in the gdb subdirectory and it makes it. This program can either demangle command line arguments or demangle function names on the standard input, given one per line. It would be a bit more useful to have it work the way the old g++filt that used to be in the etc directory of libg++ worked (it could be used as a filter, for example to process nm output or gprof listings); perhaps I'll post a patch to restore this behavior. It's not hard. -- Joe Buck jbuck@ohm.berkeley.edu
Re: Demangler available?
Author: Britt Levy (ESD)
Date: Thu, 03 Sep 1992 17:45
Date: Thu, 03 Sep 1992 17:45
139 lines
5213 bytes
5213 bytes
I created a simple interface to cp-dem.c, from the gcc-2.2.2 release,
called g++dem. It reads g++ mangled names from stdin and spits out the demangled
name to stdout. I also created an emacs function which demangles symbols
between point and mark in an emacs buffer and writes the results to a
separate buffer. The two source files g++dem.c and g++dem.el, and a
shell script used to make g++dem are include below in shar format. You can find
cp-dem.c in the gcc source distribution.
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# dem.mak
# g++dem.c
# g++dem.el
# This archive created: Thu Sep 3 12:41:21 1992
export PATH; PATH=/bin:$PATH
if test -f 'dem.mak'
then
echo shar: will not over-write existing file "'dem.mak'"
else
cat << \SHAR_EOF > 'dem.mak'
gcc -g -c cp-dem.c -Dxmalloc=malloc -Dxrealloc=realloc
gcc -g g++dem.c cp-dem.o -o g++dem
SHAR_EOF
chmod +x 'dem.mak'
fi # end of overwriting check
if test -f 'g++dem.c'
then
echo shar: will not over-write existing file "'g++dem.c'"
else
cat << \SHAR_EOF > 'g++dem.c'
/* Trivial interface to cp-dem() demangler for GNU C++ from gcc 2.2.2
Copyright 1989, 1991 Free Software Foundation, Inc.
written by Britt Levy (blevy@esd.dl.nec.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
extern char *cplus_demangle (const char *name, int mode);
main()
{
char inbuf[256];
while(gets(inbuf) != (char *) 0)
printf("%s => %s\n",inbuf, cplus_demangle(inbuf,0));
exit(0);
}
SHAR_EOF
fi # end of overwriting check
if test -f 'g++dem.el'
then
echo shar: will not over-write existing file "'g++dem.el'"
else
cat << \SHAR_EOF > 'g++dem.el'
;; g++dem.el - Demangles g++ 2.2.2 symbols in current emacs buffer between
;; point and mark using an interface to cp-dem(), from gcc 2.2.2, in
;; an asynchronous subprocess.
;; Written by Britt Levy (email: blevy@esd.dl.nec.com)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's author (see below) or write to:
;;
;; The Free Software Foundation, Inc.
;; 675 Mass Ave.
;; Cambridge, MA 02139, USA.
;;
(defun g++dem nil
"Demangles g++ symbols between point and mark. Output is written to
buffer named `g++dem'."
(interactive)
(if (<= (mark) (point))
(exchange-point-and-mark)
)
(let ((process-connection-type nil)
(out-buf (get-buffer-create "g++dem"))
(end (mark))
g++dem-proc
symbol)
(setq g++dem-proc (start-process "g++dem" out-buf "g++dem" ))
(while (and (< (point) (mark))
(re-search-forward "[^ \\t]*" end t))
(setq symbol (read (current-buffer)))
(process-send-string g++dem-proc (format "%s\n" (symbol-name symbol)))
)
(process-send-eof g++dem-proc)
(switch-to-buffer-other-window out-buf)
)
)
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
--
------------------------------------------------------------------
Britt Levy, NEC AMERICA INC 1525 W WALNUT HILL LN
blevy@esd.dl.nec.com IRVING TX 75038-3793
Phone: (214) 518-3829
------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads