gdb/mi: handle no condition argument case for -break-condition
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 26 Jul 2021 06:25:03 +0000 (08:25 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 26 Jul 2021 06:28:12 +0000 (08:28 +0200)
commit86271cfa326990fc05b5abada2831da161c0bf4b
treeee05fbe5cc18d04df539a9bccda3244c36d1ae5d
parentfc3f144a3e12c8ea37cd85c6a12f4ff77ce6e601
gdb/mi: handle no condition argument case for -break-condition

As reported in PR gdb/28076 [1], passing no condition argument to the
-break-condition command (e.g.: "-break-condition 2") should clear the
condition for breakpoint 2, just like CLI's "condition 2", but instead
an error message is returned:

  ^error,msg="-break-condition: Missing the <number> and/or <expr> argument"

The current implementation of the -break-condition command's argument
handling (79aabb7308c "gdb/mi: add a '--force' flag to the
'-break-condition' command") was done according to the documentation,
where the condition argument seemed mandatory.  However, the
-break-condition command originally (i.e. before the 79aabb7308c
patch) used the CLI's "cond" command, and back then not passing a
condition argument was clearing out the condition.  So, this is a
regression in terms of the behavior.

Fix the argument handling of the -break-condition command to allow not
having a condition argument, and also update the document to make the
behavior clear.  Also add test cases to test the scenarios which were
previously not covered.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=28076

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

PR gdb/28076
* mi/mi-cmd-break.c (mi_cmd_break_condition): Handle the case
of having no condition argument.

gdb/doc/ChangeLog:
2021-07-26  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

PR gdb/28076
* gdb.texinfo (GDB/MI Breakpoint Commands): Mention clearing
the condition in the -break-condition command.

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

PR gdb/28076
* gdb.mi/mi-break.exp: Add more tests to check clearing the
breakpoint condition.
gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/mi/mi-cmd-break.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-break.exp
This page took 0.02592 seconds and 4 git commands to generate.