35#include "gdbsupport/event-loop.h"
41#include "gdbsupport/buildargv.h"
116 if (strcmp (
f.name,
name) == 0)
118 internal_error (_(
"interpreter factory already registered: \"%s\"\n"),
160 if (old_interp != NULL)
173 bool warn_about_mi1 =
false;
182 warn_about_mi1 =
true;
194 warning (_(
"MI version 1 is deprecated in GDB 13 and "
195 "will be removed in GDB 14. Please upgrade "
196 "to a newer version of MI."));
224 if (
name == NULL || strlen (
name) == 0)
233 if (strcmp (factory.name,
name) == 0)
252 error (_(
"Interpreter `%s' unrecognized"),
name);
288 return (strcmp (
interp->
name (), interp_name) == 0);
319 gdb_assert (
interp != NULL);
341 scoped_restore save_command_interp
368 struct interp *old_interp, *interp_to_use;
374 scoped_restore save_stdout = make_scoped_restore (&
gdb_stdout);
375 scoped_restore save_stderr = make_scoped_restore (&
gdb_stderr);
376 scoped_restore save_stdlog = make_scoped_restore (&
gdb_stdlog);
377 scoped_restore save_stdtarg = make_scoped_restore (&
gdb_stdtarg);
378 scoped_restore save_stdtargerr = make_scoped_restore (&
gdb_stdtargerr);
383 gdb_argv prules (args);
384 nrules = prules.count ();
387 error (_(
"Usage: interpreter-exec INTERPRETER COMMAND..."));
392 if (interp_to_use == NULL)
393 error (_(
"Could not find interpreter \"%s\"."), prules[0]);
397 for (i = 1; i < nrules; i++)
399 struct gdb_exception e =
interp_exec (interp_to_use, prules[i]);
404 error (_(
"error in command: \"%s\"."), prules[i]);
416 const char *text,
const char *word)
418 int textlen = strlen (text);
422 if (strncmp (
interp.
name, text, textlen) == 0)
457Execute a command in an interpreter.\n\
458Usage: interpreter-exec INTERPRETER COMMAND...\n\
459The first argument is the name of the interpreter to use.\n\
460The following arguments are the commands to execute.\n\
461A command can have arguments, separated by spaces.\n\
462These spaces must be escaped using \\ or the command\n\
463and its arguments must be enclosed in double quotes."), &
cmdlist);
void add_completion(gdb::unique_xmalloc_ptr< char > name, completion_match_for_lcd *match_for_lcd=NULL, const char *text=NULL, const char *word=NULL)
gdb::unique_xmalloc_ptr< char > m_name
virtual bool supports_command_editing()
virtual void set_logging(ui_file_up logfile, bool logging_redirect, bool debug_redirect)=0
virtual ui_out * interp_ui_out()=0
virtual void pre_command_loop()
virtual gdb_exception exec(const char *command)=0
const char * name() const
virtual void init(bool top_level)
struct interp * set_interp(const char *name)
void error_no_arg(const char *why)
struct cmd_list_element * cmdlist
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
static bool debug_redirect
static bool logging_redirect
gdb::unique_xmalloc_ptr< char > make_completion_match_str(const char *match_name, const char *text, const char *word)
void(* deprecated_readline_end_hook)(void)
int(*) void(*) void(* deprecated_readline_begin_hook)(const char *,...) ATTRIBUTE_FPTR_PRINTF_1
void(* deprecated_print_frame_info_listing_hook)(struct symtab *s, int line, int stopline, int noerror)
int(* deprecated_query_hook)(const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1
char *(* deprecated_readline_hook)(const char *)
void(* deprecated_call_command_hook)(struct cmd_list_element *c, const char *cmd, int from_tty)
int(*) void(* deprecated_warning_hook)(const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1
void(* deprecated_context_hook)(int)
struct interp * interp_lookup(struct ui *ui, const char *name)
static struct interp * interp_lookup_existing(struct ui *ui, const char *name)
void interp_pre_command_loop(struct interp *interp)
void clear_interpreter_hooks(void)
static struct ui_interp_info * get_interp_info(struct ui *ui)
int current_interp_named_p(const char *interp_name)
struct interp * current_interpreter(void)
struct interp * top_level_interpreter(void)
static void interpreter_exec_cmd(const char *args, int from_tty)
void set_top_level_interpreter(const char *name)
void _initialize_interpreter()
struct interp * command_interp(void)
void interp_factory_register(const char *name, interp_factory_func func)
static void interp_add(struct ui *ui, struct interp *interp)
int interp_supports_command_editing(struct interp *interp)
static struct ui_interp_info * get_current_interp_info(void)
void interpreter_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
void current_interp_set_logging(ui_file_up logfile, bool logging_redirect, bool debug_redirect)
static std::vector< interp_factory > interpreter_factories
static void interp_set(struct interp *interp, bool top_level)
struct gdb_exception interp_exec(struct interp *interp, const char *command_str)
struct interp * interp_lookup(struct ui *ui, const char *name)
struct interp *(* interp_factory_func)(const char *name)
std::string interpreter_p
struct ui_file * gdb_stdtarg
struct ui_file * gdb_stdtargerr
void(* func)(remote_target *remote, char *)
interp_factory(const char *name_, interp_factory_func func_)
struct interp * command_interpreter
struct interp * interp_list
struct interp * top_level_interpreter
struct interp * current_interpreter
struct ui_interp_info * interp_info
std::unique_ptr< ui_file > ui_file_up
void(* deprecated_error_begin_hook)(void)