* i386-tdep.c (i386_coff_osabi_sniffer): Add "coff-go32" to the
[deliverable/binutils-gdb.git] / gdb / linespec.c
index ef3a28c39623b4e62ca9511773990ed354d8c5be..8e51021fc44a071d58eb75973d93fb0c4481dae5 100644 (file)
@@ -130,6 +130,7 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
                         (struct symtab **) NULL)))
     {
       int method_counter;
+      int name_len = strlen (name);
 
       CHECK_TYPEDEF (t);
 
@@ -202,6 +203,41 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
                     */
                  }
              }
+         else if (strncmp (class_name, name, name_len) == 0
+                  && (class_name[name_len] == '\0'
+                      || class_name[name_len] == '<'))
+           {
+             /* For GCC 3.x and stabs, constructors and destructors have names
+                like __base_ctor and __complete_dtor.  Check the physname for now
+                if we're looking for a constructor.  */
+             for (field_counter
+                    = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
+                  field_counter >= 0;
+                  --field_counter)
+               {
+                 struct fn_field *f;
+                 char *phys_name;
+                 
+                 f = TYPE_FN_FIELDLIST1 (t, method_counter);
+
+                 /* GCC 3.x will never produce stabs stub methods, so we don't need
+                    to handle this case.  */
+                 if (TYPE_FN_FIELD_STUB (f, field_counter))
+                   continue;
+                 phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
+                 if (! is_constructor_name (phys_name))
+                   continue;
+
+                 /* If this method is actually defined, include it in the
+                    list.  */
+                 sym_arr[i1] = lookup_symbol (phys_name,
+                                              NULL, VAR_NAMESPACE,
+                                              (int *) NULL,
+                                              (struct symtab **) NULL);
+                 if (sym_arr[i1])
+                   i1++;
+               }
+           }
        }
     }
 
@@ -265,7 +301,9 @@ build_canonical_line_spec (struct symtab_and_line *sal, char *symname,
 
 /* Find an instance of the character C in the string S that is outside
    of all parenthesis pairs, single-quoted strings, and double-quoted
-   strings.  */
+   strings.  Also, ignore the char within a template name, like a ','
+   within foo<int, int>.  */
+
 static char *
 find_toplevel_char (char *s, char c)
 {
@@ -288,9 +326,9 @@ find_toplevel_char (char *s, char c)
        return scan;
       else if (*scan == '"' || *scan == '\'')
        quoted = *scan;
-      else if (*scan == '(')
+      else if (*scan == '(' || *scan == '<')
        depth++;
-      else if (*scan == ')' && depth > 0)
+      else if ((*scan == ')' || *scan == '>') && depth > 0)
        depth--;
     }
 
@@ -896,20 +934,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
       if ((*p == '"') && is_quote_enclosed)
        --p;
       copy = (char *) alloca (p - *argptr + 1);
-      if ((**argptr == '"') && is_quote_enclosed)
-       {
-         memcpy (copy, *argptr + 1, p - *argptr - 1);
-         /* It may have the ending quote right after the file name */
-         if (copy[p - *argptr - 2] == '"')
-           copy[p - *argptr - 2] = 0;
-         else
-           copy[p - *argptr - 1] = 0;
-       }
+      memcpy (copy, *argptr, p - *argptr);
+      /* It may have the ending quote right after the file name */
+      if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
+       copy[p - *argptr - 1] = 0;
       else
-       {
-         memcpy (copy, *argptr, p - *argptr);
-         copy[p - *argptr] = 0;
-       }
+       copy[p - *argptr] = 0;
 
       /* Find that file's data.  */
       s = lookup_symtab (copy);
@@ -1154,7 +1184,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
 
   sym = lookup_symbol (copy,
                       (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
-                       : get_selected_block ()),
+                       : get_selected_block (0)),
                       VAR_NAMESPACE, 0, &sym_symtab);
 
 symbol_found:                  /* We also jump here from inside the C++ class/namespace 
@@ -1180,7 +1210,7 @@ symbol_found:                     /* We also jump here from inside the C++ class/namespace
            {
              struct blockvector *bv = BLOCKVECTOR (sym_symtab);
              struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-             if (lookup_block_symbol (b, copy, VAR_NAMESPACE) != NULL)
+             if (lookup_block_symbol (b, copy, NULL, VAR_NAMESPACE) != NULL)
                build_canonical_line_spec (values.sals, copy, canonical);
            }
          return values;
This page took 0.026603 seconds and 4 git commands to generate.