This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] python: Make gdb.execute("show commands") work (PR 23669)


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]