* ui-out.c (ui_out_get_field_separator): Remove unused function.
[deliverable/binutils-gdb.git] / gdb / objc-lang.c
index 26b7fb1d124cd2eb677f865c8061d988d00edf09..592b52e3ca2c25a39427b3dd624d3165893cd0f5 100644 (file)
@@ -720,7 +720,8 @@ selectors_info (char *regexp, int from_tty)
        strcpy(myregexp, ".*]");
       else
        {
-         if (sizeof (myregexp) < strlen (regexp) + 1)
+         /* Allow a few extra bytes because of the strcat below.  */
+         if (sizeof (myregexp) < strlen (regexp) + 4)
            error (_("Regexp is too long: %s"), regexp);
          strcpy(myregexp, regexp);
          if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */
@@ -742,19 +743,26 @@ selectors_info (char *regexp, int from_tty)
     {
       QUIT;
       name = SYMBOL_NATURAL_NAME (msymbol);
-      if (name &&
-        (name[0] == '-' || name[0] == '+') &&
-         name[1] == '[')               /* Got a method name.  */
+      if (name
+          && (name[0] == '-' || name[0] == '+')
+         && name[1] == '[')            /* Got a method name.  */
        {
          /* Filter for class/instance methods.  */
          if (plusminus && name[0] != plusminus)
            continue;
          /* Find selector part.  */
-         name = (char *) strchr(name+2, ' ');
+         name = (char *) strchr (name+2, ' ');
+         if (name == NULL)
+           {
+             complaint (&symfile_complaints, 
+                        _("Bad method name '%s'"), 
+                        SYMBOL_NATURAL_NAME (msymbol));
+             continue;
+           }
          if (regexp == NULL || re_exec(++name) != 0)
            { 
              char *mystart = name;
-             char *myend   = (char *) strchr(mystart, ']');
+             char *myend   = (char *) strchr (mystart, ']');
              
              if (myend && (myend - mystart > maxlen))
                maxlen = myend - mystart;       /* Get longest selector.  */
@@ -863,6 +871,9 @@ classes_info (char *regexp, int from_tty)
     strcpy(myregexp, ".* ");   /* Null input: match all objc classes.  */
   else
     {
+      /* Allow a few extra bytes because of the strcat below.  */
+      if (sizeof (myregexp) < strlen (regexp) + 4)
+       error (_("Regexp is too long: %s"), regexp);
       strcpy(myregexp, regexp);
       if (myregexp[strlen(myregexp) - 1] == '$')
        /* In the method name, the end of the class name is marked by ' '.  */
@@ -1210,6 +1221,8 @@ find_methods (struct symtab *symtab, char type,
          pc = gdbarch_convert_from_func_ptr_addr (gdbarch, pc,
                                                   &current_target);
 
+         objfile_csym++;
+
          if (symtab)
            if (pc < BLOCK_START (block) || pc >= BLOCK_END (block))
              /* Not in the specified symtab.  */
@@ -1226,8 +1239,6 @@ find_methods (struct symtab *symtab, char type,
          if (parse_method (tmp, &ntype, &nclass,
                            &ncategory, &nselector) == NULL)
            continue;
-      
-         objfile_csym++;
 
          if ((type != '\0') && (ntype != type))
            continue;
This page took 0.024388 seconds and 4 git commands to generate.