mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
Breakpoint location parsing: always error instead of warning
It's odd that when parsing a breakpoint or location number, we error out in most cases, but warn in others. (gdb) disable 1- bad breakpoint number at or near: '1-' (gdb) disable -1 bad breakpoint number at or near: '-1' (gdb) disable .foo bad breakpoint number at or near: '.foo' (gdb) disable foo.1 Bad breakpoint number 'foo.1' (gdb) disable 1.foo warning: bad breakpoint number at or near '1.foo' This changes GDB to always error out. It required touching one testcase that expected the warning. gdb/ChangeLog: 2017-11-07 Pedro Alves <palves@redhat.com> * breakpoint.c (extract_bp_number_and_location): Change return type to void. Throw error instead of warning. (enable_disable_command): Adjust. gdb/testsuite/ChangeLog: 2017-11-07 Pedro Alves <palves@redhat.com> * gdb.base/ena-dis-br.exp: Don't expect "warning:".
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-11-07 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* breakpoint.c (extract_bp_number_and_location): Change return
|
||||||
|
type to void. Throw error instead of warning.
|
||||||
|
(enable_disable_command): Adjust.
|
||||||
|
|
||||||
2017-11-07 Xavier Roirand <roirand@adacore.com>
|
2017-11-07 Xavier Roirand <roirand@adacore.com>
|
||||||
Pedro Alves <palves@redhat.com>
|
Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
@ -14225,7 +14225,7 @@ find_location_by_number (int bp_num, int loc_num)
|
|||||||
location number range.
|
location number range.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
extract_bp_number_and_location (const std::string &arg,
|
extract_bp_number_and_location (const std::string &arg,
|
||||||
std::pair<int, int> &bp_num_range,
|
std::pair<int, int> &bp_num_range,
|
||||||
std::pair<int, int> &bp_loc_range)
|
std::pair<int, int> &bp_loc_range)
|
||||||
@ -14267,10 +14267,7 @@ extract_bp_number_and_location (const std::string &arg,
|
|||||||
const char *ptls = bp_loc;
|
const char *ptls = bp_loc;
|
||||||
bp_loc_range.first = get_number_trailer (&ptls, '\0');
|
bp_loc_range.first = get_number_trailer (&ptls, '\0');
|
||||||
if (bp_loc_range.first == 0)
|
if (bp_loc_range.first == 0)
|
||||||
{
|
error (_("bad breakpoint number at or near '%s'"), arg.c_str ());
|
||||||
warning (_("bad breakpoint number at or near '%s'"), arg.c_str ());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bp_loc_range.second = bp_loc_range.first;
|
bp_loc_range.second = bp_loc_range.first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14294,10 +14291,7 @@ extract_bp_number_and_location (const std::string &arg,
|
|||||||
const char *ptf = arg.c_str ();
|
const char *ptf = arg.c_str ();
|
||||||
bp_num_range.first = get_number (&ptf);
|
bp_num_range.first = get_number (&ptf);
|
||||||
if (bp_num_range.first == 0)
|
if (bp_num_range.first == 0)
|
||||||
{
|
error (_("bad breakpoint number at or near '%s'"), arg.c_str ());
|
||||||
warning (_("bad breakpoint number at or near '%s'"), arg.c_str ());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bp_num_range.second = bp_num_range.first;
|
bp_num_range.second = bp_num_range.first;
|
||||||
}
|
}
|
||||||
bp_loc_range.first = 0;
|
bp_loc_range.first = 0;
|
||||||
@ -14306,8 +14300,6 @@ extract_bp_number_and_location (const std::string &arg,
|
|||||||
|
|
||||||
if (bp_num_range.first == 0 || bp_num_range.second == 0)
|
if (bp_num_range.first == 0 || bp_num_range.second == 0)
|
||||||
error (_("bad breakpoint number at or near: '%s'"), arg.c_str ());
|
error (_("bad breakpoint number at or near: '%s'"), arg.c_str ());
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable or disable a breakpoint location BP_NUM.LOC_NUM. ENABLE
|
/* Enable or disable a breakpoint location BP_NUM.LOC_NUM. ENABLE
|
||||||
@ -14408,8 +14400,8 @@ enable_disable_command (const char *args, int from_tty, bool enable)
|
|||||||
{
|
{
|
||||||
std::pair<int, int> bp_num_range, bp_loc_range;
|
std::pair<int, int> bp_num_range, bp_loc_range;
|
||||||
|
|
||||||
if (extract_bp_number_and_location (num, bp_num_range, bp_loc_range))
|
extract_bp_number_and_location (num, bp_num_range, bp_loc_range);
|
||||||
{
|
|
||||||
if (bp_loc_range.first == bp_loc_range.second
|
if (bp_loc_range.first == bp_loc_range.second
|
||||||
&& bp_loc_range.first == 0)
|
&& bp_loc_range.first == 0)
|
||||||
{
|
{
|
||||||
@ -14426,7 +14418,6 @@ enable_disable_command (const char *args, int from_tty, bool enable)
|
|||||||
enable_disable_breakpoint_location_range
|
enable_disable_breakpoint_location_range
|
||||||
(bp_num_range.first, bp_loc_range, enable);
|
(bp_num_range.first, bp_loc_range, enable);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
num = extract_arg (&args);
|
num = extract_arg (&args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2017-11-07 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* gdb.base/ena-dis-br.exp: Don't expect "warning:".
|
||||||
|
|
||||||
2017-11-07 Xavier Roirand <roirand@adacore.com>
|
2017-11-07 Xavier Roirand <roirand@adacore.com>
|
||||||
Pedro Alves <palves@redhat.com>
|
Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
@ -395,10 +395,10 @@ proc test_ena_dis_br { what } {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Now enable(disable) $b4.1 fooobaar and
|
# Now enable(disable) '$b4.1 fooobaar'. This should error on
|
||||||
# it should give warning on fooobaar.
|
# fooobaar.
|
||||||
gdb_test "$what $b4.1 fooobaar" \
|
gdb_test "$what $b4.1 fooobaar" \
|
||||||
"warning: bad breakpoint number at or near 'fooobaar'" \
|
"bad breakpoint number at or near 'fooobaar'" \
|
||||||
"$what \$b4.1 fooobar"
|
"$what \$b4.1 fooobar"
|
||||||
set test1 "${what}d \$b4.1"
|
set test1 "${what}d \$b4.1"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user