Re: break jmisc.main

David Carlton
2003-03-13T21:16:13Z

On Thu, 13 Mar 2003 15:56:39 -0500, Daniel Jacobowitz <drow@mvista.com> said:

> Do you know if this actually broke with my caching patch, or if it was
> broken before?

The dates that Michael gave for the regression make that quite likely.

> I checked, and nowhere in GDB do we ever set the demangling style to
> Java. Not that I could find, at least.

Right now, symbol_find_demangled_name says:

if (gsymbol->language == language_java)
{
demangled =
cplus_demangle (mangled,
DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);
if (demangled != NULL)
{
gsymbol->language = language_java;
return demangled;
}
}

There was a similar case in whatever it replaced.

> FYI, if you "set demangle-style java" and then "file ./jmisc", this
> test passes. I really don't know what we can do about it. My
> instincts tell me that we need to either:
> - not demangle at all until we know the language; doesn't help for
> stabs anyway

Is there any way for the minsym readers to guess the language based on
a file name, or something like that?

> - transform between the Java and C++ demanglings. Converting from the
> C++ output to the Java output looks doable, although exceedingly
> annoying:
> - different names for some types (bool vs boolean, char vs wchar_t)
> - All '*' characters are removed
> - JArray<TYPE> becomes TYPE[].
> (That's an exhaustive list.)
> Going the other way, Java -> C++, would probably be impossible
> because of the removed '*'s.

Getting that to work well doesn't sound much fun at all to me. If
there were a Java maintainer to help, I'd be willing to chip this in,
but I'd really rather now.

> - Re-demangle if we discover that the symbol is a Java symbol.
> Ewwwwww.

Ewwww indeed. As a temporary solution, though, we could modify
symbol_set_names and friends to use a different cache to store Java
demangled names. (Well, use the same cache, but if the current
symbol's language is Java then to lookup ##JAVA##demangled_name
instead of just demangled_name, or something like that.) The minsyms
will still have the wrong names, but that must always have been
broken. And it means that Java code won't be able to share memory
between names of partial symbols and names of minimal symbols; given
the absence of a Java maintainer, I don't care about that in the
slightest.

I'll think about this, but if there's no easy way to get a good guess
at the current language when building minimal symbol tables, I suppose
I'll reluctantly take a stab at the temporary solution.

David Carlton
carlton@math.stanford.edu