]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
number_or_range_parser::get_number, don't treat "1 -" as a range
authorPedro Alves <palves@redhat.com>
Wed, 12 Jun 2019 23:06:53 +0000 (00:06 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 12 Jun 2019 23:18:09 +0000 (00:18 +0100)
commit2c722807a752ce468b04fcf6d29857f377beeaf5
tree68e88585cf81f0389104360d4208dd3c7b4b6e8c
parentdee7b4c83a636471ee321fb4fe1c3be0a16a9ea7
number_or_range_parser::get_number, don't treat "1 -" as a range

While adding -OPT options to "frame apply level", I noticed that:

 (gdb) frame apply level 0 -[TAB]

wasn't completing on the supported options.  This commit fixes it.
We'll get instead:

  (gdb) frame apply level 0 -
  -c           -past-entry  -past-main   -q           -s

I added the isspace check because this case:

  (gdb) frame apply level 0-

can't be an option.

Tests for this will be in a new gdb.base/options.exp file, in a
following patch.  It will exercise all of:

  (gdb) frame apply level 0-
  (gdb) frame apply level 0 -
  (gdb) frame apply level 0 --
  (gdb) frame apply level 0 -- -

gdb/ChangeLog:
2019-06-13  Pedro Alves  <palves@redhat.com>

* cli/cli-utils.c (number_or_range_parser::get_number): Do not
parse a range if "-" is at the end of the string.
gdb/ChangeLog
gdb/cli/cli-utils.c