2004-07-06 Jeff Johnston <jjohnstn@redhat.com>
* language.h (struct_language_defn): Add new function pointer: la_class_name_from_physname. Also add new prototype for language_class_name_from_physname. * language.c (language_class_name_from_physname): New function. (unk_lang_class_name): Ditto. (unknown_language_defn, auto_language_defn): Change to add unk_lang_class_name function pointer for la_class_name_from_physname. (local_language_defn): Ditto. * dwarf2read.c (guess_structure_name): Change to call language_class_name_from_physname. (determine_class_name): Ditto. * cp-support.c (class_name_from_physname): Renamed. (cp_class_name_from_physname): New name of function. * cp-support.h: Ditto. * c-lang.c (c_language_defn): Change to add NULL for class_name_from_physname function pointer. (cplus_language_defn): Change to add cp_class_name_from_physname. * jv-lang.c (java_class_name_physname): New function. (java_find_last_component): New static routine. (java_language_defn): Add java_class_name_from_physname pointer. * ada-lang.c (ada_language_defn): Change to add NULL for class_name_from_physname function pointer. * f-lang.c (f_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * scm-lang.c (scm_language_defn): Ditto.
This commit is contained in:
parent
6e9114ad3d
commit
31c27f7773
14 changed files with 128 additions and 4 deletions
|
@ -62,6 +62,8 @@ static struct value *java_value_string (char *ptr, int len);
|
|||
|
||||
static void java_emit_char (int c, struct ui_file * stream, int quoter);
|
||||
|
||||
static char *java_class_name_from_physname (const char *physname);
|
||||
|
||||
/* This objfile contains symtabs that have been dynamically created
|
||||
to record dynamically loaded Java classes and dynamically
|
||||
compiled java methods. */
|
||||
|
@ -975,6 +977,59 @@ static char *java_demangle (const char *mangled, int options)
|
|||
return cplus_demangle (mangled, options | DMGL_JAVA);
|
||||
}
|
||||
|
||||
/* Find the member function name of the demangled name NAME. NAME
|
||||
must be a method name including arguments, in order to correctly
|
||||
locate the last component.
|
||||
|
||||
This function return a pointer to the first dot before the
|
||||
member function name, or NULL if the name was not of the
|
||||
expected form. */
|
||||
|
||||
static const char *
|
||||
java_find_last_component (const char *name)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
/* Find argument list. */
|
||||
p = strchr (name, '(');
|
||||
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Back up and find first dot prior to argument list. */
|
||||
while (p > name && *p != '.')
|
||||
p--;
|
||||
|
||||
if (p == name)
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Return the name of the class containing method PHYSNAME. */
|
||||
|
||||
static char *
|
||||
java_class_name_from_physname (const char *physname)
|
||||
{
|
||||
char *ret = NULL;
|
||||
const char *end;
|
||||
int depth = 0;
|
||||
char *demangled_name = java_demangle (physname, DMGL_PARAMS | DMGL_ANSI);
|
||||
|
||||
if (demangled_name == NULL)
|
||||
return NULL;
|
||||
|
||||
end = java_find_last_component (demangled_name);
|
||||
if (end != NULL)
|
||||
{
|
||||
ret = xmalloc (end - demangled_name + 1);
|
||||
memcpy (ret, demangled_name, end - demangled_name);
|
||||
ret[end - demangled_name] = '\0';
|
||||
}
|
||||
|
||||
xfree (demangled_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Table mapping opcodes into strings for printing operators
|
||||
and precedences of the operators. */
|
||||
|
@ -1049,6 +1104,7 @@ const struct language_defn java_language_defn =
|
|||
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
|
||||
basic_lookup_transparent_type,/* lookup_transparent_type */
|
||||
java_demangle, /* Language specific symbol demangler */
|
||||
java_class_name_from_physname,/* Language specific class name */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue