This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa] delete macro SYMBOL_LINKAGE_NAME


David Carlton writes:
 > On Mon, 3 Feb 2003 13:30:24 -0500, Elena Zannoni <ezannoni@redhat.com> said:
 > > David Carlton writes:
 > 
 > >> This is the first part of my plan to clean up symbol accessors.  It
 > >> deletes the macro SYMBOL_LINKAGE_NAME: that macro is only used in
 > >> two places in one function, and is easy to replace by an equivalent
 > >> use of asm_demangle, SYMBOL_SOURCE_NAME, and SYMBOL_NAME.  Given
 > >> that I'd like to use the name SYMBOL_LINKAGE_NAME for something
 > >> else, I'd like to get rid of its current use.
 > 
 > > can you expand a bit?
 > 
 > As I posted in
 > <http://sources.redhat.com/ml/gdb/2003-01/msg00188.html>, I really

Whoops, another mail I overlooked. I just re-read it, yes, I think
your plan makes sense.


 > think that it's important to clean up GDB's use of various names.  I
 > want to make it as easy as possible for people to get at either the
 > source code names of symbols or the linkage names of symbols, and to
 > make it clear when they mean the one or the other.  For the linkage
 > names, the best macro name that I've come up with is
 > SYMBOL_LINKAGE_NAME: so a not-to-distant step in this process will be
 > to introduce a macro SYMBOL_LINKAGE_NAME whose definition is exactly
 > the same as the definition of SYMBOL_NAME, but with the extra semantic
 > benefit that users of that macro will promise that they've actually
 > thought about the situation and decided that they really want the
 > linkage name instead of the source code name.
 > 
 > But to do that, I have to get rid of the existing macro
 > SYMBOL_LINKAGE_NAME.  (Or else think up another name, but here getting
 > rid of the existing macro seems preferable.)
 > 
 > I'm certainly open to different names for these macros, if you'd
 > prefer something else.  (Though I do think that getting rid of the
 > current SYMBOL_LINKAGE_NAME wouldn't be a bad idea, given how little
 > it's used.)
 > 

The one I wasn't sure about was the SYMBOL_PRINT_NAME. But i haven't
thought through the whole issue.

 > >> if (symbol)
 > >> {
 > >> name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
 > >> -      if (do_demangle)
 > >> +      if (do_demangle || asm_demangle)
 > 
 > > why this change? I must be missing something.
 > 
 > >> name_temp = SYMBOL_SOURCE_NAME (symbol);
 > >> else
 > >> -	name_temp = SYMBOL_LINKAGE_NAME (symbol);
 > >> +	name_temp = SYMBOL_NAME (symbol);
 > >> }
 > 
 > > this one is ok.
 > 
 > The current SYMBOL_LINKAGE_NAME (that I'm getting rid of) is
 > equivalent, I think, to
 > 
 > asm_demangle ? SYMBOL_SOURCE_NAME : SYMBOL_NAME.
 > 
 > So the old code
 > 
 >   if (do_demangle)
 >     name_temp = SYMBOL_SOURCE_NAME (symbol);
 >   else
 >     name_temp = SYMBOL_LINKAGE_NAME (symbol);
 > 
 > becomes
 > 
 >   if (do_demangle)
 >     name_temp = SYMBOL_SOURCE_NAME (symbol);
 >   else
 >     {
 >       if (asm_demangle)

Ah, never mind, I did some quick grepping and I concluded, erroneously, that 
do_demangle == demangle, but that's not always the case.

yes, this is fine.

elena


 >         name_temp = SYMBOL_SOURCE_NAME (symbol);
 >       else
 >         name_temp = SYMBOL_NAME (symbol);
 >     }
 > 
 > And then I combined the first two if statements into an or statement.
 > 
 > David Carlton
 > carlton@math.stanford.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]