Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Elena Zannoni <ezannoni@cygnus.com>
To: Daniel Berlin <dberlin@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH]: C++ mangling patch that is about to be committed
Date: Tue, 10 Oct 2000 08:29:00 -0000	[thread overview]
Message-ID: <14819.13803.331153.108644@kwikemart.cygnus.com> (raw)
In-Reply-To: <m38zrw4w2p.fsf@dan2.cygnus.com>

Daniel, 

There is an extra change in symtab.h that has nothing to do with the
changelog. I think that is part of a different patch.  BTW, I thought
we agreed to leave the do--while construct in the
SYMBOL_INIT_DEMANGLED_NAME macro.

Elena


Daniel Berlin writes:
 > 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).             
 > 
From dberlin@redhat.com Tue Oct 10 08:55:00 2000
From: Daniel Berlin <dberlin@redhat.com>
To: Elena Zannoni <ezannoni@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH]: C++ mangling patch that is about to be committed
Date: Tue, 10 Oct 2000 08:55:00 -0000
Message-id: <m3k8bgadxp.fsf@dan2.cygnus.com>
References: <m38zrw4w2p.fsf@dan2.cygnus.com> <14819.13803.331153.108644@kwikemart.cygnus.com>
X-SW-Source: 2000-10/msg00040.html
Content-length: 7434

Elena Zannoni <ezannoni@cygnus.com> writes:

> Daniel, 
> 
> There is an extra change in symtab.h that has nothing to do with the
> changelog. I think that is part of a different patch.  
No, I missed the changelog entry for it, stupidly.

> BTW, I thought
> we agreed to leave the do--while construct in the
> SYMBOL_INIT_DEMANGLED_NAME macro.
I'd rather not.
It's not used in if statements, and *never* should be.
The argument that someone, someday, might want to, just isn't
convincing, because they shouldn't.

> 
> Elena
> 
> Daniel Berlin writes:
>  > 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).             
>  > 


  reply	other threads:[~2000-10-10  8:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-10  7:20 Daniel Berlin
2000-10-10  8:29 ` Elena Zannoni [this message]
     [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=14819.13803.331153.108644@kwikemart.cygnus.com \
    --to=ezannoni@cygnus.com \
    --cc=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