dwarf2_physname patchset:
authorKeith Seitz <keiths@redhat.com>
Tue, 9 Mar 2010 18:09:08 +0000 (18:09 +0000)
committerKeith Seitz <keiths@redhat.com>
Tue, 9 Mar 2010 18:09:08 +0000 (18:09 +0000)
Based on work from Daniel Jacobowitz  <dan@codesourcery.com>
* c-typeprint.c (cp_type_print_method_args): For non-static methods,
print out const or volatile qualifiers, too.
(c_type_print_args): Add parameters show_artificial and language.
Skip artificial parameters when requested.
Use the appropriate language printer.
(c_type_print_varspec): Tell c_type_print_args to skip artificial
parameters and pass language_c.
* dwarf2read.c (die_list): New file global.
(struct partial_die_info): Update comments for name field.
(pdi_needs_namespace): Renamed to ...
(die_needs_namespace): ... this. Rewrite.
(dwarf2_linkage_name): Remove.
(add_partial_symbol): Do not predicate the call to
partial_die_full_name based on pdi_needs_namespace.
Remove call to cp_check_possible_namespace_symbols and associated
outdated comments.
(guess_structure_name): Do not inspect child subprogram DIEs.
(dwarf2_fullname): Update comments.
Use die_needs_namespace to assist in computing the name.
(read_func_scope): Use dwarf2_name to get the DIE's name.
Use dwarf2_physname to get the "linkage name" of the DIE.
(dwarf2_add_member_field): Use dwarf2_physname instead of
dwarf2_linkage_name.
(read_structure_type): For structs and classes, set TYPE_NAME, too.
(determine_class): Remove.
(read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages
except Ada.
(new_symbol): Unconditionally call dwarf2_name.
Compute the "linkage name" using dwarf2_physname.
Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs.
When determining to scan for anonymous C++ namespaces, ignore
the linkage name.
(dwarf2_physname): New function.
(dwarf2_full_name): Move content to new function and call
that.
(dwarf2_compute_name): "New" function.
(_initialize_dwarf2_read): Initialize die_list.
* gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable
physname.
(gnu_v3_print_method_ptr): Use the physname for virtual methods
without a demangled name.
Print out type information for non-virtual methods.
        * linespec.c (decode_line_1): Force ANY string using "::" (or
"." for java) to use decode_compound, and clean up any stray quoting.
        If we found a file symtab, re-evaluate whether the remainder is_quoted.
        (decode_compound): Stop consuming at an open parenthesis.
        Keep template parameters.
        Keep any overload information.
        Keep keywords like "const".
        Remove paren_pointer.
        Move is_quoted check from set_flags to here.
        Remove #if 0 code from 2000. Ten years is long enough.
        (find_method): Before comparing symbol names, canonicalize the string
        from the user.
        If a specific overload is requested, find it. Otherwise throw an error.
(find_method_overload_end): New function.
(set_flags): Remove.
        (decode_compound): Assume that parentheses are matched.
        It's a lot easier.
* symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag
to cplus_demangle.
* linespec.c (decode_line_1): Keep important keywords like
"const" and "volatile".
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove.
* typeprint.h (c_type_print_args): Add declaration.
* ui-file.c (do_ui_file_obsavestring): New function.
(ui_file_obsavestring): New function.
* ui-file.h (ui_file_obsavestring): Add declaration.
* valops.c (find_overload_match): Resolve the object to
a non-pointer type.
If the object is a data member, search the object for the member
and return with staticp set.
Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME.
Do not attempt to extract a function name from non-function types.
If the extracted function name and the original name are the same,
we don't have a C++ method.

From Jan Kratochvil  <jan.kratochvil@redhat.com>:
     * dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name.

* ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters
and arguments from symbol lookups.
* ax-gdb.c (gen_expr): Likewise.
* cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope,
cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type,
lookup_possible_namespace_symbol): Likewise.
* cp-support.c (read_in_psymtabs): Likewise.
* cp-support.h (cp_lookup_symbol_nonlocal): Likewise.
* language.h (la_lookup_symbol_nonlocal): Likewise.
* scm-valprint.c (scm_inferior_print): Likewise.
* solib-darwin.c (darwin_relocate_section_addresses): Likewise.
* solib-svr.c (elf_lookup_lib): Likewise.
* solib.c (show_auto_solib_add): Likewise.
* solist.h (lookup_lib_global, solib_global_lookup): Likewise.
* symmisc.c (maintenance_check_symtabs): Likewise.
* symtab.c (lookup_symbol_in_language, lookup_symbol_aux,
lookup_symbol_aux_local, lookup_symbol_aux_block,
lookup_symbol_from_objfile, lookup_symbol_aux_symtabs,
lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal,
lookup_symbol_static, lookup_symbol_global, symbol_matches_domain,
basic_lookup_transparent_type, find_main_psymtab,
lookup_block_symbol): Likewise.
* symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static,
lookup_symbol_global, lookup_symbol_aux_block,
lookup_symbol_partial_symbol, lookup_block_symbol,
lookup_global_symbol, value_maybe_namespace_elt): Likewise.

27 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ax-gdb.c
gdb/c-typeprint.c
gdb/cp-namespace.c
gdb/cp-support.c
gdb/cp-support.h
gdb/dwarf2read.c
gdb/eval.c
gdb/gnu-v3-abi.c
gdb/language.h
gdb/linespec.c
gdb/scm-valprint.c
gdb/solib-darwin.c
gdb/solib-spu.c
gdb/solib-svr4.c
gdb/solib.c
gdb/solist.h
gdb/spu-tdep.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/typeprint.h
gdb/ui-file.c
gdb/ui-file.h
gdb/valops.c
gdb/value.c

index 9b8fd58264115c3052f5d0e1864c15b31c9c1afd..d8a8914e28d04d122b2ed83519be3d4d12dcaba2 100644 (file)
@@ -1,3 +1,113 @@
+2010-03-09  Keith Seitz  <keiths@redhat.com>
+
+       Based on work from Daniel Jacobowitz  <dan@codesourcery.com>
+       * c-typeprint.c (cp_type_print_method_args): For non-static methods,
+       print out const or volatile qualifiers, too.
+       (c_type_print_args): Add parameters show_artificial and language.
+       Skip artificial parameters when requested.
+       Use the appropriate language printer.
+       (c_type_print_varspec): Tell c_type_print_args to skip artificial
+       parameters and pass language_c.
+       * dwarf2read.c (die_list): New file global.
+       (struct partial_die_info): Update comments for name field.
+       (pdi_needs_namespace): Renamed to ...
+       (die_needs_namespace): ... this. Rewrite.
+       (dwarf2_linkage_name): Remove.
+       (add_partial_symbol): Do not predicate the call to
+       partial_die_full_name based on pdi_needs_namespace.
+       Remove call to cp_check_possible_namespace_symbols and associated
+       outdated comments.
+       (guess_structure_name): Do not inspect child subprogram DIEs.
+       (dwarf2_fullname): Update comments.
+       Use die_needs_namespace to assist in computing the name.
+       (read_func_scope): Use dwarf2_name to get the DIE's name.
+       Use dwarf2_physname to get the "linkage name" of the DIE.
+       (dwarf2_add_member_field): Use dwarf2_physname instead of
+       dwarf2_linkage_name.
+       (read_structure_type): For structs and classes, set TYPE_NAME, too.
+       (determine_class): Remove.
+       (read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages
+       except Ada.
+       (new_symbol): Unconditionally call dwarf2_name.
+       Compute the "linkage name" using dwarf2_physname.
+       Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs.
+       When determining to scan for anonymous C++ namespaces, ignore
+       the linkage name.
+       (dwarf2_physname): New function.
+       (dwarf2_full_name): Move content to new function and call
+       that.
+       (dwarf2_compute_name): "New" function.
+       (_initialize_dwarf2_read): Initialize die_list.
+       * gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable
+       physname.
+       (gnu_v3_print_method_ptr): Use the physname for virtual methods
+       without a demangled name.
+       Print out type information for non-virtual methods.
+        * linespec.c (decode_line_1): Force ANY string using "::" (or
+       "." for java) to use decode_compound, and clean up any stray quoting.
+        If we found a file symtab, re-evaluate whether the remainder is_quoted.
+        (decode_compound): Stop consuming at an open parenthesis.
+        Keep template parameters.
+        Keep any overload information.
+        Keep keywords like "const".
+        Remove paren_pointer.
+        Move is_quoted check from set_flags to here.
+        Remove #if 0 code from 2000. Ten years is long enough.
+        (find_method): Before comparing symbol names, canonicalize the string
+        from the user.
+        If a specific overload is requested, find it. Otherwise throw an error.
+       (find_method_overload_end): New function.
+       (set_flags): Remove.
+        (decode_compound): Assume that parentheses are matched.
+        It's a lot easier.
+       * symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag
+       to cplus_demangle.
+       * linespec.c (decode_line_1): Keep important keywords like
+       "const" and "volatile".
+       * symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove.
+       * typeprint.h (c_type_print_args): Add declaration.
+       * ui-file.c (do_ui_file_obsavestring): New function.
+       (ui_file_obsavestring): New function.
+       * ui-file.h (ui_file_obsavestring): Add declaration.
+       * valops.c (find_overload_match): Resolve the object to
+       a non-pointer type.
+       If the object is a data member, search the object for the member
+       and return with staticp set.
+       Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME.
+       Do not attempt to extract a function name from non-function types.
+       If the extracted function name and the original name are the same,
+       we don't have a C++ method.
+
+       From Jan Kratochvil  <jan.kratochvil@redhat.com>:    
+       * dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name.
+
+       * ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters
+       and arguments from symbol lookups.
+       * ax-gdb.c (gen_expr): Likewise.
+       * cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope,
+       cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type,
+       lookup_possible_namespace_symbol): Likewise.
+       * cp-support.c (read_in_psymtabs): Likewise.
+       * cp-support.h (cp_lookup_symbol_nonlocal): Likewise.
+       * language.h (la_lookup_symbol_nonlocal): Likewise.
+       * scm-valprint.c (scm_inferior_print): Likewise.
+       * solib-darwin.c (darwin_relocate_section_addresses): Likewise.
+       * solib-svr.c (elf_lookup_lib): Likewise.
+       * solib.c (show_auto_solib_add): Likewise.
+       * solist.h (lookup_lib_global, solib_global_lookup): Likewise.
+       * symmisc.c (maintenance_check_symtabs): Likewise.
+       * symtab.c (lookup_symbol_in_language, lookup_symbol_aux,
+       lookup_symbol_aux_local, lookup_symbol_aux_block,
+       lookup_symbol_from_objfile, lookup_symbol_aux_symtabs,
+       lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal,
+       lookup_symbol_static, lookup_symbol_global, symbol_matches_domain,
+       basic_lookup_transparent_type, find_main_psymtab,
+       lookup_block_symbol): Likewise.
+       * symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static,
+       lookup_symbol_global, lookup_symbol_aux_block,
+       lookup_symbol_partial_symbol, lookup_block_symbol,
+       lookup_global_symbol, value_maybe_namespace_elt): Likewise.
+
 2010-03-09  Pierre Muller  <muller@ics.u-strasbg.fr>
 
        * python/python-internal.h: Include symtab.h.
index 7a2d2ca84e194d79cd4ee648a196f1f05ccba481..83796003094b00f4000e39b14ddba59c7397eb9f 100644 (file)
@@ -4781,14 +4781,10 @@ ada_lookup_symbol (const char *name, const struct block *block0,
 
 static struct symbol *
 ada_lookup_symbol_nonlocal (const char *name,
-                            const char *linkage_name,
                             const struct block *block,
                             const domain_enum domain)
 {
-  if (linkage_name == NULL)
-    linkage_name = name;
-  return ada_lookup_symbol (linkage_name, block_static_block (block), domain,
-                            NULL);
+  return ada_lookup_symbol (name, block_static_block (block), domain, NULL);
 }
 
 
index 3e151deccfbaf0c909656e3a4c53c8c1970ea9d7..ddbcb6ee6bb30df83774580afc4ec74d57f1f6eb 100644 (file)
@@ -1812,7 +1812,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
 
        /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
           symbol instead of the LOC_ARG one (if both exist).  */
-       sym = lookup_block_symbol (b, this_name, NULL, VAR_DOMAIN);
+       sym = lookup_block_symbol (b, this_name, VAR_DOMAIN);
        if (!sym)
          error (_("no `%s' found"), this_name);
 
index 3a0aa599bab63a63db370ab3cfce26dff3f1eb95..5cc5f6b6eaaf5cd93a8f76425a9dad30451491c6 100644 (file)
@@ -32,6 +32,7 @@
 #include "c-lang.h"
 #include "typeprint.h"
 #include "cp-abi.h"
+#include "jv-lang.h"
 
 #include "gdb_string.h"
 #include <errno.h>
@@ -40,8 +41,6 @@ static void cp_type_print_method_args (struct type *mtype, char *prefix,
                                       char *varstring, int staticp,
                                       struct ui_file *stream);
 
-static void c_type_print_args (struct type *, struct ui_file *);
-
 static void cp_type_print_derivation_info (struct ui_file *, struct type *);
 
 static void c_type_print_varspec_prefix (struct type *, struct ui_file *, int,
@@ -197,6 +196,23 @@ cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
     fprintf_filtered (stream, "void");
 
   fprintf_filtered (stream, ")");
+
+  /* For non-static methods, read qualifiers from the type of
+     THIS.  */
+  if (!staticp)
+    {
+      struct type *domain;
+
+      gdb_assert (nargs > 0);
+      gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR);
+      domain = TYPE_TARGET_TYPE (args[0].type);
+
+      if (TYPE_CONST (domain))
+       fprintf_filtered (stream, " const");
+
+      if (TYPE_VOLATILE (domain))
+       fprintf_filtered (stream, " volatile");
+    }
 }
 
 
@@ -352,10 +368,14 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
 
 /* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD
    or TYPE_CODE_FUNC, to STREAM.  Artificial arguments, such as "this"
-   in non-static methods, are displayed.  */
+   in non-static methods, are displayed if SHOW_ARTIFICIAL is
+   non-zero. LANGUAGE is the language in which TYPE was defined.  This is
+   a necessary evil since this code is used by the C, C++, and Java
+   backends. */
 
-static void
-c_type_print_args (struct type *type, struct ui_file *stream)
+void
+c_type_print_args (struct type *type, struct ui_file *stream,
+                  int show_artificial, enum language language)
 {
   int i, len;
   struct field *args;
@@ -367,13 +387,19 @@ c_type_print_args (struct type *type, struct ui_file *stream)
 
   for (i = 0; i < TYPE_NFIELDS (type); i++)
     {
+      if (TYPE_FIELD_ARTIFICIAL (type, i) && !show_artificial)
+       continue;
+
       if (printed_any)
        {
          fprintf_filtered (stream, ", ");
          wrap_here ("    ");
        }
 
-      c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
+      if (language == language_java)
+       java_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
+      else
+       c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
       printed_any = 1;
     }
 
@@ -590,7 +616,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
       if (passed_a_ptr)
        fprintf_filtered (stream, ")");
       if (!demangled_args)
-       c_type_print_args (type, stream);
+       c_type_print_args (type, stream, 1, language_c);
       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show,
                                   passed_a_ptr, 0);
       break;
index cdc76d4560e8a6a76af43260bfba864bbd967903..ba134929c378555e2081ba8967bebcab52517dde 100644 (file)
 #include "buildsym.h"
 
 static struct symbol *lookup_namespace_scope (const char *name,
-                                             const char *linkage_name,
                                              const struct block *block,
                                              const domain_enum domain,
                                              const char *scope,
                                              int scope_len);
 
 static struct symbol *lookup_symbol_file (const char *name,
-                                         const char *linkage_name,
                                          const struct block *block,
                                          const domain_enum domain,
                                          int anonymous_namespace);
@@ -231,26 +229,23 @@ cp_add_using (const char *dest,
 /* The C++-specific version of name lookup for static and global
    names.  This makes sure that names get looked for in all namespaces
    that are in scope.  NAME is the natural name of the symbol that
-   we're looking for, LINKAGE_NAME (which is optional) is its linkage
-   name, BLOCK is the block that we're searching within, DOMAIN says
-   what kind of symbols we're looking for, and if SYMTAB is non-NULL,
-   we should store the symtab where we found the symbol in it.  */
+   we're looking for, BLOCK is the block that we're searching within,
+   DOMAIN says what kind of symbols we're looking for, and if SYMTAB is
+   non-NULL, we should store the symtab where we found the symbol in it.  */
 
 struct symbol *
 cp_lookup_symbol_nonlocal (const char *name,
-                          const char *linkage_name,
                           const struct block *block,
                           const domain_enum domain)
 {
   struct symbol *sym;
   const char *scope = block_scope (block);
 
-  sym = lookup_namespace_scope (name, linkage_name, block, domain, scope, 0);
+  sym = lookup_namespace_scope (name, block, domain, scope, 0);
   if (sym != NULL)
     return sym;
 
-  return cp_lookup_symbol_namespace (scope, name, linkage_name, block, domain,
-                                     1);
+  return cp_lookup_symbol_namespace (scope, name, block, domain, 1);
 }
 
 /* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in
@@ -259,14 +254,12 @@ cp_lookup_symbol_nonlocal (const char *name,
 static struct symbol *
 cp_lookup_symbol_in_namespace (const char *namespace,
                                const char *name,
-                               const char *linkage_name,
                                const struct block *block,
                                const domain_enum domain)
 {
   if (namespace[0] == '\0')
     {
-      return lookup_symbol_file (name, linkage_name, block,
-                                 domain, 0);
+      return lookup_symbol_file (name, block, domain, 0);
     }
   else
     {
@@ -275,8 +268,8 @@ cp_lookup_symbol_in_namespace (const char *namespace,
       strcpy (concatenated_name, namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
-      return lookup_symbol_file (concatenated_name, linkage_name,
-                                 block, domain,cp_is_anonymous (namespace));
+      return lookup_symbol_file (concatenated_name, block,
+                                domain,cp_is_anonymous (namespace));
     }
 }
 
@@ -310,7 +303,6 @@ reset_directive_searched (void *data)
 static struct symbol *
 cp_lookup_symbol_imports (const char *scope,
                           const char *name,
-                          const char *linkage_name,
                           const struct block *block,
                           const domain_enum domain,
                           const int search_parents)
@@ -322,8 +314,7 @@ cp_lookup_symbol_imports (const char *scope,
   struct cleanup *searched_cleanup;
 
   /* First, try to find the symbol in the given namespace.  */
-  sym = cp_lookup_symbol_in_namespace (scope, name, linkage_name, block,
-                                       domain);
+  sym = cp_lookup_symbol_in_namespace (scope, name, block, domain);
   if (sym != NULL)
     return sym;
 
@@ -359,7 +350,6 @@ cp_lookup_symbol_imports (const char *scope,
          {
            sym = cp_lookup_symbol_in_namespace (scope,
                                                 current->import_src,
-                                                linkage_name,
                                                 block,
                                                 domain);
          }
@@ -369,7 +359,6 @@ cp_lookup_symbol_imports (const char *scope,
                NAMESPACE to direct the search towards the imported namespace.  */
            sym = cp_lookup_symbol_imports (current->import_src,
                                            name,
-                                           linkage_name,
                                            block,
                                            domain,
                                            0);
@@ -392,7 +381,6 @@ cp_lookup_symbol_imports (const char *scope,
 struct symbol*
 cp_lookup_symbol_namespace (const char *scope,
                             const char *name,
-                            const char *linkage_name,
                             const struct block *block,
                             const domain_enum domain,
                             const int search_parents)
@@ -402,7 +390,7 @@ cp_lookup_symbol_namespace (const char *scope,
   /* Search for name in namespaces imported to this and parent blocks.  */
   while (block != NULL)
     {
-      sym = cp_lookup_symbol_imports (scope, name, linkage_name, block, domain,
+      sym = cp_lookup_symbol_imports (scope, name, block, domain,
                                       search_parents);
 
       if (sym)
@@ -431,7 +419,6 @@ cp_lookup_symbol_namespace (const char *scope,
 
 static struct symbol *
 lookup_namespace_scope (const char *name,
-                       const char *linkage_name,
                        const struct block *block,
                        const domain_enum domain,
                        const char *scope,
@@ -453,8 +440,7 @@ lookup_namespace_scope (const char *name,
          new_scope_len += 2;
        }
       new_scope_len += cp_find_first_component (scope + new_scope_len);
-      sym = lookup_namespace_scope (name, linkage_name, block,
-                                   domain, scope, new_scope_len);
+      sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len);
       if (sym != NULL)
        return sym;
     }
@@ -465,8 +451,7 @@ lookup_namespace_scope (const char *name,
   namespace = alloca (scope_len + 1);
   strncpy (namespace, scope, scope_len);
   namespace[scope_len] = '\0';
-  return cp_lookup_symbol_in_namespace (namespace, name, linkage_name,
-                                        block, domain);
+  return cp_lookup_symbol_in_namespace (namespace, name, block, domain);
 }
 
 /* Look up NAME in BLOCK's static block and in global blocks.  If
@@ -476,14 +461,13 @@ lookup_namespace_scope (const char *name,
 
 static struct symbol *
 lookup_symbol_file (const char *name,
-                   const char *linkage_name,
                    const struct block *block,
                    const domain_enum domain,
                    int anonymous_namespace)
 {
   struct symbol *sym = NULL;
 
-  sym = lookup_symbol_static (name, linkage_name, block, domain);
+  sym = lookup_symbol_static (name, block, domain);
   if (sym != NULL)
     return sym;
 
@@ -496,12 +480,11 @@ lookup_symbol_file (const char *name,
       const struct block *global_block = block_global_block (block);
       
       if (global_block != NULL)
-       sym = lookup_symbol_aux_block (name, linkage_name, global_block,
-                                      domain);
+       sym = lookup_symbol_aux_block (name, global_block, domain);
     }
   else
     {
-      sym = lookup_symbol_global (name, linkage_name, block, domain);
+      sym = lookup_symbol_global (name, block, domain);
     }
 
   if (sym != NULL)
@@ -552,7 +535,6 @@ cp_lookup_nested_type (struct type *parent_type,
        const char *parent_name = TYPE_TAG_NAME (parent_type);
        struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name,
                                                            nested_name,
-                                                           NULL,
                                                            block,
                                                            VAR_DOMAIN);
        if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
@@ -798,7 +780,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
 
   memcpy (name_copy, name, len);
   name_copy[len] = '\0';
-  sym = lookup_block_symbol (block, name_copy, NULL, VAR_DOMAIN);
+  sym = lookup_block_symbol (block, name_copy, VAR_DOMAIN);
 
   if (sym == NULL)
     {
@@ -839,7 +821,7 @@ lookup_possible_namespace_symbol (const char *name)
       struct symbol *sym;
 
       sym = lookup_block_symbol (get_possible_namespace_block (objfile),
-                                name, NULL, VAR_DOMAIN);
+                                name, VAR_DOMAIN);
 
       if (sym != NULL)
        return sym;
index c31fcff1408d6dbbc471b27402fc781066c0d80f..556bf4e4763b4a3fc3deaef57356968421d7634d 100644 (file)
@@ -840,9 +840,9 @@ read_in_psymtabs (const char *func_name)
     if (ps->readin)
       continue;
 
-    if ((lookup_partial_symbol (ps, func_name, NULL, 1, VAR_DOMAIN)
+    if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
         != NULL)
-       || (lookup_partial_symbol (ps, func_name, NULL, 0, VAR_DOMAIN)
+       || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
            != NULL))
       psymtab_to_symtab (ps);
   }
index a6a9af17b900b5d1e82e7944af00a240fb334ef7..619dc1f3bad8efd73c9d3ac414fab1d24fe4aa8b 100644 (file)
@@ -111,13 +111,11 @@ extern void cp_set_block_scope (const struct symbol *symbol,
 extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol);
 
 extern struct symbol *cp_lookup_symbol_nonlocal (const char *name,
-                                                const char *linkage_name,
                                                 const struct block *block,
                                                 const domain_enum domain);
 
 extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
                                                  const char *name,
-                                                 const char *linkage_name,
                                                  const struct block *block,
                                                  const domain_enum domain,
                                                  const int search_parents);
index b144dc16d827fce2838c0ea88856c4728c32733d..1f25a456cf0229d3182b7c31ba4435398b55a7b9 100644 (file)
@@ -48,6 +48,8 @@
 #include "gdbcmd.h"
 #include "block.h"
 #include "addrmap.h"
+#include "typeprint.h"
+#include "jv-lang.h"
 
 #include <fcntl.h>
 #include "gdb_string.h"
@@ -487,8 +489,7 @@ struct partial_die_info
     unsigned int has_byte_size : 1;
 
     /* The name of this DIE.  Normally the value of DW_AT_name, but
-       sometimes DW_TAG_MIPS_linkage_name or a string computed in some
-       other fashion.  */
+       sometimes a default name for unnamed DIEs.  */
     char *name;
 
     /* The scope to prepend to our children.  This is generally
@@ -788,8 +789,6 @@ static void scan_partial_symbols (struct partial_die_info *,
 static void add_partial_symbol (struct partial_die_info *,
                                struct dwarf2_cu *);
 
-static int pdi_needs_namespace (enum dwarf_tag tag);
-
 static void add_partial_namespace (struct partial_die_info *pdi,
                                   CORE_ADDR *lowpc, CORE_ADDR *highpc,
                                   int need_pc, struct dwarf2_cu *cu);
@@ -984,9 +983,6 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *,
 
 static void process_structure_scope (struct die_info *, struct dwarf2_cu *);
 
-static const char *determine_class_name (struct die_info *die,
-                                        struct dwarf2_cu *cu);
-
 static void read_common_block (struct die_info *, struct dwarf2_cu *);
 
 static void read_namespace (struct die_info *die, struct dwarf2_cu *);
@@ -1028,8 +1024,6 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader,
 
 static void process_die (struct die_info *, struct dwarf2_cu *);
 
-static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
-
 static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
                                       struct obstack *);
 
@@ -2441,12 +2435,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
 
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
-  if (pdi_needs_namespace (pdi->tag))
-    {
-      actual_name = partial_die_full_name (pdi, cu);
-      if (actual_name)
-       built_actual_name = 1;
-    }
+  actual_name = partial_die_full_name (pdi, cu);
+  if (actual_name)
+    built_actual_name = 1;
 
   if (actual_name == NULL)
     actual_name = pdi->name;
@@ -2586,49 +2577,10 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
       break;
     }
 
-  /* Check to see if we should scan the name for possible namespace
-     info.  Only do this if this is C++, if we don't have namespace
-     debugging info in the file, if the psym is of an appropriate type
-     (otherwise we'll have psym == NULL), and if we actually had a
-     mangled name to begin with.  */
-
-  /* FIXME drow/2004-02-22: Why don't we do this for classes, i.e. the
-     cases which do not set PSYM above?  */
-
-  if (cu->language == language_cplus
-      && cu->has_namespace_info == 0
-      && psym != NULL
-      && SYMBOL_CPLUS_DEMANGLED_NAME (psym) != NULL)
-    cp_check_possible_namespace_symbols (SYMBOL_CPLUS_DEMANGLED_NAME (psym),
-                                        objfile);
-
   if (built_actual_name)
     xfree (actual_name);
 }
 
-/* Determine whether a die of type TAG living in a C++ class or
-   namespace needs to have the name of the scope prepended to the
-   name listed in the die.  */
-
-static int
-pdi_needs_namespace (enum dwarf_tag tag)
-{
-  switch (tag)
-    {
-    case DW_TAG_namespace:
-    case DW_TAG_typedef:
-    case DW_TAG_class_type:
-    case DW_TAG_interface_type:
-    case DW_TAG_structure_type:
-    case DW_TAG_union_type:
-    case DW_TAG_enumeration_type:
-    case DW_TAG_enumerator:
-      return 1;
-    default:
-      return 0;
-    }
-}
-
 /* Read a partial die corresponding to a namespace; also, add a symbol
    corresponding to that namespace to the symbol table.  NAMESPACE is
    the name of the enclosing namespace.  */
@@ -2740,7 +2692,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
         could fix this by only using the demangled name to get the
         prefix (but see comment in read_structure_type).  */
 
-      struct partial_die_info *child_pdi = struct_pdi->die_child;
       struct partial_die_info *real_pdi;
 
       /* If this DIE (this DIE's specification, if any) has a parent, then
@@ -2753,27 +2704,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
 
       if (real_pdi->die_parent != NULL)
        return;
-
-      while (child_pdi != NULL)
-       {
-         if (child_pdi->tag == DW_TAG_subprogram)
-           {
-             char *actual_class_name
-               = language_class_name_from_physname (cu->language_defn,
-                                                    child_pdi->name);
-             if (actual_class_name != NULL)
-               {
-                 struct_pdi->name
-                   = obsavestring (actual_class_name,
-                                   strlen (actual_class_name),
-                                   &cu->objfile->objfile_obstack);
-                 xfree (actual_class_name);
-               }
-             break;
-           }
-
-         child_pdi = child_pdi->die_sibling;
-       }
     }
 }
 
@@ -3345,42 +3275,156 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
     }
 }
 
+/* A helper function for dwarf2_compute_name which determines whether DIE
+   needs to have the name of the scope prepended to the name listed in the
+   die.  */
+
+static int
+die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
+{
+  switch (die->tag)
+    {
+    case DW_TAG_namespace:
+    case DW_TAG_typedef:
+    case DW_TAG_class_type:
+    case DW_TAG_interface_type:
+    case DW_TAG_structure_type:
+    case DW_TAG_union_type:
+    case DW_TAG_enumeration_type:
+    case DW_TAG_enumerator:
+    case DW_TAG_subprogram:
+    case DW_TAG_member:
+      return 1;
+
+    case DW_TAG_variable:
+      /* We only need to prefix "globally" visible variables.  These include
+        any variable marked with DW_AT_external or any variable that
+        lives in a namespace.  [Variables in anonymous namespaces
+        require prefixing, but they are not DW_AT_external.]  */
+
+      if (dwarf2_attr (die, DW_AT_specification, cu))
+       {
+         struct dwarf2_cu *spec_cu = cu;
+         return die_needs_namespace (die_specification (die, &spec_cu),
+                                     spec_cu);
+       }
+
+      if (dwarf2_attr (die, DW_AT_external, cu)
+         || die->parent->tag == DW_TAG_namespace)
+       return 1;
+
+      return 0;
+
+    default:
+      return 0;
+    }
+}
+
+/* Compute the fully qualified name of DIE in CU.  If PHYSNAME is nonzero,
+   compute the physname for the object, which include a method's
+   formal parameters (C++/Java) and return type (Java).
+
+   The result is allocated on the objfile_obstack and canonicalized.  */
+
+static const char *
+dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
+                    int physname)
+{
+  if (name == NULL)
+    name = dwarf2_name (die, cu);
+
+  /* These are the only languages we know how to qualify names in.  */
+  if (name != NULL
+      && (cu->language == language_cplus || cu->language == language_java))
+    {
+      if (die_needs_namespace (die, cu))
+       {
+         long length;
+         char *prefix;
+         struct ui_file *buf;
+
+         prefix = determine_prefix (die, cu);
+         buf = mem_fileopen ();
+         if (*prefix != '\0')
+           {
+             char *prefixed_name = typename_concat (NULL, prefix, name, cu);
+             fputs_unfiltered (prefixed_name, buf);
+             xfree (prefixed_name);
+           }
+         else
+           fputs_unfiltered (name ? name : "", buf);
+
+         /* For Java and C++ methods, append formal parameter type
+            information, if PHYSNAME.  */
+         
+         if (physname && die->tag == DW_TAG_subprogram
+             && (cu->language == language_cplus
+                 || cu->language == language_java))
+           {
+             struct type *type = read_type_die (die, cu);
+
+             c_type_print_args (type, buf, 0, cu->language);
+
+             if (cu->language == language_java)
+               {
+                 /* For java, we must append the return type to method
+                    names. */
+                 if (die->tag == DW_TAG_subprogram)
+                   java_print_type (TYPE_TARGET_TYPE (type), "", buf,
+                                    0, 0);
+               }
+             else if (cu->language == language_cplus)
+               {
+                 if (TYPE_NFIELDS (type) > 0
+                     && TYPE_FIELD_ARTIFICIAL (type, 0)
+                     && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
+                   fputs_unfiltered (" const", buf);
+               }
+           }
+
+         name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack,
+                                      &length);
+         ui_file_delete (buf);
+
+         if (cu->language == language_cplus)
+           {
+             char *cname
+               = dwarf2_canonicalize_name (name, cu,
+                                           &cu->objfile->objfile_obstack);
+             if (cname != NULL)
+               name = cname;
+           }
+       }
+    }
+
+  return name;
+}
+
 /* Return the fully qualified name of DIE, based on its DW_AT_name.
    If scope qualifiers are appropriate they will be added.  The result
    will be allocated on the objfile_obstack, or NULL if the DIE does
-   not have a name.  */
+   not have a name.  NAME may either be from a previous call to
+   dwarf2_name or NULL.
+
+   The output string will be canonicalized (if C++/Java). */
 
 static const char *
-dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
+dwarf2_full_name (char *name, struct die_info *die, struct dwarf2_cu *cu)
 {
-  struct attribute *attr;
-  char *prefix, *name;
-  struct ui_file *buf = NULL;
+  return dwarf2_compute_name (name, die, cu, 0);
+}
 
-  name = dwarf2_name (die, cu);
-  if (!name)
-    return NULL;
+/* Construct a physname for the given DIE in CU.  NAME may either be
+   from a previous call to dwarf2_name or NULL.  The result will be
+   allocated on the objfile_objstack or NULL if the DIE does not have a
+   name.
 
-  /* These are the only languages we know how to qualify names in.  */
-  if (cu->language != language_cplus
-      && cu->language != language_java)
-    return name;
-
-  /* If no prefix is necessary for this type of DIE, return the
-     unqualified name.  The other three tags listed could be handled
-     in pdi_needs_namespace, but that requires broader changes.  */
-  if (!pdi_needs_namespace (die->tag)
-      && die->tag != DW_TAG_subprogram
-      && die->tag != DW_TAG_variable
-      && die->tag != DW_TAG_member)
-    return name;
-
-  prefix = determine_prefix (die, cu);
-  if (*prefix != '\0')
-    name = typename_concat (&cu->objfile->objfile_obstack, prefix,
-                           name, cu);
+   The output string will be canonicalized (if C++/Java).  */
 
-  return name;
+static const char *
+dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu)
+{
+  return dwarf2_compute_name (name, die, cu, 1);
 }
 
 /* Read the import statement specified by the given die and record it.  */
@@ -3858,7 +3902,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
-  name = dwarf2_linkage_name (die, cu);
+  name = dwarf2_name (die, cu);
 
   /* Ignore functions with missing or empty names and functions with
      missing or invalid low and high pc attributes.  */
@@ -4532,7 +4576,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
        return;
 
       /* Get physical name.  */
-      physname = dwarf2_linkage_name (die, cu);
+      physname = (char *) dwarf2_physname (fieldname, die, cu);
 
       /* The name is already allocated along with this objfile, so we don't
         need to duplicate it for the type.  */
@@ -4694,7 +4738,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
     return;
 
   /* Get the mangled name.  */
-  physname = dwarf2_linkage_name (die, cu);
+  physname = (char *) dwarf2_physname (fieldname, die, cu);
 
   /* Look up member function name in fieldlist.  */
   for (i = 0; i < fip->nfnfields; i++)
@@ -5001,14 +5045,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
       if (cu->language == language_cplus
          || cu->language == language_java)
        {
-         const char *new_prefix = determine_class_name (die, cu);
-         TYPE_TAG_NAME (type) = (char *) new_prefix;
+         TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (name, die, cu);
+         if (die->tag == DW_TAG_structure_type
+             || die->tag == DW_TAG_class_type)
+           TYPE_NAME (type) = TYPE_TAG_NAME (type);
        }
       else
        {
          /* The name is already allocated along with this objfile, so
             we don't need to duplicate it for the type.  */
-         TYPE_TAG_NAME (type) = name;
+         TYPE_TAG_NAME (type) = (char *) name;
+         if (die->tag == DW_TAG_class_type)
+           TYPE_NAME (type) = TYPE_TAG_NAME (type);
        }
     }
 
@@ -5227,7 +5275,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
   type = alloc_type (objfile);
 
   TYPE_CODE (type) = TYPE_CODE_ENUM;
-  name = dwarf2_full_name (die, cu);
+  name = dwarf2_full_name (NULL, die, cu);
   if (name != NULL)
     TYPE_TAG_NAME (type) = (char *) name;
 
@@ -5252,51 +5300,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
   return set_die_type (die, type, cu);
 }
 
-/* Determine the name of the type represented by DIE, which should be
-   a named C++ or Java compound type.  Return the name in question,
-   allocated on the objfile obstack.  */
-
-static const char *
-determine_class_name (struct die_info *die, struct dwarf2_cu *cu)
-{
-  const char *new_prefix = NULL;
-
-  /* If we don't have namespace debug info, guess the name by trying
-     to demangle the names of members, just like we did in
-     guess_structure_name.  */
-  if (!processing_has_namespace_info)
-    {
-      struct die_info *child;
-
-      for (child = die->child;
-          child != NULL && child->tag != 0;
-          child = sibling_die (child))
-       {
-         if (child->tag == DW_TAG_subprogram)
-           {
-             char *phys_prefix
-               = language_class_name_from_physname (cu->language_defn,
-                                                    dwarf2_linkage_name
-                                                    (child, cu));
-
-             if (phys_prefix != NULL)
-               {
-                 new_prefix
-                   = obsavestring (phys_prefix, strlen (phys_prefix),
-                                   &cu->objfile->objfile_obstack);
-                 xfree (phys_prefix);
-                 break;
-               }
-           }
-       }
-    }
-
-  if (new_prefix == NULL)
-    new_prefix = dwarf2_full_name (die, cu);
-
-  return new_prefix;
-}
-
 /* Given a pointer to a die which begins an enumeration, process all
    the dies that define the members of the enumeration, and create the
    symbol for the enumeration type.
@@ -5952,7 +5955,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
   const char *name = NULL;
   struct type *this_type;
 
-  name = dwarf2_full_name (die, cu);
+  name = dwarf2_full_name (NULL, die, cu);
   this_type = init_type (TYPE_CODE_TYPEDEF, 0,
                         TYPE_FLAG_TARGET_STUB, NULL, objfile);
   TYPE_NAME (this_type) = (char *) name;
@@ -6780,7 +6783,8 @@ read_partial_die (struct partial_die_info *part_die,
            }
          break;
        case DW_AT_MIPS_linkage_name:
-         part_die->name = DW_STRING (&attr);
+         if (cu->language == language_ada)
+           part_die->name = DW_STRING (&attr);
          break;
        case DW_AT_low_pc:
          has_low_pc_attr = 1;
@@ -8351,13 +8355,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
 
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
-  if (die->tag != DW_TAG_namespace)
-    name = dwarf2_linkage_name (die, cu);
-  else
-    name = TYPE_NAME (type);
-
+  name = dwarf2_name (die, cu);
   if (name)
     {
+      const char *linkagename;
+
       sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
                                             sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
@@ -8365,7 +8367,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
 
       /* Cache this symbol's name and the name's demangled form (if any).  */
       SYMBOL_LANGUAGE (sym) = cu->language;
-      SYMBOL_SET_NAMES (sym, name, strlen (name), 0, objfile);
+      linkagename = dwarf2_physname (name, die, cu);
+      SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
 
       /* Default assumptions.
          Use the passed type or decode it from the die.  */
@@ -8590,7 +8593,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
          }
          break;
        case DW_TAG_typedef:
-         SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
+         SYMBOL_LINKAGE_NAME (sym)
+           = (char *) dwarf2_full_name (name, die, cu);
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
          SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
          add_symbol_to_list (sym, cu->list_in_scope);
@@ -8602,7 +8606,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
          add_symbol_to_list (sym, cu->list_in_scope);
          break;
        case DW_TAG_enumerator:
-         SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
+         SYMBOL_LINKAGE_NAME (sym)
+           = (char *) dwarf2_full_name (name, die, cu);
          attr = dwarf2_attr (die, DW_AT_const_value, cu);
          if (attr)
            {
@@ -8639,8 +8644,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
       /* For the benefit of old versions of GCC, check for anonymous
         namespaces based on the demangled name.  */
       if (!processing_has_namespace_info
-         && cu->language == language_cplus
-         && dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu) != NULL)
+         && cu->language == language_cplus)
        cp_scan_for_anonymous_namespaces (sym);
     }
   return (sym);
@@ -9092,19 +9096,6 @@ sibling_die (struct die_info *die)
   return die->sibling;
 }
 
-/* Get linkage name of a die, return NULL if not found.  */
-
-static char *
-dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
-{
-  struct attribute *attr;
-
-  attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
-  if (attr && DW_STRING (attr))
-    return DW_STRING (attr);
-  return dwarf2_name (die, cu);
-}
-
 /* Get name of a die, return NULL if not found.  */
 
 static char *
index e2ceea74875eab1f897289196a9c0e064262b706..3bcd417354ed2c04c99d97980cafc991643149e8 100644 (file)
@@ -1433,7 +1433,7 @@ evaluate_subexp_standard (struct type *expect_type,
          if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
            {
              function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
-                                                    name, NULL,
+                                                    name,
                                                     get_selected_block (0),
                                                     VAR_DOMAIN, 1);
              if (function == NULL)
index 532140115bb68bdb3fe1f129458297ad15c84aca..b1882a25a5dd861e9021e90b687a382a322f9eb9 100644 (file)
@@ -26,6 +26,7 @@
 #include "demangle.h"
 #include "objfiles.h"
 #include "valprint.h"
+#include "c-lang.h"
 
 #include "gdb_assert.h"
 #include "gdb_string.h"
@@ -456,10 +457,8 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset,
                      LONGEST adjustment)
 {
   int i;
-  const char *physname;
 
   /* Search this class first.  */
-  physname = NULL;
   if (adjustment == 0)
     {
       int len;
@@ -587,15 +586,24 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
        {
          char *demangled_name = cplus_demangle (physname,
                                                 DMGL_ANSI | DMGL_PARAMS);
-         if (demangled_name != NULL)
+         fprintf_filtered (stream, "&virtual ");
+         if (demangled_name == NULL)
+           fputs_filtered (physname, stream);
+         else
            {
-             fprintf_filtered (stream, "&virtual ");
              fputs_filtered (demangled_name, stream);
              xfree (demangled_name);
-             return;
            }
+         return;
        }
     }
+  else if (ptr_value != 0)
+    {
+      /* Found a non-virtual function: print out the type.  */
+      fputs_filtered ("(", stream);
+      c_print_type (type, "", stream, -1, 0);
+      fputs_filtered (") ", stream);
+    }
 
   /* We didn't find it; print the raw data.  */
   if (vbit)
index 4f78a28a470f48912e4a3e6fb1b0a4c248315b43..e0096f5c86aff89ba6194a5491d9ada642fad2a9 100644 (file)
@@ -258,7 +258,6 @@ struct language_defn
        variables.  */
 
     struct symbol *(*la_lookup_symbol_nonlocal) (const char *,
-                                                const char *,
                                                 const struct block *,
                                                 const domain_enum);
 
index 03a6dccfeea0bf9120485734ee0c9e6344611675..ec4d569a75c22ed5eb0737898c9bb5ba83e5c26e 100644 (file)
@@ -40,6 +40,7 @@
 #include "interps.h"
 #include "mi/mi-cmds.h"
 #include "target.h"
+#include "arch-utils.h"
 
 /* We share this one with symtab.c, but it is not exported widely. */
 
@@ -50,8 +51,6 @@ extern char *operator_chars (char *, char **);
 static void initialize_defaults (struct symtab **default_symtab,
                                 int *default_line);
 
-static void set_flags (char *arg, int *is_quoted, char **paren_pointer);
-
 static struct symtabs_and_lines decode_indirect (char **argptr);
 
 static char *locate_first_half (char **argptr, int *is_quote_enclosed);
@@ -628,6 +627,37 @@ See set/show multiple-symbol."));
   discard_cleanups (old_chain);
   return return_values;
 }
+
+/* A helper function for decode_line_1 and friends which skips P
+   past any method overload information at the beginning of P, e.g.,
+   "(const struct foo *)".
+
+   This function assumes that P has already been validated to contain
+   overload information, and it will assert if *P != '('.  */
+static char *
+find_method_overload_end (char *p)
+{
+  int depth = 0;
+
+  gdb_assert (*p == '(');
+
+  while (*p)
+    {
+      if (*p == '(')
+       ++depth;
+      else if (*p == ')')
+       {
+         if (--depth == 0)
+           {
+             ++p;
+             break;
+           }
+       }
+      ++p;
+    }
+
+  return p;
+}
 \f
 /* The parser of linespec itself. */
 
@@ -688,9 +718,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   struct symtab *file_symtab = NULL;
 
   char *copy;
-  /* This is NULL if there are no parens in *ARGPTR, or a pointer to
-     the closing parenthesis if there are parens.  */
-  char *paren_pointer;
   /* This says whether or not something in *ARGPTR is quoted with
      completer_quotes (i.e. with single quotes).  */
   int is_quoted;
@@ -715,12 +742,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   if (**argptr == '*')
     return decode_indirect (argptr);
 
-  /* Set various flags.  'paren_pointer' is important for overload
-     checking, where we allow things like:
-        (gdb) break c::f(int)
-  */
-
-  set_flags (*argptr, &is_quoted, &paren_pointer);
+  is_quoted = (*argptr
+              && strchr (get_gdb_completer_quote_characters (),
+                         **argptr) != NULL);
   if (is_quoted)
     end_quote = skip_quoted (*argptr);
 
@@ -738,10 +762,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   /* Check if this is an Objective-C method (anything that starts with
      a '+' or '-' and a '[').  */
   if (is_objc_method_format (p))
-    {
-      is_objc_method = 1;
-      paren_pointer  = NULL; /* Just a category name.  Ignore it.  */
-    }
+    is_objc_method = 1;
 
   /* Check if the symbol could be an Objective-C selector.  */
 
@@ -766,63 +787,33 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
        
       if (p[0] == '.' || p[1] == ':')
        {
-         if (paren_pointer == NULL)
-           return decode_compound (argptr, funfirstline, canonical,
+         struct symtabs_and_lines values;
+
+         if (is_quote_enclosed)
+           ++saved_arg;
+         values = decode_compound (argptr, funfirstline, canonical,
                                    saved_arg, p, not_found_ptr);
-         /* Otherwise, fall through to decode_variable below.  */
+         if (is_quoted && **argptr == '\'')
+           *argptr = *argptr + 1;
+         return values;
        }
-      else
-       {
-         /* No, the first part is a filename; set file_symtab to be that file's
-            symtab.  Also, move argptr past the filename.  */
-
-         file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
-                                             not_found_ptr);
 
-         /* Check for single quotes on the non-filename part.  */
-         if (!is_quoted)
-           {
-             is_quoted = (**argptr
-                          && strchr (get_gdb_completer_quote_characters (),
-                                     **argptr) != NULL);
-             if (is_quoted)
-               end_quote = skip_quoted (*argptr);
-           }
-       }
-    }
-#if 0
-  /* No one really seems to know why this was added. It certainly
-     breaks the command line, though, whenever the passed
-     name is of the form ClassName::Method. This bit of code
-     singles out the class name, and if funfirstline is set (for
-     example, you are setting a breakpoint at this function),
-     you get an error. This did not occur with earlier
-     verions, so I am ifdef'ing this out. 3/29/99 */
-  else
-    {
-      /* Check if what we have till now is a symbol name */
+      /* No, the first part is a filename; set file_symtab to be that file's
+        symtab.  Also, move argptr past the filename.  */
 
-      /* We may be looking at a template instantiation such
-         as "foo<int>".  Check here whether we know about it,
-         instead of falling through to the code below which
-         handles ordinary function names, because that code
-         doesn't like seeing '<' and '>' in a name -- the
-         skip_quoted call doesn't go past them.  So see if we
-         can figure it out right now. */
+      file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
+                                         not_found_ptr);
 
-      copy = (char *) alloca (p - *argptr + 1);
-      memcpy (copy, *argptr, p - *argptr);
-      copy[p - *argptr] = '\000';
-      sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
-      if (sym)
+      /* Check for single quotes on the non-filename part.  */
+      if (!is_quoted)
        {
-         *argptr = (*p == '\'') ? p + 1 : p;
-         return symbol_found (funfirstline, canonical, copy, sym, NULL);
+         is_quoted = (**argptr
+                      && strchr (get_gdb_completer_quote_characters (),
+                                 **argptr) != NULL);
+         if (is_quoted)
+           end_quote = skip_quoted (*argptr);
        }
-      /* Otherwise fall out from here and go to file/line spec
-         processing, etc. */
     }
-#endif
 
   /* file_symtab is specified file's symtab, or 0 if no file specified.
      arg no longer contains the file name.  */
@@ -868,10 +859,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
       /* allow word separators in method names for Obj-C */
       p = skip_quoted_chars (*argptr, NULL, "");
     }
-  else if (paren_pointer != NULL)
-    {
-      p = paren_pointer + 1;
-    }
   else
     {
       p = skip_quoted (*argptr);
@@ -881,6 +868,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   if (*p == '<')
     p = find_template_name_end (p);
 
+  /* Keep method overload information.  */
+  if (*p == '(')
+    p = find_method_overload_end (p);
+
+  /* Make sure we keep important kewords like "const" */
+  if (strncmp (p, " const", 6) == 0)
+    p += 6;
+
   copy = (char *) alloca (p - *argptr + 1);
   memcpy (copy, *argptr, p - *argptr);
   copy[p - *argptr] = '\0';
@@ -928,10 +923,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    function is passed ARGPTR as an argument, it modifies what ARGPTR
    points to; typically, it advances *ARGPTR past whatever substring
    it has just looked at.  (If it doesn't modify *ARGPTR, then the
-   function gets passed *ARGPTR instead, which is then called ARG: see
-   set_flags, for example.)  Also, functions that return a struct
-   symtabs_and_lines may modify CANONICAL, as in the description of
-   decode_line_1.
+   function gets passed *ARGPTR instead, which is then called ARG.)
+   Also, functions that return a struct symtabs_and_lines may modify
+   CANONICAL, as in the description of decode_line_1.
 
    If a function returns a struct symtabs_and_lines, then that struct
    will immediately make its way up the call chain to be returned by
@@ -958,44 +952,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
     }
 }
 
-static void
-set_flags (char *arg, int *is_quoted, char **paren_pointer)
-{
-  char *ii;
-  int has_if = 0;
-
-  /* 'has_if' is for the syntax:
-        (gdb) break foo if (a==b)
-  */
-  if ((ii = strstr (arg, " if ")) != NULL ||
-      (ii = strstr (arg, "\tif ")) != NULL ||
-      (ii = strstr (arg, " if\t")) != NULL ||
-      (ii = strstr (arg, "\tif\t")) != NULL ||
-      (ii = strstr (arg, " if(")) != NULL ||
-      (ii = strstr (arg, "\tif( ")) != NULL)
-    has_if = 1;
-  /* Temporarily zap out "if (condition)" to not confuse the
-     parenthesis-checking code below.  This is undone below. Do not
-     change ii!!  */
-  if (has_if)
-    {
-      *ii = '\0';
-    }
-
-  *is_quoted = (*arg
-               && strchr (get_gdb_completer_quote_characters (),
-                          *arg) != NULL);
-
-  *paren_pointer = strchr (arg, '(');
-  if (*paren_pointer != NULL)
-    *paren_pointer = strrchr (*paren_pointer, ')');
-
-  /* Now that we're safely past the paren_pointer check, put back " if
-     (condition)" so outer layers can see it.  */
-  if (has_if)
-    *ii = ' ';
-}
-
 \f
 
 /* Decode arg of the form *PC.  */
@@ -1102,8 +1058,9 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
       if (p[0] == '.' && strchr (p, ':') == NULL)
        {
          /* Java qualified method.  Find the *last* '.', since the
-            others are package qualifiers.  */
-         for (p1 = p; *p1; p1++)
+            others are package qualifiers.  Stop at any open parenthesis
+            which might provide overload information.  */
+         for (p1 = p; *p1 && *p1 != '('; p1++)
            {
              if (*p1 == '.')
                p = p1;
@@ -1255,6 +1212,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
   struct symbol *sym_class;
   struct symbol **sym_arr;
   struct type *t;
+  char *saved_java_argptr = NULL;
 
   /* First check for "global" namespace specification, of the form
      "::foo".  If found, skip over the colons and jump to normal
@@ -1303,7 +1261,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
       /* PASS2: p2->"::fun", p->":fun" */
 
       /* Move pointer ahead to next double-colon.  */
-      while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\''))
+      while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')
+            && (*p != '('))
        {
          if (current_language->la_language == language_cplus)
            p += cp_validate_operator (p);
@@ -1381,8 +1340,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
       else
        {
          /* At this point argptr->"fun".  */
+         char *a;
          p = *argptr;
-         while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
+         while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':'
+                && *p != '(')
            p++;
          /* At this point p->"".  String ended.  */
          /* Nope, C++ operators could have spaces in them
@@ -1394,6 +1355,42 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
              /* The above loop has already swallowed "operator".  */
              p += cp_validate_operator (p - 8) - 8;
            }
+
+         /* Keep any template parameters */
+         if (*p == '<')
+           p = find_template_name_end (p);
+
+         /* Keep method overload information.  */
+         a = strchr (p, '(');
+         if (a != NULL)
+           p = find_method_overload_end (a);
+
+         /* Make sure we keep important kewords like "const" */
+         if (strncmp (p, " const", 6) == 0)
+           p += 6;
+
+         /* Java may append typenames,  so assume that if there is
+            anything else left in *argptr, it must be a typename.  */
+         if (*p && current_language->la_language == language_java)
+           {
+             struct type *type;
+             p2 = p;
+             while (*p2)
+               ++p2;
+             copy = (char *) alloca (p2 - p + 1);
+             memcpy (copy, p, p2 - p);
+             copy[p2 - p] = '\0';
+             type = lookup_typename (current_language, get_current_arch (),
+                                     copy, NULL, 1);
+             if (type != NULL)
+               {
+                 /* Save the location of this just in case this
+                    method/type combination isn't actually defined.
+                    It will be checked later.  */
+                 saved_java_argptr = p;
+                 p = p2;
+               }
+           }
        }
 
       /* Allocate our own copy of the substring between argptr and
@@ -1422,9 +1419,26 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
         here, we return. If not, and we are at the and of the string,
         we'll lookup the whole string in the symbol tables.  */
 
-      return find_method (funfirstline, canonical, saved_arg,
-                         copy, t, sym_class, not_found_ptr);
-
+      values = find_method (funfirstline, canonical, saved_arg,
+                           copy, t, sym_class, not_found_ptr);
+      if (saved_java_argptr != NULL && values.nelts == 1)
+       {
+         /* The user specified a specific return type for a java method.
+            Double-check that it really is the one the user specified.
+            [This is a necessary evil because strcmp_iw_ordered stops
+            comparisons too prematurely.]  */
+         sym = find_pc_sect_function (values.sals[0].pc,
+                                      values.sals[0].section);
+         /* We just found a SAL, we had better be able to go backwards!  */
+         gdb_assert (sym != NULL);
+         if (strcmp_iw (SYMBOL_LINKAGE_NAME (sym), saved_arg) != 0)
+           {
+             xfree (values.sals);
+             error (_("the class `%s' does not have any method instance named %s\n"),
+                    SYMBOL_PRINT_NAME (sym_class), copy);
+           }
+       }
+      return values;
     } /* End if symbol found */
 
 
@@ -1548,8 +1562,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
     }
   if (i1 > 0)
     {
-      /* There is more than one field with that name
-        (overloaded).  Ask the user which one to use.  */
+      /* If we were given a specific overload instance, use that
+        (or error if no matches were found).  Otherwise ask the user
+        which one to use.  */
+      if (strchr (saved_arg, '(') != NULL)
+       {
+         int i;
+         for (i = 0; i < i1; ++i)
+           {
+             char *name = saved_arg;
+             char *canon = cp_canonicalize_string (name);
+             if (canon != NULL)
+               name = canon;
+
+             if (strcmp_iw (name, SYMBOL_LINKAGE_NAME (sym_arr[i])) == 0)
+               {
+                 values.sals = (struct symtab_and_line *)
+                   xmalloc (sizeof (struct symtab_and_line));
+                 values.nelts = 1;
+                 values.sals[0] = find_function_start_sal (sym_arr[i],
+                                                           funfirstline);
+                 if (canon)
+                   xfree (canon);
+                 return values;
+               }
+
+             if (canon)
+               xfree (canon);
+           }
+
+         error (_("the class `%s' does not have any method instance named %s\n"),
+                SYMBOL_PRINT_NAME (sym_class), copy);
+       }
+
       return decode_line_2 (sym_arr, i1, funfirstline, canonical);
     }
   else
@@ -1855,7 +1900,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
        {
          struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym));
          struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-         if (lookup_block_symbol (b, copy, NULL, VAR_DOMAIN) != NULL)
+         if (lookup_block_symbol (b, copy, VAR_DOMAIN) != NULL)
            build_canonical_line_spec (values.sals, copy, canonical);
        }
       return values;
index 1e8d48e68c1a2365d6767b242b3052f09d4b321a..95185d416eb67d265216c2b8cf3c6ecbf13add29 100644 (file)
@@ -62,9 +62,9 @@ scm_inferior_print (struct type *type, LONGEST value, struct ui_file *stream,
     {
       /* XXX: Should we cache these symbols?  */
       gdb_output_sym =
-       lookup_symbol_global ("gdb_output", NULL, NULL, VAR_DOMAIN);
+       lookup_symbol_global ("gdb_output", NULL, VAR_DOMAIN);
       gdb_output_len_sym =
-       lookup_symbol_global ("gdb_output_length", NULL, NULL, VAR_DOMAIN);
+       lookup_symbol_global ("gdb_output_length", NULL, VAR_DOMAIN);
 
       if ((gdb_output_sym == NULL) || (gdb_output_len_sym == NULL))
        ret = -1;
index 34925671114c39e13908a107c76d1e3ef747a4d5..4cf657b67632fe1937234ab5f1a47c0d179af302 100644 (file)
@@ -404,7 +404,6 @@ darwin_relocate_section_addresses (struct so_list *so,
 static struct symbol *
 darwin_lookup_lib_symbol (const struct objfile *objfile,
                          const char *name,
-                         const char *linkage_name,
                          const domain_enum domain)
 {
   return NULL;
index 75e6236203019f78e749aafa7b47f0f7b2770f3b..fb17d2c775dd0d76cdfe935c14223eec9e69f629 100644 (file)
@@ -326,16 +326,13 @@ spu_bfd_open (char *pathname)
 static struct symbol *
 spu_lookup_lib_symbol (const struct objfile *objfile,
                       const char *name,
-                      const char *linkage_name,
                       const domain_enum domain)
 {
   if (bfd_get_arch (objfile->obfd) == bfd_arch_spu)
-    return lookup_global_symbol_from_objfile (objfile, name, linkage_name,
-                                             domain);
+    return lookup_global_symbol_from_objfile (objfile, name, domain);
 
   if (svr4_so_ops.lookup_lib_global_symbol != NULL)
-    return svr4_so_ops.lookup_lib_global_symbol (objfile, name, linkage_name,
-                                                domain);
+    return svr4_so_ops.lookup_lib_global_symbol (objfile, name, domain);
   return NULL;
 }
 
index 0c6654f9112ea778bebd7e91406728b82285edcf..d4e8a8577afe404dd81eede7ac6782acb98eea9c 100644 (file)
@@ -2041,7 +2041,6 @@ struct target_so_ops svr4_so_ops;
 static struct symbol *
 elf_lookup_lib_symbol (const struct objfile *objfile,
                       const char *name,
-                      const char *linkage_name,
                       const domain_enum domain)
 {
   bfd *abfd;
@@ -2059,8 +2058,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
   if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
     return NULL;
 
-  return lookup_global_symbol_from_objfile
-               (objfile, name, linkage_name, domain);
+  return lookup_global_symbol_from_objfile (objfile, name, domain);
 }
 
 extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */
index 40a7a1ca62fec8cd754e29ed325cca16b745e0c8..8bac27bfd88e3fef795b9e59a0c7540fb412b117 100644 (file)
@@ -1178,13 +1178,12 @@ show_auto_solib_add (struct ui_file *file, int from_tty,
 struct symbol *
 solib_global_lookup (const struct objfile *objfile,
                     const char *name,
-                    const char *linkage_name,
                     const domain_enum domain)
 {
   struct target_so_ops *ops = solib_ops (target_gdbarch);
 
   if (ops->lookup_lib_global_symbol != NULL)
-    return ops->lookup_lib_global_symbol (objfile, name, linkage_name, domain);
+    return ops->lookup_lib_global_symbol (objfile, name, domain);
   return NULL;
 }
 
index 573f73665120d0f01347ca19893996c07c50ece0..51bfce970f4c12ea15c54a2ce7bc1bceecd484b8 100644 (file)
@@ -117,7 +117,6 @@ struct target_so_ops
     /* Hook for looking up global symbols in a library-specific way.  */
     struct symbol * (*lookup_lib_global_symbol) (const struct objfile *objfile,
                                                 const char *name,
-                                                const char *linkage_name,
                                                 const domain_enum domain);
 
     /* Given two so_list objects, one from the GDB thread list
@@ -157,7 +156,6 @@ extern struct target_so_ops *current_target_so_ops;
 /* Handler for library-specific global symbol lookup in solib.c.  */
 struct symbol *solib_global_lookup (const struct objfile *objfile,
                                    const char *name,
-                                   const char *linkage_name,
                                    const domain_enum domain);
 
 #endif
index 269ad2897b3f480da963e2a84f4659eb33ddad4e..17995db7ad0eeef9a8498026aa09e83620f13142 100644 (file)
@@ -1851,7 +1851,7 @@ spu_catch_start (struct objfile *objfile)
       struct symbol *sym;
       struct symtab_and_line sal;
 
-      sym = lookup_block_symbol (block, "main", NULL, VAR_DOMAIN);
+      sym = lookup_block_symbol (block, "main", VAR_DOMAIN);
       if (sym)
        {
          fixup_symbol_section (sym, objfile);
index 1f3eb9ebb9fffaa5d5999ccb825d9627cea5a716..d096d5cefb02d89816da67a41e0292bb86e95323 100644 (file)
@@ -1143,7 +1143,7 @@ maintenance_check_symtabs (char *ignore, int from_tty)
     while (length--)
       {
        sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
-                                  NULL, SYMBOL_DOMAIN (*psym));
+                                  SYMBOL_DOMAIN (*psym));
        if (!sym)
          {
            printf_filtered ("Static symbol `");
@@ -1160,7 +1160,7 @@ maintenance_check_symtabs (char *ignore, int from_tty)
     while (length--)
       {
        sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
-                                  NULL, SYMBOL_DOMAIN (*psym));
+                                  SYMBOL_DOMAIN (*psym));
        if (!sym)
          {
            printf_filtered ("Global symbol `");
index af4e501e1fc1919520743a29214b454253584022..67bd438cc4ef8b2873bfbfbf9c7a44c1843747f1 100644 (file)
@@ -85,7 +85,6 @@ static int find_line_common (struct linetable *, int, int *);
 char *operator_chars (char *p, char **end);
 
 static struct symbol *lookup_symbol_aux (const char *name,
-                                        const char *linkage_name,
                                         const struct block *block,
                                         const domain_enum domain,
                                         enum language language,
@@ -93,20 +92,17 @@ static struct symbol *lookup_symbol_aux (const char *name,
 
 static
 struct symbol *lookup_symbol_aux_local (const char *name,
-                                       const char *linkage_name,
                                        const struct block *block,
                                        const domain_enum domain);
 
 static
 struct symbol *lookup_symbol_aux_symtabs (int block_index,
                                          const char *name,
-                                         const char *linkage_name,
                                          const domain_enum domain);
 
 static
 struct symbol *lookup_symbol_aux_psymtabs (int block_index,
                                           const char *name,
-                                          const char *linkage_name,
                                           const domain_enum domain);
 
 static int file_matches (char *, char **, int);
@@ -498,7 +494,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
       || gsymbol->language == language_auto)
     {
       demangled =
-        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
+        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
       if (demangled != NULL)
        {
          gsymbol->language = language_cplus;
@@ -1257,7 +1253,6 @@ lookup_symbol_in_language (const char *name, const struct block *block,
 {
   char *demangled_name = NULL;
   const char *modified_name = NULL;
-  const char *mangled_name = NULL;
   struct symbol *returnval;
   struct cleanup *cleanup = make_cleanup (null_cleanup, 0);
 
@@ -1270,7 +1265,6 @@ lookup_symbol_in_language (const char *name, const struct block *block,
       demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
       if (demangled_name)
        {
-         mangled_name = name;
          modified_name = demangled_name;
          make_cleanup (xfree, demangled_name);
        }
@@ -1292,7 +1286,6 @@ lookup_symbol_in_language (const char *name, const struct block *block,
                                       DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA);
       if (demangled_name)
        {
-         mangled_name = name;
          modified_name = demangled_name;
          make_cleanup (xfree, demangled_name);
        }
@@ -1311,8 +1304,8 @@ lookup_symbol_in_language (const char *name, const struct block *block,
       modified_name = copy;
     }
 
-  returnval = lookup_symbol_aux (modified_name, mangled_name, block,
-                                domain, lang, is_a_field_of_this);
+  returnval = lookup_symbol_aux (modified_name, block, domain, lang,
+                                is_a_field_of_this);
   do_cleanups (cleanup);
 
   return returnval;
@@ -1336,9 +1329,9 @@ lookup_symbol (const char *name, const struct block *block,
    well.  */
 
 static struct symbol *
-lookup_symbol_aux (const char *name, const char *linkage_name,
-                  const struct block *block, const domain_enum domain,
-                  enum language language, int *is_a_field_of_this)
+lookup_symbol_aux (const char *name, const struct block *block,
+                  const domain_enum domain, enum language language,
+                  int *is_a_field_of_this)
 {
   struct symbol *sym;
   const struct language_defn *langdef;
@@ -1354,7 +1347,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
   /* Search specified block and its superiors.  Don't search
      STATIC_BLOCK or GLOBAL_BLOCK.  */
 
-  sym = lookup_symbol_aux_local (name, linkage_name, block, domain);
+  sym = lookup_symbol_aux_local (name, block, domain);
   if (sym != NULL)
     return sym;
 
@@ -1375,7 +1368,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
 
       if (function_block && !dict_empty (BLOCK_DICT (function_block)))
        sym = lookup_block_symbol (function_block, langdef->la_name_of_this,
-                                  NULL, VAR_DOMAIN);
+                                  VAR_DOMAIN);
       if (sym)
        {
          struct type *t = sym->type;
@@ -1403,7 +1396,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
   /* Now do whatever is appropriate for LANGUAGE to look
      up static and global variables.  */
 
-  sym = langdef->la_lookup_symbol_nonlocal (name, linkage_name, block, domain);
+  sym = langdef->la_lookup_symbol_nonlocal (name, block, domain);
   if (sym != NULL)
     return sym;
 
@@ -1413,11 +1406,11 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
      desired name as a file-level static, then do psymtab-to-symtab
      conversion on the fly and return the found symbol. */
 
-  sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, linkage_name, domain);
+  sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
   if (sym != NULL)
     return sym;
 
-  sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, linkage_name, domain);
+  sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, domain);
   if (sym != NULL)
     return sym;
 
@@ -1428,8 +1421,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
    Don't search STATIC_BLOCK or GLOBAL_BLOCK.  */
 
 static struct symbol *
-lookup_symbol_aux_local (const char *name, const char *linkage_name,
-                        const struct block *block,
+lookup_symbol_aux_local (const char *name, const struct block *block,
                         const domain_enum domain)
 {
   struct symbol *sym;
@@ -1442,7 +1434,7 @@ lookup_symbol_aux_local (const char *name, const char *linkage_name,
 
   while (block != static_block)
     {
-      sym = lookup_symbol_aux_block (name, linkage_name, block, domain);
+      sym = lookup_symbol_aux_block (name, block, domain);
       if (sym != NULL)
        return sym;
 
@@ -1485,13 +1477,12 @@ lookup_objfile_from_block (const struct block *block)
    block_found appropriately.  */
 
 struct symbol *
-lookup_symbol_aux_block (const char *name, const char *linkage_name,
-                        const struct block *block,
+lookup_symbol_aux_block (const char *name, const struct block *block,
                         const domain_enum domain)
 {
   struct symbol *sym;
 
-  sym = lookup_block_symbol (block, name, linkage_name, domain);
+  sym = lookup_block_symbol (block, name, domain);
   if (sym)
     {
       block_found = block;
@@ -1507,7 +1498,6 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name,
 struct symbol *
 lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
                                   const char *name,
-                                  const char *linkage_name,
                                   const domain_enum domain)
 {
   const struct objfile *objfile;
@@ -1526,7 +1516,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
         {
           bv = BLOCKVECTOR (s);
           block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-          sym = lookup_block_symbol (block, name, linkage_name, domain);
+          sym = lookup_block_symbol (block, name, domain);
           if (sym)
             {
               block_found = block;
@@ -1538,13 +1528,12 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
       ALL_OBJFILE_PSYMTABS (objfile, ps)
         {
           if (!ps->readin
-              && lookup_partial_symbol (ps, name, linkage_name,
-                                        1, domain))
+              && lookup_partial_symbol (ps, name, 1, domain))
             {
               s = PSYMTAB_TO_SYMTAB (ps);
               bv = BLOCKVECTOR (s);
               block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-              sym = lookup_block_symbol (block, name, linkage_name, domain);
+              sym = lookup_block_symbol (block, name, domain);
               return fixup_symbol_section (sym, (struct objfile *)objfile);
             }
         }
@@ -1559,8 +1548,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
    static symbols.  */
 
 static struct symbol *
-lookup_symbol_aux_symtabs (int block_index,
-                          const char *name, const char *linkage_name,
+lookup_symbol_aux_symtabs (int block_index, const char *name,
                           const domain_enum domain)
 {
   struct symbol *sym;
@@ -1573,7 +1561,7 @@ lookup_symbol_aux_symtabs (int block_index,
   {
     bv = BLOCKVECTOR (s);
     block = BLOCKVECTOR_BLOCK (bv, block_index);
-    sym = lookup_block_symbol (block, name, linkage_name, domain);
+    sym = lookup_block_symbol (block, name, domain);
     if (sym)
       {
        block_found = block;
@@ -1591,7 +1579,6 @@ lookup_symbol_aux_symtabs (int block_index,
 
 static struct symbol *
 lookup_symbol_aux_psymtabs (int block_index, const char *name,
-                           const char *linkage_name,
                            const domain_enum domain)
 {
   struct symbol *sym;
@@ -1605,13 +1592,12 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
   ALL_PSYMTABS (objfile, ps)
   {
     if (!ps->readin
-       && lookup_partial_symbol (ps, name, linkage_name,
-                                 psymtab_index, domain))
+       && lookup_partial_symbol (ps, name, psymtab_index, domain))
       {
        s = PSYMTAB_TO_SYMTAB (ps);
        bv = BLOCKVECTOR (s);
        block = BLOCKVECTOR_BLOCK (bv, block_index);
-       sym = lookup_block_symbol (block, name, linkage_name, domain);
+       sym = lookup_block_symbol (block, name, domain);
        if (!sym)
          {
            /* This shouldn't be necessary, but as a last resort try
@@ -1628,7 +1614,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
            block = BLOCKVECTOR_BLOCK (bv,
                                       block_index == GLOBAL_BLOCK ?
                                       STATIC_BLOCK : GLOBAL_BLOCK);
-           sym = lookup_block_symbol (block, name, linkage_name, domain);
+           sym = lookup_block_symbol (block, name, domain);
            if (!sym)
              error (_("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n%s may be an inlined function, or may be a template function\n(if a template, try specifying an instantiation: %s<type>)."),
                     block_index == GLOBAL_BLOCK ? "global" : "static",
@@ -1647,7 +1633,6 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
 
 struct symbol *
 basic_lookup_symbol_nonlocal (const char *name,
-                             const char *linkage_name,
                              const struct block *block,
                              const domain_enum domain)
 {
@@ -1681,11 +1666,11 @@ basic_lookup_symbol_nonlocal (const char *name,
      than that one, so I don't think we should worry about that for
      now.  */
 
-  sym = lookup_symbol_static (name, linkage_name, block, domain);
+  sym = lookup_symbol_static (name, block, domain);
   if (sym != NULL)
     return sym;
 
-  return lookup_symbol_global (name, linkage_name, block, domain);
+  return lookup_symbol_global (name, block, domain);
 }
 
 /* Lookup a symbol in the static block associated to BLOCK, if there
@@ -1693,14 +1678,13 @@ basic_lookup_symbol_nonlocal (const char *name,
 
 struct symbol *
 lookup_symbol_static (const char *name,
-                     const char *linkage_name,
                      const struct block *block,
                      const domain_enum domain)
 {
   const struct block *static_block = block_static_block (block);
 
   if (static_block != NULL)
-    return lookup_symbol_aux_block (name, linkage_name, static_block, domain);
+    return lookup_symbol_aux_block (name, static_block, domain);
   else
     return NULL;
 }
@@ -1710,7 +1694,6 @@ lookup_symbol_static (const char *name,
 
 struct symbol *
 lookup_symbol_global (const char *name,
-                     const char *linkage_name,
                      const struct block *block,
                      const domain_enum domain)
 {
@@ -1720,15 +1703,15 @@ lookup_symbol_global (const char *name,
   /* Call library-specific lookup procedure.  */
   objfile = lookup_objfile_from_block (block);
   if (objfile != NULL)
-    sym = solib_global_lookup (objfile, name, linkage_name, domain);
+    sym = solib_global_lookup (objfile, name, domain);
   if (sym != NULL)
     return sym;
 
-  sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, linkage_name, domain);
+  sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain);
   if (sym != NULL)
     return sym;
 
-  return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, linkage_name, domain);
+  return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, domain);
 }
 
 int
@@ -1752,14 +1735,11 @@ symbol_matches_domain (enum language symbol_language,
 }
 
 /* Look, in partial_symtab PST, for symbol whose natural name is NAME.
-   If LINKAGE_NAME is non-NULL, check in addition that the symbol's
-   linkage name matches it.  Check the global symbols if GLOBAL, the
-   static symbols if not */
+   Check the global symbols if GLOBAL, the static symbols if not. */
 
 struct partial_symbol *
 lookup_partial_symbol (struct partial_symtab *pst, const char *name,
-                      const char *linkage_name, int global,
-                      domain_enum domain)
+                      int global, domain_enum domain)
 {
   struct partial_symbol *temp;
   struct partial_symbol **start, **psym;
@@ -1811,9 +1791,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
        internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
 
       while (top <= real_top
-            && (linkage_name != NULL
-                ? strcmp (SYMBOL_LINKAGE_NAME (*top), linkage_name) == 0
-                : SYMBOL_MATCHES_SEARCH_NAME (*top,name)))
+            && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
        {
          if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
                                     SYMBOL_DOMAIN (*top), domain))
@@ -1830,15 +1808,9 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
       for (psym = start; psym < start + length; psym++)
        {
          if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
-                                    SYMBOL_DOMAIN (*psym), domain))
-           {
-             if (linkage_name != NULL
-                 ? strcmp (SYMBOL_LINKAGE_NAME (*psym), linkage_name) == 0
-                 : SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
-               {
-                 return (*psym);
-               }
-           }
+                                    SYMBOL_DOMAIN (*psym), domain)
+             && SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
+           return (*psym);
        }
     }
 
@@ -1880,7 +1852,7 @@ basic_lookup_transparent_type (const char *name)
   {
     bv = BLOCKVECTOR (s);
     block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-    sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+    sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
     if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
       {
        return SYMBOL_TYPE (sym);
@@ -1889,13 +1861,12 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_PSYMTABS (objfile, ps)
   {
-    if (!ps->readin && lookup_partial_symbol (ps, name, NULL,
-                                             1, STRUCT_DOMAIN))
+    if (!ps->readin && lookup_partial_symbol (ps, name, 1, STRUCT_DOMAIN))
       {
        s = PSYMTAB_TO_SYMTAB (ps);
        bv = BLOCKVECTOR (s);
        block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-       sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+       sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
        if (!sym)
          {
            /* This shouldn't be necessary, but as a last resort
@@ -1904,7 +1875,7 @@ basic_lookup_transparent_type (const char *name)
             * the psymtab gets it wrong in some cases.
             */
            block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-           sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+           sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
            if (!sym)
              error (_("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
@@ -1928,7 +1899,7 @@ basic_lookup_transparent_type (const char *name)
   {
     bv = BLOCKVECTOR (s);
     block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-    sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+    sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
     if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
       {
        return SYMBOL_TYPE (sym);
@@ -1937,12 +1908,12 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_PSYMTABS (objfile, ps)
   {
-    if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 0, STRUCT_DOMAIN))
+    if (!ps->readin && lookup_partial_symbol (ps, name, 0, STRUCT_DOMAIN))
       {
        s = PSYMTAB_TO_SYMTAB (ps);
        bv = BLOCKVECTOR (s);
        block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-       sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+       sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
        if (!sym)
          {
            /* This shouldn't be necessary, but as a last resort
@@ -1951,7 +1922,7 @@ basic_lookup_transparent_type (const char *name)
             * the psymtab gets it wrong in some cases.
             */
            block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-           sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN);
+           sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
            if (!sym)
              error (_("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
@@ -1978,7 +1949,7 @@ find_main_psymtab (void)
 
   ALL_PSYMTABS (objfile, pst)
   {
-    if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_DOMAIN))
+    if (lookup_partial_symbol (pst, main_name (), 1, VAR_DOMAIN))
       {
        return (pst);
       }
@@ -1996,14 +1967,10 @@ find_main_psymtab (void)
    search on the symbols.  Each symbol which is marked as being a ObjC/C++
    symbol (language_cplus or language_objc set) has both the encoded and
    non-encoded names tested for a match.
-
-   If LINKAGE_NAME is non-NULL, verify that any symbol we find has this
-   particular mangled name.
 */
 
 struct symbol *
 lookup_block_symbol (const struct block *block, const char *name,
-                    const char *linkage_name,
                     const domain_enum domain)
 {
   struct dict_iterator iter;
@@ -2016,9 +1983,7 @@ lookup_block_symbol (const struct block *block, const char *name,
           sym = dict_iter_name_next (name, &iter))
        {
          if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
-                                    SYMBOL_DOMAIN (sym), domain)
-             && (linkage_name != NULL
-                 ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1))
+                                    SYMBOL_DOMAIN (sym), domain))
            return sym;
        }
       return NULL;
@@ -2038,9 +2003,7 @@ lookup_block_symbol (const struct block *block, const char *name,
           sym = dict_iter_name_next (name, &iter))
        {
          if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
-                                    SYMBOL_DOMAIN (sym), domain)
-             && (linkage_name != NULL
-                 ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1))
+                                    SYMBOL_DOMAIN (sym), domain))
            {
              sym_found = sym;
              if (!SYMBOL_IS_ARGUMENT (sym))
index 167dfe82ec32c675669fdcc6c151a1461009de1e..77300f7bb64b6eec94a149bbc27eab544b85f627 100644 (file)
@@ -172,9 +172,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
 #define SYMBOL_SECTION(symbol)         (symbol)->ginfo.section
 #define SYMBOL_OBJ_SECTION(symbol)     (symbol)->ginfo.obj_section
 
-#define SYMBOL_CPLUS_DEMANGLED_NAME(symbol)    \
-  (symbol)->ginfo.language_specific.cplus_specific.demangled_name
-
 /* Initializes the language dependent portion of a symbol
    depending upon the language for the symbol. */
 #define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \
@@ -994,7 +991,6 @@ extern struct symbol *lookup_symbol (const char *, const struct block *,
    that can't think of anything better to do.  */
 
 extern struct symbol *basic_lookup_symbol_nonlocal (const char *,
-                                                   const char *,
                                                    const struct block *,
                                                    const domain_enum);
 
@@ -1005,7 +1001,6 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *,
    is one; do nothing if BLOCK is NULL or a global block.  */
 
 extern struct symbol *lookup_symbol_static (const char *name,
-                                           const char *linkage_name,
                                            const struct block *block,
                                            const domain_enum domain);
 
@@ -1013,7 +1008,6 @@ extern struct symbol *lookup_symbol_static (const char *name,
    necessary).  */
 
 extern struct symbol *lookup_symbol_global (const char *name,
-                                           const char *linkage_name,
                                            const struct block *block,
                                            const domain_enum domain);
 
@@ -1022,21 +1016,18 @@ extern struct symbol *lookup_symbol_global (const char *name,
    will fix up the symbol if necessary.  */
 
 extern struct symbol *lookup_symbol_aux_block (const char *name,
-                                              const char *linkage_name,
                                               const struct block *block,
                                               const domain_enum domain);
 
 /* Lookup a partial symbol.  */
 
 extern struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
-                                                    const char *,
                                                     const char *, int,
                                                     domain_enum);
 
 /* lookup a symbol by name, within a specified block */
 
 extern struct symbol *lookup_block_symbol (const struct block *, const char *,
-                                          const char *,
                                           const domain_enum);
 
 /* lookup a [struct, union, enum] by name, within a specified block */
@@ -1372,7 +1363,6 @@ extern /*const */ char *main_name (void);
 /* Check global symbols in objfile.  */
 struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile,
                                                  const char *name,
-                                                 const char *linkage_name,
                                                  const domain_enum domain);
 
 extern struct symtabs_and_lines
index 7d7e6bce8dabaad3114a6a75562acc6c82176ef2..6ee65cf1e65dfe0f91e0863cbdb93cb5169a83b7 100644 (file)
 #ifndef TYPEPRINT_H
 #define TYPEPRINT_H
 
+enum language;
 struct ui_file;
 
 void print_type_scalar (struct type * type, LONGEST, struct ui_file *);
 
 void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
                                  int, int);
+
+void c_type_print_args (struct type *, struct ui_file *, int, enum language);
 #endif
index e6aaf93439a3925551adda34e081ba9323ddbf34..1760b4c05288cf3b60329f4f34e23ab771fd9403 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "ui-file.h"
+#include "gdb_obstack.h"
 #include "gdb_string.h"
 #include "gdb_select.h"
 
@@ -264,7 +265,7 @@ set_ui_file_data (struct ui_file *file, void *data,
 }
 
 /* ui_file utility function for converting a ``struct ui_file'' into
-   a memory buffer''. */
+   a memory buffer. */
 
 struct accumulated_ui_file
 {
@@ -298,6 +299,23 @@ ui_file_xstrdup (struct ui_file *file, long *length)
     *length = acc.length;
   return acc.buffer;
 }
+
+static void
+do_ui_file_obsavestring (void *context, const char *buffer, long length)
+{
+  struct obstack *obstack = (struct obstack *) context;
+  obstack_grow (obstack, buffer, length);
+}
+
+char *
+ui_file_obsavestring (struct ui_file *file, struct obstack *obstack,
+                     long *length)
+{
+  ui_file_put (file, do_ui_file_obsavestring, obstack);
+  *length = obstack_object_size (obstack);
+  obstack_1grow (obstack, '\0');
+  return obstack_finish (obstack);
+}
 \f
 /* A pure memory based ``struct ui_file'' that can be used an output
    buffer. The buffers accumulated contents are available via
index 615569941bac97857975578c2bc7aed0ec219a72..bb94f4bdd37df4453eb92c9d634ab238ca9e7485 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef UI_FILE_H
 #define UI_FILE_H
 
+struct obstack;
 struct ui_file;
 
 /* Create a generic ui_file object with null methods. */
@@ -78,7 +79,10 @@ extern void ui_file_put (struct ui_file *src, ui_file_put_method_ftype *write, v
    minus that appended NUL. */
 extern char *ui_file_xstrdup (struct ui_file *file, long *length);
 
-
+/* Similar to ui_file_xstrdup, but return a new string allocated on
+   OBSTACK.  */
+extern char *ui_file_obsavestring (struct ui_file *file,
+                                  struct obstack *obstack, long *length);
 
 extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
 
index b94c411f062619311eae84be313fd4ee8429d84d..4a7a3349adb2a4af75167f3978bfb050dc488a10 100644 (file)
@@ -2346,12 +2346,25 @@ find_overload_match (struct type **arg_types, int nargs,
   if (method)
     {
       gdb_assert (obj);
+
+      /* OBJ may be a pointer value rather than the object itself.  */
+      obj = coerce_ref (obj);
+      while (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_PTR)
+       obj = coerce_ref (value_ind (obj));
       obj_type_name = TYPE_NAME (value_type (obj));
-      /* Hack: evaluate_subexp_standard often passes in a pointer
-         value rather than the object itself, so try again.  */
-      if ((!obj_type_name || !*obj_type_name) 
-         && (TYPE_CODE (value_type (obj)) == TYPE_CODE_PTR))
-       obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (value_type (obj)));
+
+      /* First check whether this is a data member, e.g. a pointer to
+        a function.  */
+      if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT)
+       {
+         *valp = search_struct_field (name, obj, 0,
+                                      check_typedef (value_type (obj)), 0);
+         if (*valp)
+           {
+             *staticp = 1;
+             return 0;
+           }
+       }
 
       fns_ptr = value_find_oload_method_list (&temp, name, 
                                              0, &num_fns, 
@@ -2371,16 +2384,29 @@ find_overload_match (struct type **arg_types, int nargs,
     }
   else
     {
-      const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym);
+      const char *qualified_name = SYMBOL_NATURAL_NAME (fsym);
 
-      /* If we have a C++ name, try to extract just the function
-        part.  */
-      if (qualified_name)
-       func_name = cp_func_name (qualified_name);
+      /* If we have a function with a C++ name, try to extract just
+        the function part.  Do not try this for non-functions (e.g.
+        function pointers).  */
+      if (qualified_name
+         && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC)
+       {
+         func_name = cp_func_name (qualified_name);
+
+         /* If cp_func_name did not remove anything, the name of the
+            symbol did not include scope or argument types - it was
+            probably a C-style function.  */
+         if (func_name && strcmp (func_name, qualified_name) == 0)
+           {
+             xfree (func_name);
+             func_name = NULL;
+           }
+       }
 
-      /* If there was no C++ name, this must be a C-style function.
-        Just return the same symbol.  Do the same if cp_func_name
-        fails for some reason.  */
+      /* If there was no C++ name, this must be a C-style function or
+        not a function at all.  Just return the same symbol.  Do the
+        same if cp_func_name fails for some reason.  */
       if (func_name == NULL)
         {
          *symp = fsym;
@@ -3117,7 +3143,7 @@ value_maybe_namespace_elt (const struct type *curtype,
   struct symbol *sym;
   struct value *result;
 
-  sym = cp_lookup_symbol_namespace (namespace_name, name, NULL,
+  sym = cp_lookup_symbol_namespace(namespace_name, name,
                                    get_selected_block (0), 
                                    VAR_DOMAIN, 1);
 
@@ -3261,7 +3287,7 @@ value_of_local (const char *name, int complain)
 
   /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
      symbol instead of the LOC_ARG one (if both exist).  */
-  sym = lookup_block_symbol (b, name, NULL, VAR_DOMAIN);
+  sym = lookup_block_symbol (b, name, VAR_DOMAIN);
   if (sym == NULL)
     {
       if (complain)
index a462ee494495faa1408796591d1b73c000f536a1..b9c4722461d5661e95ad098aba3c520b8af8a78e 100644 (file)
@@ -1819,7 +1819,9 @@ value_static_field (struct type *type, int fieldno)
   else
     {
       char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
+       /*TYPE_FIELD_NAME (type, fieldno);*/
       struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
+
       if (sym == NULL)
        {
          /* With some compilers, e.g. HP aCC, static data members are reported
This page took 0.060073 seconds and 4 git commands to generate.