stop parsing breakpoint command if invalid keyword found
authorJoel Brobecker <brobecker@gnat.com>
Tue, 5 Jun 2012 13:50:13 +0000 (13:50 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 5 Jun 2012 13:50:13 +0000 (13:50 +0000)
commitccab2054e904cf3118da605d1c075b4f6e12e544
tree69791eb43a795f29cb5ed37fe0faa951004cf4d2
parente23d4a9c473403eeda73b321da0276a6b590465f
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.
gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb [new file with mode: 0644]
This page took 0.043131 seconds and 4 git commands to generate.