aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2020-05-09 20:56:55 +0200
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2020-05-15 22:17:45 +0200
commit3f4d92ebdf7f848b5ccc9e8d8e8514c64fde1183 (patch)
tree4fc60afc5e907c8bf88b09ffc9a08d720b0a302e /gdb/remote.c
parent0605465feb51d7a8552db8019c5cfc8a5fc22c3f (diff)
downloadgdb-3f4d92ebdf7f848b5ccc9e8d8e8514c64fde1183.zip
gdb-3f4d92ebdf7f848b5ccc9e8d8e8514c64fde1183.tar.gz
gdb-3f4d92ebdf7f848b5ccc9e8d8e8514c64fde1183.tar.bz2
Fix the problems reported by prefix check of command-def-selftests.c
The next commit updates command-def-selftests.c to detect missing or wrong prefix commands in a list of subcommands. This command structure selftest detects a series of problems that are fixed by this commit. Many commands have a null prefix command, e.g. (gdb) maintenance selftest command_str Running selftest command_structure_invariants. list 0x560417949cb8 reachable via prefix 'append binary '. command 'memory' has null prefixcmd list 0x560417949cb8 reachable via prefix 'append binary '. command 'value' has null prefixcmd ... Most of these are fixed by the following changes: * do_add_cmd searches the prefix command having the list in which the command is added. This ensures that a command defined after its prefix command gets the correct prefix command. * Due to the GDB initialization order, a GDB file can define a subcommand before the prefix command is defined. So, have add_prefix_cmd calling a new recursive function 'update_prefix_field_of_prefix_commands' to set the prefix command of all sub-commands that are now reachable from this newly defined prefix command. Note that this recursive call replaces the function 'set_prefix_cmd' that was providing a partial solution to this problem. Following that, 2 python commands (defined after all the other GDB commands) got a wrong prefix command, e.g. "info frame-filter" has as prefix command the "i" alias of "info". This is fixed by having lookup_cmd_for_prefixlist returning the aliased command rather than the alias. After that, one remaining problem: (gdb) maintenance selftest command_str Running selftest command_structure_invariants. list 0x55f320272298 reachable via prefix 'set remote '. command 'system-call-allowed' has null prefixcmd Self test failed: self-test failed at ../../classfix/gdb/unittests/command-def-selftests.c:196 Ran 1 unit tests, 1 failed (gdb) Caused by initialize_remote_fileio that was taking the address of its arguments remote_set_cmdlist and remote_show_cmdlist instead of receiving the correct values to use as list. 2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.c (lookup_cmd_for_prefix): Return the aliased command as prefix, not one of its aliases. (set_cmd_prefix): Remove. (do_add_cmd): Centralize the setting of the prefix of a command, when command is defined after its full chain of prefix commands. (add_alias_cmd): Remove call to set_cmd_prefix, as do_add_cmd does it. (add_setshow_cmd_full): Likewise. (update_prefix_field_of_prefixed_commands): New function. (add_prefix_cmd): Replace non working call to set_cmd_prefix by update_prefix_field_of_prefixed_commands. * gdb/remote-fileio.c (initialize_remote_fileio): Use the real addresses of remote_set_cmdlist and remote_show_cmdlist given as argument, not the address of an argument. * gdb/remote-fileio.h (initialize_remote_fileio): Likewise. * gdb/remote.c (_initialize_remote): Likewise.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 5b1fa84..812ab8b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14876,5 +14876,5 @@ Specify \"unlimited\" to display all the characters."),
&setdebuglist, &showdebuglist);
/* Eventually initialize fileio. See fileio.c */
- initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
+ initialize_remote_fileio (&remote_set_cmdlist, &remote_show_cmdlist);
}