35#include "gdbsupport/event-loop.h"
41#include "gdbsupport/buildargv.h"
42#include "gdbsupport/scope-exit.h"
82 if (strcmp (
f.name,
name) == 0)
84 internal_error (_(
"interpreter factory already registered: \"%s\"\n"),
122 if (old_interp != NULL)
169 if (
name == NULL || strlen (
name) == 0)
178 if (strcmp (factory.name,
name) == 0)
180 interp = factory.func (factory.name);
197 error (_(
"Interpreter `%s' unrecognized"),
name);
231 return (strcmp (
interp->
name (), interp_name) == 0);
262 scoped_restore save_command_interp
288 struct interp *interp_to_use;
294 scoped_restore save_stdout = make_scoped_restore (&
gdb_stdout);
295 scoped_restore save_stderr = make_scoped_restore (&
gdb_stderr);
296 scoped_restore save_stdlog = make_scoped_restore (&
gdb_stdlog);
297 scoped_restore save_stdtarg = make_scoped_restore (&
gdb_stdtarg);
298 scoped_restore save_stdtargerr = make_scoped_restore (&
gdb_stdtargerr);
303 gdb_argv prules (args);
304 nrules = prules.count ();
307 error (_(
"Usage: interpreter-exec INTERPRETER COMMAND..."));
312 if (interp_to_use == NULL)
313 error (_(
"Could not find interpreter \"%s\"."), prules[0]);
321 for (i = 1; i < nrules; i++)
330 const char *text,
const char *word)
332 int textlen = strlen (text);
336 if (strncmp (
interp.
name, text, textlen) == 0)
361template <
typename ...Args>
369 (tli->*method) (args...);
433 gdb::optional<ULONGEST> exit_code,
572 const bfd_byte *data)
586Execute a command in an interpreter.\n\
587Usage: interpreter-exec INTERPRETER COMMAND...\n\
588The first argument is the name of the interpreter to use.\n\
589The following arguments are the commands to execute.\n\
590A command can have arguments, separated by spaces.\n\
591These spaces must be escaped using \\ or the command\n\
592and 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)
virtual void on_target_resumed(ptid_t ptid)
virtual void on_param_changed(const char *param, const char *value)
virtual void on_inferior_disappeared(inferior *inf)
virtual void on_breakpoint_modified(breakpoint *b)
virtual void exec(const char *command)=0
virtual void on_inferior_added(inferior *inf)
virtual void on_traceframe_changed(int tfnum, int tpnum)
virtual void on_memory_changed(inferior *inf, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
virtual void on_user_selected_context_changed(user_selected_what selection)
virtual void on_no_history()
virtual void on_signal_exited(gdb_signal sig)
virtual void on_new_thread(thread_info *t)
virtual void on_breakpoint_deleted(breakpoint *b)
virtual void set_logging(ui_file_up logfile, bool logging_redirect, bool debug_redirect)=0
virtual void on_breakpoint_created(breakpoint *b)
virtual ui_out * interp_ui_out()=0
virtual void on_tsv_modified(const trace_state_variable *tsv)
virtual void on_record_changed(inferior *inf, int started, const char *method, const char *format)
virtual void on_solib_unloaded(so_list *so)
virtual void on_exited(int status)
virtual void on_tsv_deleted(const trace_state_variable *tsv)
virtual void on_thread_exited(thread_info *, gdb::optional< ULONGEST > exit_code, int silent)
const char * name() const
virtual void on_inferior_appeared(inferior *inf)
virtual void init(bool top_level)
virtual void on_signal_received(gdb_signal sig)
virtual void on_tsv_created(const trace_state_variable *tsv)
virtual void on_inferior_removed(inferior *inf)
virtual void on_solib_loaded(so_list *so)
virtual void on_normal_stop(bpstat *bs, int print_frame)
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)
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 *)
int void void(* deprecated_readline_begin_hook)(const char *,...) ATTRIBUTE_FPTR_PRINTF_1
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)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void interps_notify_inferior_removed(inferior *inf)
struct interp * interp_lookup(struct ui *ui, const char *name)
static struct interp * interp_lookup_existing(struct ui *ui, const char *name)
void interps_notify_breakpoint_created(breakpoint *b)
void interps_notify_no_history()
void interps_notify_solib_loaded(so_list *so)
void clear_interpreter_hooks(void)
void interps_notify_thread_exited(thread_info *t, gdb::optional< ULONGEST > exit_code, int silent)
int current_interp_named_p(const char *interp_name)
void interps_notify_tsv_deleted(const trace_state_variable *tsv)
struct interp * current_interpreter(void)
struct interp * top_level_interpreter(void)
void interps_notify_signal_received(gdb_signal sig)
static void interpreter_exec_cmd(const char *args, int from_tty)
void interps_notify_breakpoint_modified(breakpoint *b)
void set_top_level_interpreter(const char *name)
void interps_notify_normal_stop(bpstat *bs, int print_frame)
void interp_exec(struct interp *interp, const char *command_str)
void _initialize_interpreter()
void interps_notify_inferior_added(inferior *inf)
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)
void interps_notify_solib_unloaded(so_list *so)
void interps_notify_breakpoint_deleted(breakpoint *b)
void interpreter_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
void interps_notify_signal_exited(gdb_signal sig)
void current_interp_set_logging(ui_file_up logfile, bool logging_redirect, bool debug_redirect)
void interps_notify_user_selected_context_changed(user_selected_what selection)
void interps_notify_target_resumed(ptid_t ptid)
void interps_notify_param_changed(const char *param, const char *value)
void interps_notify_traceframe_changed(int tfnum, int tpnum)
void interps_notify_new_thread(thread_info *t)
static std::vector< interp_factory > interpreter_factories
void interps_notify_memory_changed(inferior *inf, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
static void interp_set(struct interp *interp, bool top_level)
void interps_notify_inferior_disappeared(inferior *inf)
void interps_notify_exited(int status)
void interps_notify_inferior_appeared(inferior *inf)
void interps_notify(void(interp::*method)(Args...), Args... args)
void interps_notify_tsv_created(const trace_state_variable *tsv)
void interps_notify_tsv_modified(const trace_state_variable *tsv)
void interps_notify_record_changed(inferior *inf, int started, const char *method, const char *format)
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 *)
static void print_frame(const frame_print_options &opts, frame_info_ptr frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal)
interp_factory(const char *name_, interp_factory_func func_)
interp * current_interpreter
interp * top_level_interpreter
interp * command_interpreter
intrusive_list< interp > interp_list
std::unique_ptr< ui_file > ui_file_up
#define SWITCH_THRU_ALL_UIS()
void(* deprecated_error_begin_hook)(void)