diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-06-05 13:50:13 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-06-05 13:50:13 +0000 |
commit | ccab2054e904cf3118da605d1c075b4f6e12e544 (patch) | |
tree | 69791eb43a795f29cb5ed37fe0faa951004cf4d2 /gdb/breakpoint.c | |
parent | e23d4a9c473403eeda73b321da0276a6b590465f (diff) | |
download | gdb-ccab2054e904cf3118da605d1c075b4f6e12e544.zip gdb-ccab2054e904cf3118da605d1c075b4f6e12e544.tar.gz gdb-ccab2054e904cf3118da605d1c075b4f6e12e544.tar.bz2 |
stop parsing breakpoint command if invalid keyword found
With an Ada program, trying to break on a specific Ada task, but
with the wrong capitalization of the `task' keyword, we currently
get only pieces of the "garbage" that caused the error:
(gdb) b *rendez_vous'address TASK 2
Garbage 2 at end of command
Pushing this a little further:
(gdb) b *rendez_vous'address TASK Task TaSK 2
Garbage 2 at end of command
Another interesting failure mode:
(gdb) b *rendez_vous'address TASK if
Argument required (expression to compute).
The parser skipped `TASK', then found the `if' keyword, and thus
started looking for a condition.
This patch fixes the problem by aborting the parsing as soon as
an invalid keyword is found. This makes it consistent with the
case where the REST parameter is passed as NULL (where an error
is raised immediately after seeing the first invalid keyword).
It also introduces a new testcase that reproduces all above scenarios.
gdb/ChangeLog:
* breakpoint.c (find_condition_and_thread): Stop parsing
as soon as the first invalid keyword is found.
gdb/testsuite/ChangeLog:
* gdb.ada/bad-task-bp-keyword: New testcase.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a867b10..5cc1f64 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8940,7 +8940,7 @@ find_condition_and_thread (char *tok, CORE_ADDR pc, else if (rest) { *rest = savestring (tok, strlen (tok)); - tok += toklen; + return; } else error (_("Junk at end of arguments.")); |