>>>>> "Kevin" == Kevin André <hyperquan...@gmail.com> writes:

Pierre> I would like user of the plugin to give in arguments the name of
Pierre> the functions on which he would like a test to be run. That
Pierre> means that I must convert the string containing a function name
Pierre> (like "myclass::init") and get either the mangled name or the
Pierre> tree corresponding to the function. I know that there might be
Pierre> several results (functions with the same name and different
Pierre> arguments), a good policy for me would be to recover every
Pierre> concerned functions (at least for the moment).

Pierre> I guess what I want to do is possible, because there are already
Pierre> some tools doing it (like gdb).

Kevin> Are you absolutely sure about gdb? It could be doing it the other way
Kevin> around, i.e. start from the mangled names in the object file and
Kevin> demangle all of them. Then it would search for a function name in its
Kevin> list of demangled names.
Kevin> Just guessing, though :)

GDB has to be able to canonicalize a name in order to look in up in the
symbol table.  At least, that is true given the current implementation
of GDB's symbol tables.

So, GDB has a parser for C++ names that breaks the names up and then
reconstructs them in a canonical form.  See cp-name-parser.y.

GDB does not perform mangling.  As far as I know, nothing outside of g++
does.

The demangle-and-compare approach is more complicated than you might
think.  E.g., should it work if the user uses the name of a typedef?

Tom

Reply via email to