From: Daniel Berlin <dberlin@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: C++ mangling patch that is about to be committed
Date: Tue, 10 Oct 2000 07:20:00 -0000 [thread overview]
Message-ID: <m38zrw4w2p.fsf@dan2.cygnus.com> (raw)
I'm committing the following patch later today.
I'm also going to start moving these types of C++ specific routines
into cp-support.c and cp-support.h, rather than spread across 20
files, so it's clearer that they are C++ specific, and fall under the
maintainership of the C++ maintainer. It'll also give other
maintainers less they feel they have to worry about, since they really
shouldn't have to deal with things like gdb_mangle_name.
* symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
* symtab.c (gdb_mangle_name): Properly handle operators.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.15
diff -c -3 -p -w -B -b -r1.15 symtab.c
*** symtab.c 2000/09/04 08:29:25 1.15
--- symtab.c 2000/09/12 16:03:08
*************** gdb_mangle_name (struct type *type, int
*** 296,301 ****
--- 303,311 ----
char buf[20];
int len = (newname == NULL ? 0 : strlen (newname));
+ if (OPNAME_PREFIX_P (field_name))
+ return physname;
+
is_full_physname_constructor =
((physname[0] == '_' && physname[1] == '_' &&
(isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
*************** gdb_mangle_name (struct type *type, int
*** 331,355 ****
sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
}
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
! + strlen (buf) + len
! + strlen (physname)
! + 1);
!
! /* Only needed for GNU-mangled names. ANSI-mangled names
! work with the normal mechanisms. */
! if (OPNAME_PREFIX_P (field_name))
! {
! const char *opname = cplus_mangle_opname (field_name + 3, 0);
! if (opname == NULL)
! error ("No mangling for \"%s\"", field_name);
! mangled_name_len += strlen (opname);
! mangled_name = (char *) xmalloc (mangled_name_len);
- strncpy (mangled_name, field_name, 3);
- mangled_name[3] = '\0';
- strcat (mangled_name, opname);
- }
- else
{
mangled_name = (char *) xmalloc (mangled_name_len);
if (is_constructor)
--- 341,348 ----
sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
}
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
! + strlen (buf) + len + strlen (physname) + 1);
{
mangled_name = (char *) xmalloc (mangled_name_len);
if (is_constructor)
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.13
diff -c -3 -p -r1.13 symtab.h
*** symtab.h 2000/08/07 15:02:48 1.13
--- symtab.h 2000/10/10 01:39:57
*************** extern CORE_ADDR symbol_overlayed_addres
*** 168,175 ****
specified obstack. */
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
! do { \ char *demangled = NULL; \
if (SYMBOL_LANGUAGE (symbol) == language_cplus \
|| SYMBOL_LANGUAGE (symbol) == language_auto) \
{ \--- 168,177 ----
specified obstack. */
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
! { \
char *demangled = NULL; \
+ if (SYMBOL_LANGUAGE (symbol) == language_unknown) \
+ SYMBOL_LANGUAGE(symbol) = language_auto; \
if (SYMBOL_LANGUAGE (symbol) == language_cplus \
|| SYMBOL_LANGUAGE (symbol) == language_auto) \
{ \*************** extern CORE_ADDR symbol_overlayed_addres
*** 222,232 ****
SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
} \
} \! if (SYMBOL_LANGUAGE (symbol) == language_auto) \
! { \! SYMBOL_LANGUAGE (symbol) = language_unknown; \
! } \! } while (0)
/* Macro that returns the demangled name for a symbol based on the language
for that symbol. If no demangled name exists, returns NULL. */
--- 224,230 ----
SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
} \
} \! }
/* Macro that returns the demangled name for a symbol based on the language
for that symbol. If no demangled name exists, returns NULL. */
*************** struct partial_symtab
*** 1047,1059 ****
#define VTBL_FNADDR_OFFSET 2
/* Macro that yields non-zero value iff NAME is the prefix for C++ operator
! names. If you leave out the parenthesis here you will lose!
! Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
! symbol-file and the names in gdb's symbol table.
! Note that this macro is g++ specific (FIXME). */
!
#define OPNAME_PREFIX_P(NAME) \
! ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
names. Note that this macro is g++ specific (FIXME).
--- 1045,1053 ----
#define VTBL_FNADDR_OFFSET 2
/* Macro that yields non-zero value iff NAME is the prefix for C++ operator
! names. If you leave out the parenthesis here you will lose! */
#define OPNAME_PREFIX_P(NAME) \
! (!strncmp(NAME,"operator",8))
/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
names. Note that this macro is g++ specific (FIXME).
next reply other threads:[~2000-10-10 7:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-10 7:20 Daniel Berlin [this message]
2000-10-10 8:29 ` Elena Zannoni
[not found] ` <m3k8bgadxp.fsf@dan2.cygnus.com>
2000-10-10 10:38 ` Kevin Buettner
[not found] ` <m38zrwa832.fsf@dan2.cygnus.com>
2000-10-10 11:07 ` Daniel Berlin
2000-10-10 11:25 ` Michael Snyder
[not found] ` <m3zokc8p3c.fsf@dan2.cygnus.com>
2000-10-10 16:12 ` Elena Zannoni
2000-10-10 17:33 ` Daniel Berlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m38zrw4w2p.fsf@dan2.cygnus.com \
--to=dberlin@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox