]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/linespec.c
gdb: Delete SYMBOL_OBJ_SECTION and MSYMBOL_OBJ_SECTION
[thirdparty/binutils-gdb.git] / gdb / linespec.c
index 3bf16c504a267fb0135f6f9e13caca3a91c54a01..9bfa159514ef19b32d2be9c67f5e2afabb674a1d 100644 (file)
@@ -1,6 +1,6 @@
 /* Parser for linespec for the GNU debugger, GDB.
 
-   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -477,32 +477,45 @@ linespec_lexer_lex_keyword (const char *p)
        {
          int len = strlen (linespec_keywords[i]);
 
-         /* If P begins with one of the keywords and the next
-            character is whitespace, we may have found a keyword.
-            It is only a keyword if it is not followed by another
-            keyword.  */
-         if (strncmp (p, linespec_keywords[i], len) == 0
-             && isspace (p[len]))
+         /* If P begins with
+
+            - "thread" or "task" and the next character is
+            whitespace, we may have found a keyword.  It is only a
+            keyword if it is not followed by another keyword.
+
+            - "-force-condition", the next character may be EOF
+            since this keyword does not take any arguments.  Otherwise,
+            it should be followed by a keyword.
+
+            - "if", ALWAYS stop the lexer, since it is not possible to
+            predict what is going to appear in the condition, which can
+            only be parsed after SaLs have been found.  */
+         if (strncmp (p, linespec_keywords[i], len) == 0)
            {
              int j;
 
-             /* Special case: "-force" is always followed by an "if".  */
+             if (i == FORCE_KEYWORD_INDEX && p[len] == '\0')
+               return linespec_keywords[i];
+
+             if (!isspace (p[len]))
+               continue;
+
              if (i == FORCE_KEYWORD_INDEX)
                {
                  p += len;
                  p = skip_spaces (p);
-                 int nextlen = strlen (linespec_keywords[IF_KEYWORD_INDEX]);
-                 if (!(strncmp (p, linespec_keywords[IF_KEYWORD_INDEX], nextlen) == 0
-                       && isspace (p[nextlen])))
-                   return NULL;
-               }
+                 for (j = 0; linespec_keywords[j] != NULL; ++j)
+                   {
+                     int nextlen = strlen (linespec_keywords[j]);
 
-             /* Special case: "if" ALWAYS stops the lexer, since it
-                is not possible to predict what is going to appear in
-                the condition, which can only be parsed after SaLs have
-                been found.  */
+                     if (strncmp (p, linespec_keywords[j], nextlen) == 0
+                         && isspace (p[nextlen]))
+                       return linespec_keywords[i];
+                   }
+               }
              else if (i != IF_KEYWORD_INDEX)
                {
+                 /* We matched a "thread" or "task".  */
                  p += len;
                  p = skip_spaces (p);
                  for (j = 0; linespec_keywords[j] != NULL; ++j)
@@ -4245,7 +4258,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
       sal.pspace = current_program_space;
     }
 
-  sal.section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
+  sal.section = msymbol->obj_section (objfile);
 
   if (maybe_add_address (self->addr_set, objfile->pspace, sal.pc))
     add_sal_to_sals (self, result, &sal, msymbol->natural_name (), 0);