From 56bcdbea2bed27ea83bf0e4fe472ab744b4beaa1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Apr 2018 20:10:43 -0600 Subject: Let gdb.execute handle multi-line commands This changes the Python API so that gdb.execute can now handle multi-line commands, like "commands" or "define". ChangeLog 2018-05-04 Tom Tromey PR python/22730: * NEWS: Mention gdb.execute change. * gdbcmd.h (execute_control_command): Don't declare. * python/python.c (execute_gdb_command): Use read_command_lines_1, execute_control_commands, execute_control_commands_to_string. * cli/cli-script.h (execute_control_commands) (execute_control_commands_to_string): Declare. (execute_control_command): Add from_tty parameter. * cli/cli-script.c (execute_control_commands) (execute_control_commands_to_string): New functions. (execute_user_command): Use execute_control_commands. (execute_control_command_1): Add "from_tty" parameter. Update. (execute_control_command): Likewise. testsuite/ChangeLog 2018-05-04 Tom Tromey PR python/22730: * gdb.python/python.exp: Test multi-line execute. --- gdb/cli/cli-script.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gdb/cli/cli-script.h') diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h index 3bebd0e..736ebb3 100644 --- a/gdb/cli/cli-script.h +++ b/gdb/cli/cli-script.h @@ -122,10 +122,23 @@ extern void show_user_1 (struct cmd_list_element *c, const char *name, struct ui_file *stream); +/* Execute the commands in CMDLINES. */ + +extern void execute_control_commands (struct command_line *cmdlines, + int from_tty); + +/* Run execute_control_commands for COMMANDS. Capture its output into + the returned string, do not display it to the screen. BATCH_FLAG + will be temporarily set to true. */ + +extern std::string execute_control_commands_to_string + (struct command_line *commands, int from_tty); + /* Exported to gdb/breakpoint.c */ extern enum command_control_type - execute_control_command (struct command_line *cmd); + execute_control_command (struct command_line *cmd, + int from_tty = 0); extern enum command_control_type execute_control_command_untraced (struct command_line *cmd); -- cgit v1.1