diff options
author | Tom de Vries <tdevries@suse.de> | 2024-09-23 09:34:48 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-09-23 09:34:48 +0200 |
commit | 3169d006121af0316903bb05f72ca52b40083834 (patch) | |
tree | 5b49cc8a8a96f1c3cca404793829222c20066799 /gdb/python/python.h | |
parent | be32af158ade53f91caeb1951e8cbf7578d08b52 (diff) | |
download | binutils-3169d006121af0316903bb05f72ca52b40083834.zip binutils-3169d006121af0316903bb05f72ca52b40083834.tar.gz binutils-3169d006121af0316903bb05f72ca52b40083834.tar.bz2 |
[gdb/testsuite] Make parse_args error out on remaining args
I noticed that introducing a typo here in gdb.mi/mi-breakpoint-changed.exp:
...
set bp_re [mi_make_breakpoint \
- -number $bp_nr \
+ -nunber $bp_nr \
-type dprintf \
-func marker \
-script [string_to_regexp {["printf \"arg\" \""]}]]
...
didn't make the test fail.
Proc mi_make_breakpoint uses parse_args, but does not check the remaining args
as parse_args suggests:
...
proc parse_args { argset } {
parse_list 2 args $argset "-" false
# The remaining args should be checked to see that they match the
# number of items expected to be passed into the procedure
}
...
We could add the missing check in mi_make_breakpoint, but I think the problem
is likely to occur again because the name parse_args does not suggest that
further action is required.
Fix this instead by:
- copying proc parse_args to new proc parse_some_args,
- adding new proc check_no_args_left, and
- calling check_no_args_left in parse_args.
Also be more strict in a few places where we do lassign for remaining args:
...
lassign $args a b
...
There may be more arguments left in $args, so check that that's not the case
using check_no_args_left:
...
set args [lassign $args a b]
check_no_args_left
...
Fix a few test-cases that trigger on the stricter checking.
Tested on x86_64-linux.
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
PR testsuite/32129
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32129
Diffstat (limited to 'gdb/python/python.h')
0 files changed, 0 insertions, 0 deletions