[RFA]: Make class_name_from_physname part of language vector

Jeff Johnston jjohnstn@redhat.com
Mon Jul 5 20:21:00 GMT 2004


> On Fri, May 14, 2004 at 07:37:31PM -0400, Jeff Johnston wrote:
>> Index: jv-lang.c
> 
>> +  /* P now points at the `)' at the end of the argument list.  Walk
>> +     back to the beginning.  */
>> +  p--;
>> +  depth = 1;
>> +  while (p > name && depth > 0)
>> +    {
>> +      if (*p == '<' || *p == '(')
>> +	depth--;
>> +      else if (*p == '>' || *p == ')')
>> +	depth++;
>> +      p--;
>> +    }
>> +
>> +  if (p == name)
>> +    return NULL;
>> +
>> +  while (p > name && *p != '.')
>> +    p--;
> 
> You've left in a lot of hokery from the C++ support which I'm
> reasonably confident Java does not need.  I don't believe that Java
> mangled names will ever have templates, or classes nested inside of
> functions, or multiple argument lists - no depth at all.  Also, I'd
> appreciate it if you called it something other than
> find_last_component; the C++ version shouldn't have such a generic name
> either, IMO.
> 
> Otherwise this looks fine.
> 
> -- 
> Daniel Jacobowitz
> 
> 

I have made the changes you recommended.  The function now only looks for the 
opening parenthesis.  I renamed it to "find_member_function_name" as well.

Ok to commit?

  2004-07-05  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.
     (find_member_function_name): 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.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: class_name.patch2
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040705/15d623d6/attachment.ksh>


More information about the Gdb-patches mailing list