binutils-gdb/gdb/cli/cli-script.h
Tom Tromey 93921405a4 Introduce command_line_up
This introduces command_line_up, a unique_ptr for command_line
objects, and changes many places to use it.  This removes a number of
cleanups.

Command lines are funny in that sometimes they are reference counted.
Once there is more C++-ification of some of the users, perhaps all of
these can be changed to use shared_ptr instead.

gdb/ChangeLog
2017-04-12  Tom Tromey  <tom@tromey.com>

	* tracepoint.c (actions_command): Update.
	* python/python.c (python_command, python_interactive_command):
	Update.
	* mi/mi-cmd-break.c (mi_cmd_break_commands): Update.
	* guile/guile.c (guile_command): Update.
	* defs.h (read_command_lines, read_command_lines_1): Return
	command_line_up.
	(command_lines_deleter): New struct.
	(command_line_up): New typedef.
	* compile/compile.c (compile_code_command)
	(compile_print_command): Update.
	* cli/cli-script.h (get_command_line, copy_command_lines): Return
	command_line_up.
	(make_cleanup_free_command_lines): Remove.
	* cli/cli-script.c (get_command_line, read_command_lines_1)
	(copy_command_lines): Return command_line_up.
	(while_command, if_command, read_command_lines, define_command)
	(document_command): Update.
	(do_free_command_lines_cleanup, make_cleanup_free_command_lines):
	Remove.
	* breakpoint.h (breakpoint_set_commands): Change type of
	"commands".
	* breakpoint.c (breakpoint_set_commands): Change type of
	"commands".  Update.
	(do_map_commands_command, update_dprintf_command_list)
	(create_tracepoint_from_upload): Update.
2017-04-12 11:16:17 -06:00

68 lines
2.1 KiB
C++

/* Header file for GDB CLI command implementation library.
Copyright (C) 2000-2017 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !defined (CLI_SCRIPT_H)
#define CLI_SCRIPT_H 1
struct ui_file;
struct command_line;
struct cmd_list_element;
/* Exported to cli/cli-cmds.c */
extern void script_from_file (FILE *stream, const char *file);
extern void show_user_1 (struct cmd_list_element *c,
const char *prefix,
const char *name,
struct ui_file *stream);
/* Exported to gdb/breakpoint.c */
extern enum command_control_type
execute_control_command (struct command_line *cmd);
extern enum command_control_type
execute_control_command_untraced (struct command_line *cmd);
extern command_line_up get_command_line (enum command_control_type,
const char *);
extern void print_command_lines (struct ui_out *,
struct command_line *, unsigned int);
extern command_line_up copy_command_lines (struct command_line *cmds);
/* Exported to gdb/infrun.c */
extern void execute_user_command (struct cmd_list_element *c, char *args);
/* If we're in a user-defined command, replace any $argc/$argN
reference found in LINE with the arguments that were passed to the
command. Otherwise, treat $argc/$argN as normal convenience
variables. */
extern std::string insert_user_defined_cmd_args (const char *line);
/* Exported to top.c */
extern void print_command_trace (const char *cmd);
/* Exported to event-top.c */
extern void reset_command_nest_depth (void);
#endif /* !defined (CLI_SCRIPT_H) */