aboutsummaryrefslogtreecommitdiff
path: root/gdb/Makefile.in
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2020-05-04 22:25:24 +0200
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2020-05-15 22:17:45 +0200
commit58e6ac70065131e82e0256f571e5277553096051 (patch)
tree3ae07497b8425b3b76ed1f024e94f1db068619a4 /gdb/Makefile.in
parenta7b9ceb8b44cd36496e266894075e2af60c3e153 (diff)
downloadbinutils-58e6ac70065131e82e0256f571e5277553096051.zip
binutils-58e6ac70065131e82e0256f571e5277553096051.tar.gz
binutils-58e6ac70065131e82e0256f571e5277553096051.tar.bz2
Add a selftest that detects a 'corrupted' command tree structure in GDB.
The GDB data structure that records the GDB commands is made of 'struct cmd_list_element' defined in cli-decode.h. A cmd_list_element has various pointers to other cmd_list_element structures, All these pointers are together building a graph of commands. However, when following the 'next' and '*prefixlist' pointers of cmd_list_element, the structure must better be a tree. If such pointers do not form a tree, then some other elements of cmd_list_element cannot get a correct semantic. In particular, the prefixname has no correct meaning if the same prefix command can be reached via 2 different paths. This commit introduces a selftest that detects (at least some cases of) errors leading to 'next' and '*prefixlist' not giving a tree structure. The new 'command_structure_invariants' selftest detects one single case where the command structure is not a tree: (gdb) maintenance selftest command_structure_invariants Running selftest command_structure_invariants. list 0x56362e204b98 duplicated, reachable via prefix 'show ' and 'info set '. Duplicated list first command is 'ada' Self test failed: self-test failed at ../../classfix/gdb/unittests/command-def-selftests.c:160 Ran 1 unit tests, 1 failed (gdb) This was fixed by the previous commit. 2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> * unittests/help-doc-selftests.c: Rename to unittests/command-def-selftests.c * unittests/command-def-selftests.c (help_doc_tests): Update some comments. (command_structure_tests, traverse_command_structure): New namespace and function. (command_structure_invariants_tests): New function. (_initialize_command_def_selftests) Renamed from _initialize_help_doc_selftests, register command_structure_invariants selftest.
Diffstat (limited to 'gdb/Makefile.in')
-rw-r--r--gdb/Makefile.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e3ce6a2..32d0eee 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -427,13 +427,13 @@ SELFTESTS_SRCS = \
unittests/array-view-selftests.c \
unittests/child-path-selftests.c \
unittests/cli-utils-selftests.c \
+ unittests/command-def-selftests.c \
unittests/common-utils-selftests.c \
unittests/copy_bitwise-selftests.c \
unittests/environ-selftests.c \
unittests/filtered_iterator-selftests.c \
unittests/format_pieces-selftests.c \
unittests/function-view-selftests.c \
- unittests/help-doc-selftests.c \
unittests/lookup_name_info-selftests.c \
unittests/memory-map-selftests.c \
unittests/memrange-selftests.c \