gdb/linespec: relax the position of the '-force-condition' flag

The break command's "-force-condition" flag is currently required to
be followed by the "if" keyword.  This prevents flexibility when using
other keywords, e.g. "thread":

  (gdb) break main -force-condition thread 1 if foo
  Function "main -force-condition" not defined.
  Make breakpoint pending on future shared library load? (y or [n]) n

Remove the requirement that "-force-condition" is always followed by
an "if", so that more flexibility is obtained when positioning
keywords.

gdb/ChangeLog:
2020-12-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* linespec.c (linespec_lexer_lex_keyword): The "-force-condition"
	keyword may be followed by any keyword.
	* breakpoint.c (find_condition_and_thread): Advance 'tok' by
	'toklen' in the case for "-force-condition".

gdb/testsuite/ChangeLog:
2020-12-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.linespec/keywords.exp: Add tests to check positional
	flexibility of "-force-condition".
This commit is contained in:
Tankut Baris Aktemur
2020-12-07 09:20:31 +01:00
parent 21e051b3d6
commit 5759831a2d
5 changed files with 54 additions and 17 deletions

View File

@@ -9263,7 +9263,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
}
else if (toklen >= 1 && strncmp (tok, "-force-condition", toklen) == 0)
{
tok = cond_start = end_tok + 1;
tok = tok + toklen;
force = true;
}
else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)