This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] python: Make gdb.execute("show commands") work (PR 23669)
- From: Tom Tromey <tom at tromey dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 17 Sep 2018 00:37:26 -0600
- Subject: Re: [PATCH] python: Make gdb.execute("show commands") work (PR 23669)
- References: <20180917012350.10194-1-simon.marchi@polymtl.ca>
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> Since commit
Simon> 56bcdbea2bed ("Let gdb.execute handle multi-line commands")
Simon> trying to use a command like gdb.execute("show commands") in Python
Simon> fails. GDB ends up trying to run the "commands" command.
Simon> The reason is that GDB gets confused with the special "commands"
Simon> command. In process_next_line, the lookup_cmd_1 function returns the
Simon> cmd_list_element representing the "commands" sub-command of "show".
Simon> Lower, we check the cmd_list_element to see if it matches various
Simon> control commands by name, including the "commands" command. This is
Simon> where we wrongfully conclude that the executed command must be
Simon> "commands", when in reality it was "show commands".
Simon> The fix proposed in this patch removes the comparisons by name, instead
Simon> comparing the cmd_list_element object by pointer with the objects
Simon> created at initialization time.
Thanks for doing this. I think getting rid of command_name_equals is a
nice cleanup. The patch looks good to me.
Tom