This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: C++/Java regressions
On Wed, Nov 26, 2003 at 05:21:43PM -0500, Ian Lance Taylor wrote:
> mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes:
>
> > ian> Yes, I think it should print A::bar without the const. I have the
> > ian> patch in my sources, but I haven't checked it in yet.
> >
> > But what about:
> >
> > class Foo
> > {
> > public:
> > int method ();
> > int method () const;
> > };
> >
> > If the name comes back as "Foo::method" then we have ambiguity
> > in gdb's output.
> >
> > I think the const looks ugly and the code that prints the function
> > name is also ugly. But I don't wanna print the same name for two
> > different methods.
>
> I have probably lost the context of the question. I am only talking
> about the case where DMGL_PARAMS is not passed. In that case, the
> demangler will indeed print `Foo::method' for both of your examples.
> For that matter, it will also print `Foo::method' for `int method
> (int);'.
>
> If DMGL_PARAMS is passed, then the demangler will print
> `Foo::method()' and `Foo::method() const' as usual.
>
> I think that is appropriate. Without DMGL_PARAMS, you can't
> distinguish any Foo::method overloaded based on parameter types. So
> it seems logical to me that you also shouldn't be able to distinguish
> overloading based on the method qualifier. And that is how the V2
> demangler behaved when DMGL_PARAMS was not passed.
>
> Does that make sense?
It does make sense, but I see Michael's concern. If you look at the
complete GDB output in this case, you get roughly:
Stopped at breakpoint 1, A::bar () for A::bar()
Stopped at breakpoint 1, A::bar () for A::bar() const
Stopped at breakpoint 1, A::bar (a = 1) for A::bar(int)
I still think the demangler should return A::bar. If we want GDB's
output to be unambiguous then GDB is the right place to print the
const. Without debug info we may not have it... but who really cares?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer