2003-02-06 06:30:17 +01:00
|
|
|
/* Manages interpreters for GDB, the GNU debugger.
|
|
|
|
|
2014-01-01 04:54:24 +01:00
|
|
|
Copyright (C) 2000-2014 Free Software Foundation, Inc.
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
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
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2003-02-06 06:30:17 +01:00
|
|
|
(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
|
2011-01-09 04:08:57 +01:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
/* This is just a first cut at separating out the "interpreter"
|
|
|
|
functions of gdb into self-contained modules. There are a couple
|
|
|
|
of open areas that need to be sorted out:
|
|
|
|
|
|
|
|
1) The interpreter explicitly contains a UI_OUT, and can insert itself
|
|
|
|
into the event loop, but it doesn't explicitly contain hooks for readline.
|
|
|
|
I did this because it seems to me many interpreters won't want to use
|
|
|
|
the readline command interface, and it is probably simpler to just let
|
|
|
|
them take over the input in their resume proc. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "ui-out.h"
|
|
|
|
#include "event-loop.h"
|
|
|
|
#include "event-top.h"
|
|
|
|
#include "interps.h"
|
|
|
|
#include "completer.h"
|
|
|
|
#include "top.h" /* For command_loop. */
|
2011-05-27 Pedro Alves <pedro@codesourcery.com>
* defs.h (struct continuation, continuation_ftype)
(continuation_free_arg_ftype, add_continuation)
(do_all_continuations, do_all_continuations_thread)
(discard_all_continuations, discard_all_continuations_thread)
(add_intermediate_continuation, do_all_intermediate_continuations)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations)
(discard_all_intermediate_continuations_thread)
(add_inferior_continuation, do_all_inferior_continuations)
(discard_all_inferior_continuations): Move to ...
* continuations.h: ... this new file.
* breakpoint.c, continuations.c, event-top.c, inf-loop.c,
infcmd.c, inferior.c, infrun.c, interps.c: Include
continuations.h.
2011-05-27 20:28:18 +02:00
|
|
|
#include "continuations.h"
|
2003-02-06 06:30:17 +01:00
|
|
|
|
2011-09-02 18:56:30 +02:00
|
|
|
/* True if the current interpreter in is async mode. See interps.h
|
|
|
|
for more details. This starts out disabled, until all the explicit
|
|
|
|
command line arguments (e.g., `gdb -ex "start" -ex "next"') are
|
|
|
|
processed. */
|
|
|
|
int interpreter_async = 0;
|
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
struct interp
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
/* This is the name in "-i=" and set interpreter. */
|
2003-02-06 06:30:17 +01:00
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* Interpreters are stored in a linked list, this is the next
|
|
|
|
one... */
|
|
|
|
struct interp *next;
|
|
|
|
|
|
|
|
/* This is a cookie that an instance of the interpreter can use.
|
|
|
|
This is a bit confused right now as the exact initialization
|
|
|
|
sequence for it, and how it relates to the interpreter's uiout
|
|
|
|
object is a bit confused. */
|
|
|
|
void *data;
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Has the init_proc been run? */
|
2003-02-06 06:30:17 +01:00
|
|
|
int inited;
|
|
|
|
|
|
|
|
const struct interp_procs *procs;
|
|
|
|
int quiet_p;
|
|
|
|
};
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* The magic initialization routine for this module. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
void _initialize_interpreter (void);
|
|
|
|
|
|
|
|
/* Variables local to this file: */
|
|
|
|
|
|
|
|
static struct interp *interp_list = NULL;
|
|
|
|
static struct interp *current_interpreter = NULL;
|
2008-04-19 08:08:18 +02:00
|
|
|
static struct interp *top_level_interpreter_ptr = NULL;
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
/* interp_new - This allocates space for a new interpreter,
|
|
|
|
fills the fields from the inputs, and returns a pointer to the
|
2011-01-09 04:08:57 +01:00
|
|
|
interpreter. */
|
2003-02-06 06:30:17 +01:00
|
|
|
struct interp *
|
2011-09-12 23:25:22 +02:00
|
|
|
interp_new (const char *name, const struct interp_procs *procs)
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
|
|
|
struct interp *new_interp;
|
|
|
|
|
2013-12-28 23:31:23 +01:00
|
|
|
new_interp = XNEW (struct interp);
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
new_interp->name = xstrdup (name);
|
2011-09-12 23:25:22 +02:00
|
|
|
new_interp->data = NULL;
|
2003-02-06 06:30:17 +01:00
|
|
|
new_interp->quiet_p = 0;
|
|
|
|
new_interp->procs = procs;
|
|
|
|
new_interp->inited = 0;
|
|
|
|
|
2013-09-06 10:53:09 +02:00
|
|
|
/* Check for required procs. */
|
|
|
|
gdb_assert (procs->command_loop_proc != NULL);
|
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
return new_interp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add interpreter INTERP to the gdb interpreter list. The
|
|
|
|
interpreter must not have previously been added. */
|
|
|
|
void
|
|
|
|
interp_add (struct interp *interp)
|
|
|
|
{
|
|
|
|
gdb_assert (interp_lookup (interp->name) == NULL);
|
|
|
|
|
|
|
|
interp->next = interp_list;
|
|
|
|
interp_list = interp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This sets the current interpreter to be INTERP. If INTERP has not
|
|
|
|
been initialized, then this will also run the init proc. If the
|
|
|
|
init proc is successful, return 1, if it fails, set the old
|
|
|
|
interpreter back in place and return 0. If we can't restore the
|
|
|
|
old interpreter, then raise an internal error, since we are in
|
2011-01-09 04:08:57 +01:00
|
|
|
pretty bad shape at this point.
|
2008-03-14 18:21:08 +01:00
|
|
|
|
|
|
|
The TOP_LEVEL parameter tells if this new interpreter is
|
|
|
|
the top-level one. The top-level is what is requested
|
|
|
|
on the command line, and is responsible for reporting general
|
|
|
|
notification about target state changes. For example, if
|
|
|
|
MI is the top-level interpreter, then it will always report
|
|
|
|
events such as target stops and new thread creation, even if they
|
|
|
|
are caused by CLI commands. */
|
2003-02-06 06:30:17 +01:00
|
|
|
int
|
2008-03-14 18:21:08 +01:00
|
|
|
interp_set (struct interp *interp, int top_level)
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
|
|
|
struct interp *old_interp = current_interpreter;
|
|
|
|
int first_time = 0;
|
|
|
|
char buffer[64];
|
|
|
|
|
2008-03-14 18:21:08 +01:00
|
|
|
/* If we already have an interpreter, then trying to
|
|
|
|
set top level interpreter is kinda pointless. */
|
|
|
|
gdb_assert (!top_level || !current_interpreter);
|
2008-04-19 08:08:18 +02:00
|
|
|
gdb_assert (!top_level || !top_level_interpreter_ptr);
|
2008-03-14 18:21:08 +01:00
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
if (current_interpreter != NULL)
|
|
|
|
{
|
2011-08-04 Pedro Alves <pedro@codesourcery.com>
* ui-out.h (uiout): Rename to ...
(current_uiout): ... this.
* ui-out.c (uiout): Rename to ...
(current_uiout): ... this.
* ada-lang.c (print_it_exception, print_one_exception)
(print_mention_exception): Adjust.
* breakpoint.c (watchpoint_check): Adjust.
(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
(default_collect_info, watchpoints_info, print_one_catch_fork)
(print_one_catch_vfork, print_one_catch_syscall)
(print_one_catch_exec, mention, print_it_ranged_breakpoint)
(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
(print_it_watchpoint, print_mention_watchpoint)
(print_it_masked_watchpoint, print_mention_masked_watchpoint)
(print_it_exception_catchpoint, print_one_exception_catchpoint)
(print_mention_exception_catchpoint, say_where, bkpt_print_it)
(bkpt_print_mention, momentary_bkpt_print_it)
(tracepoint_print_mention, update_static_tracepoint)
(tracepoints_info, save_breakpoints): Adjust.
* cli-out.c (field_separator): Adjust.
* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
* frame.c (get_current_frame): Adjust.
* infcmd.c (run_command_1, print_return_value): Adjust.
* inferior.c (inferior_command, info_inferiors_command): Adjust.
* infrun.c (print_end_stepping_range_reason): Adjust.
(print_signal_exited_reason, print_exited_reason): Adjust.
(print_signal_received_reason, print_no_history_reason): Adjust.
* interps.c (interp_set): Adjust.
* osdata.c (info_osdata_command): Adjust.
* progspace.c (maintenance_info_program_spaces_command): Adjust.
* remote-fileio.c (remote_fileio_request): Adjust.
* remote.c (show_remote_cmd): Adjust.
* solib.c (info_sharedlibrary_command): Adjust.
* source.c (print_source_lines_base): Adjust.
* stack.c (print_stack_frame): Adjust.
(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
* symfile-mem.c (add_vsyscall_page): Adjust.
* symfile.c (load_progress, generic_load)
(print_transfer_performance): Adjust.
* thread.c (info_threads_command, restore_selected_frame)
(thread_command): Adjust.
* top.c (make_cleanup_restore_ui_file): Adjust.
* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
(print_one_static_tracepoint_marker): Adjust.
* cli/cli-cmds.c (print_disassembly): Adjust.
* cli/cli-decode.c (print_doc_line): Adjust.
* cli/cli-interp.c (safe_execute_command): Adjust.
* cli/cli-logging.c (set_logging_redirect, pop_output_files)
(handle_redirections): Adjust.
* cli/cli-script.c (show_user_1): Adjust.
* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
(mi_cmd_env_dir): Adjust.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
(list_args_or_locals): Adjust.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
(mi_cmd_var_list_children, mi_cmd_var_info_type)
(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
* mi/mi-interp.c (mi_on_normal_stop): Adjust.
* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
(list_available_thread_groups, mi_cmd_list_thread_groups)
(mi_cmd_data_list_register_names)
(mi_cmd_data_list_changed_registers)
(mi_cmd_data_list_register_values, get_register)
(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
(mi_cmd_list_target_features, mi_cmd_add_inferior)
(mi_execute_command, mi_load_progress): Adjust.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
* python/py-auto-load.c (print_script, info_auto_load_scripts):
Adjust.
* python/py-breakpoint.c (bppy_get_commands): Adjust.
* tui/tui-interp.c (tui_command_loop): Adjust.
* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.
2011-08-04 21:10:14 +02:00
|
|
|
ui_out_flush (current_uiout);
|
2003-02-06 06:30:17 +01:00
|
|
|
if (current_interpreter->procs->suspend_proc
|
|
|
|
&& !current_interpreter->procs->suspend_proc (current_interpreter->
|
|
|
|
data))
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Could not suspend interpreter \"%s\"."),
|
2003-02-06 06:30:17 +01:00
|
|
|
current_interpreter->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first_time = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
current_interpreter = interp;
|
2008-03-14 18:21:08 +01:00
|
|
|
if (top_level)
|
2008-04-19 08:08:18 +02:00
|
|
|
top_level_interpreter_ptr = interp;
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
/* We use interpreter_p for the "set interpreter" variable, so we need
|
2011-01-09 04:08:57 +01:00
|
|
|
to make sure we have a malloc'ed copy for the set command to free. */
|
2003-02-06 06:30:17 +01:00
|
|
|
if (interpreter_p != NULL
|
|
|
|
&& strcmp (current_interpreter->name, interpreter_p) != 0)
|
|
|
|
{
|
|
|
|
xfree (interpreter_p);
|
|
|
|
|
|
|
|
interpreter_p = xstrdup (current_interpreter->name);
|
|
|
|
}
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Run the init proc. If it fails, try to restore the old interp. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
if (!interp->inited)
|
|
|
|
{
|
|
|
|
if (interp->procs->init_proc != NULL)
|
|
|
|
{
|
2011-09-12 23:25:22 +02:00
|
|
|
interp->data = interp->procs->init_proc (interp, top_level);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
interp->inited = 1;
|
|
|
|
}
|
|
|
|
|
2011-09-12 23:25:22 +02:00
|
|
|
/* Do this only after the interpreter is initialized. */
|
|
|
|
current_uiout = interp->procs->ui_out_proc (interp);
|
|
|
|
|
2005-01-14 01:55:36 +01:00
|
|
|
/* Clear out any installed interpreter hooks/event handlers. */
|
2003-02-06 06:30:17 +01:00
|
|
|
clear_interpreter_hooks ();
|
|
|
|
|
|
|
|
if (interp->procs->resume_proc != NULL
|
|
|
|
&& (!interp->procs->resume_proc (interp->data)))
|
|
|
|
{
|
2008-03-14 18:21:08 +01:00
|
|
|
if (old_interp == NULL || !interp_set (old_interp, 0))
|
2003-02-06 06:30:17 +01:00
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
_("Failed to initialize new interp \"%s\" %s"),
|
2003-02-06 06:30:17 +01:00
|
|
|
interp->name, "and could not restore old interp!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Make display_gdb_prompt CLI-only.
Enabling target-async by default will require implementing sync
execution on top of an async target, much like foreground command are
implemented on the CLI in async mode.
In order to do that, we will need better control of when to print the
MI prompt. Currently the interp->display_prompt_p hook is all we
have, and MI just always returns false, meaning, make
display_gdb_prompt a no-op. We'll need to be able to know to print
the MI prompt in some of the conditions that display_gdb_prompt is
called from the core, but not all.
This is all a litte twisted currently. As we can see,
display_gdb_prompt is really CLI specific, so make the console
interpreters (console/tui) themselves call it. To be able to do that,
and add a few different observers that the interpreters can use to
distinguish when or why the the prompt is being printed:
#1 - one called whenever a command is cancelled due to an error.
#2 - another for when a foreground command just finished.
In both cases, CLI wants to print the prompt, while MI doesn't.
MI will want to print the prompt in the second case when in a special
MI mode.
The display_gdb_prompt call in interp_set made me pause. The comment
there reads:
/* Finally, put up the new prompt to show that we are indeed here.
Also, display_gdb_prompt for the console does some readline magic
which is needed for the console interpreter, at least... */
But, that looks very much like a no-op to me currently:
- the MI interpreter always return false in the prompt hook, meaning
actually display no prompt.
- the interpreter used at that point is still quiet. And the
console/tui interpreters return false in the prompt hook if they're
quiet, meaning actually display no prompt.
The only remaining possible use would then be the readline magic. But
whatever that might have been, it's not reacheable today either,
because display_gdb_prompt returns early, before touching readline if
the interpreter returns false in the display_prompt_p hook.
Tested on x86_64 Fedora 20, sync and async modes.
gdb/
2014-05-29 Pedro Alves <palves@redhat.com>
* cli/cli-interp.c (cli_interpreter_display_prompt_p): Delete.
(_initialize_cli_interp): Adjust.
* event-loop.c: Include "observer.h".
(start_event_loop): Notify 'command_error' observers instead of
calling display_gdb_prompt. Remove FIXME comment.
* event-top.c (display_gdb_prompt): Remove call into the
interpreters.
* inf-loop.c: Include "observer.h".
(inferior_event_handler): Notify 'command_error' observers instead
of calling display_gdb_prompt.
* infrun.c (fetch_inferior_event): Notify 'sync_execution_done'
observers instead of calling display_gdb_prompt.
* interps.c (interp_set): Don't call display_gdb_prompt.
(current_interp_display_prompt_p): Delete.
* interps.h (interp_prompt_p): Delete declaration.
(interp_prompt_p_ftype): Delete.
(struct interp_procs) <prompt_proc_p>: Delete field.
(current_interp_display_prompt_p): Delete declaration.
* mi-interp.c (mi_interpreter_prompt_p): Delete.
(_initialize_mi_interp): Adjust.
* tui-interp.c (tui_init): Install 'sync_execution_done' and
'command_error' observers.
(tui_on_sync_execution_done, tui_on_command_error): New
functions.
(tui_display_prompt_p): Delete.
(_initialize_tui_interp): Adjust.
gdb/doc/
2014-05-29 Pedro Alves <palves@redhat.com>
* observer.texi (sync_execution_done, command_error): New
subjects.
2014-05-23 12:37:12 +02:00
|
|
|
if (!first_time && !interp_quiet_p (interp))
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
Make display_gdb_prompt CLI-only.
Enabling target-async by default will require implementing sync
execution on top of an async target, much like foreground command are
implemented on the CLI in async mode.
In order to do that, we will need better control of when to print the
MI prompt. Currently the interp->display_prompt_p hook is all we
have, and MI just always returns false, meaning, make
display_gdb_prompt a no-op. We'll need to be able to know to print
the MI prompt in some of the conditions that display_gdb_prompt is
called from the core, but not all.
This is all a litte twisted currently. As we can see,
display_gdb_prompt is really CLI specific, so make the console
interpreters (console/tui) themselves call it. To be able to do that,
and add a few different observers that the interpreters can use to
distinguish when or why the the prompt is being printed:
#1 - one called whenever a command is cancelled due to an error.
#2 - another for when a foreground command just finished.
In both cases, CLI wants to print the prompt, while MI doesn't.
MI will want to print the prompt in the second case when in a special
MI mode.
The display_gdb_prompt call in interp_set made me pause. The comment
there reads:
/* Finally, put up the new prompt to show that we are indeed here.
Also, display_gdb_prompt for the console does some readline magic
which is needed for the console interpreter, at least... */
But, that looks very much like a no-op to me currently:
- the MI interpreter always return false in the prompt hook, meaning
actually display no prompt.
- the interpreter used at that point is still quiet. And the
console/tui interpreters return false in the prompt hook if they're
quiet, meaning actually display no prompt.
The only remaining possible use would then be the readline magic. But
whatever that might have been, it's not reacheable today either,
because display_gdb_prompt returns early, before touching readline if
the interpreter returns false in the display_prompt_p hook.
Tested on x86_64 Fedora 20, sync and async modes.
gdb/
2014-05-29 Pedro Alves <palves@redhat.com>
* cli/cli-interp.c (cli_interpreter_display_prompt_p): Delete.
(_initialize_cli_interp): Adjust.
* event-loop.c: Include "observer.h".
(start_event_loop): Notify 'command_error' observers instead of
calling display_gdb_prompt. Remove FIXME comment.
* event-top.c (display_gdb_prompt): Remove call into the
interpreters.
* inf-loop.c: Include "observer.h".
(inferior_event_handler): Notify 'command_error' observers instead
of calling display_gdb_prompt.
* infrun.c (fetch_inferior_event): Notify 'sync_execution_done'
observers instead of calling display_gdb_prompt.
* interps.c (interp_set): Don't call display_gdb_prompt.
(current_interp_display_prompt_p): Delete.
* interps.h (interp_prompt_p): Delete declaration.
(interp_prompt_p_ftype): Delete.
(struct interp_procs) <prompt_proc_p>: Delete field.
(current_interp_display_prompt_p): Delete declaration.
* mi-interp.c (mi_interpreter_prompt_p): Delete.
(_initialize_mi_interp): Adjust.
* tui-interp.c (tui_init): Install 'sync_execution_done' and
'command_error' observers.
(tui_on_sync_execution_done, tui_on_command_error): New
functions.
(tui_display_prompt_p): Delete.
(_initialize_tui_interp): Adjust.
gdb/doc/
2014-05-29 Pedro Alves <palves@redhat.com>
* observer.texi (sync_execution_done, command_error): New
subjects.
2014-05-23 12:37:12 +02:00
|
|
|
xsnprintf (buffer, sizeof (buffer),
|
|
|
|
"Switching to interpreter \"%.24s\".\n", interp->name);
|
|
|
|
ui_out_text (current_uiout, buffer);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* interp_lookup - Looks up the interpreter for NAME. If no such
|
|
|
|
interpreter exists, return NULL, otherwise return a pointer to the
|
|
|
|
interpreter. */
|
|
|
|
struct interp *
|
|
|
|
interp_lookup (const char *name)
|
|
|
|
{
|
|
|
|
struct interp *interp;
|
|
|
|
|
|
|
|
if (name == NULL || strlen (name) == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (interp = interp_list; interp != NULL; interp = interp->next)
|
|
|
|
{
|
|
|
|
if (strcmp (interp->name, name) == 0)
|
|
|
|
return interp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Returns the current interpreter. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
struct ui_out *
|
|
|
|
interp_ui_out (struct interp *interp)
|
|
|
|
{
|
|
|
|
if (interp != NULL)
|
2011-09-12 23:25:22 +02:00
|
|
|
return interp->procs->ui_out_proc (interp);
|
|
|
|
|
|
|
|
return current_interpreter->procs->ui_out_proc (current_interpreter);
|
|
|
|
}
|
|
|
|
|
2012-06-29 00:11:23 +02:00
|
|
|
int
|
|
|
|
current_interp_set_logging (int start_log, struct ui_file *out,
|
|
|
|
struct ui_file *logfile)
|
|
|
|
{
|
|
|
|
if (current_interpreter == NULL
|
|
|
|
|| current_interpreter->procs->set_logging_proc == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return current_interpreter->procs->set_logging_proc (current_interpreter,
|
|
|
|
start_log, out,
|
|
|
|
logfile);
|
|
|
|
}
|
|
|
|
|
2012-05-08 20:49:42 +02:00
|
|
|
/* Temporarily overrides the current interpreter. */
|
|
|
|
struct interp *
|
|
|
|
interp_set_temp (const char *name)
|
|
|
|
{
|
|
|
|
struct interp *interp = interp_lookup (name);
|
|
|
|
struct interp *old_interp = current_interpreter;
|
|
|
|
|
|
|
|
if (interp)
|
|
|
|
current_interpreter = interp;
|
|
|
|
return old_interp;
|
|
|
|
}
|
|
|
|
|
2011-09-12 23:25:22 +02:00
|
|
|
/* Returns the interpreter's cookie. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
2011-09-12 23:25:22 +02:00
|
|
|
void *
|
|
|
|
interp_data (struct interp *interp)
|
|
|
|
{
|
|
|
|
return interp->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns the interpreter's name. */
|
|
|
|
|
|
|
|
const char *
|
|
|
|
interp_name (struct interp *interp)
|
|
|
|
{
|
|
|
|
return interp->name;
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Returns true if the current interp is the passed in name. */
|
2003-02-06 06:30:17 +01:00
|
|
|
int
|
|
|
|
current_interp_named_p (const char *interp_name)
|
|
|
|
{
|
|
|
|
if (current_interpreter)
|
|
|
|
return (strcmp (current_interpreter->name, interp_name) == 0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode.
The other part of PR gdb/13860 is about console execution commands in
MI getting their output half lost. E.g., take the finish command,
executed on a frontend's GDB console:
sync:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
~"0x00000000004004d7 in foo () at stepinf.c:6\n"
~"6\t usleep (10);\n"
~"Value returned is $1 = 0\n"
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1"
async:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
Note how all the "Value returned" etc. output is missing in async mode.
The same happens with e.g., catchpoints:
=breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"}
~"\nCatchpoint "
~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n"
~"131\t pid = ARCH_FORK ();\n"
*stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0"
where all those ~ lines are missing in async mode, or just the "step"
current line indication:
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"13\t foo ();\n"
*stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3"
(gdb)
Or in the case of the PRs example, the "Stopped due to shared library
event" note:
start
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="21990"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3"
(gdb)
IMO, if you're typing execution commands in a frontend's console, you
expect to see their output. Indeed it's what you get in sync mode. I
think async mode should do the same. Deciding what to mirror to the
console wrt to breakpoints and random stops gets messy real fast.
E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the
event to the console in this case. But what about more complicated
cases like "s&; thread n; s&", and one of those steps spawning a new
thread, and that thread hitting a breakpoint? It's impossible in
general to track whether the thread had any relation to the commands
that had been executed. So I think we should just simplify and always
mirror breakpoints and random events to the console.
Notes:
- mi->out is the same as gdb_stdout when MI is the current
interpreter. I think that referring to that directly is cleaner.
An earlier revision of this patch made the changes that are now
done in mi_on_normal_stop directly in infrun.c:normal_stop, and so
not having an obvious place to put the new uiout by then, and not
wanting to abuse CLI's uiout, I made a temporary uiout when
necessary.
- Hopefuly the rest of the patch is more or less obvious given the
comments added.
Tested on x86_64 Fedora 20, no regressions.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdbthread.h (struct thread_control_state): New field
`command_interp'.
* infrun.c (follow_fork): Copy the new thread control field to the
child fork thread.
(clear_proceed_status_thread): Clear the new thread control field.
(proceed): Set the new thread control field.
* interps.h (command_interp): Declare.
* interps.c (command_interpreter): New global.
(command_interp): New function.
(interp_exec): Set `command_interpreter' while here.
* cli-out.c (cli_uiout_dtor): New function.
(cli_ui_out_impl): Install it.
* mi/mi-interp.c: Include cli-out.h.
(mi_cmd_interpreter_exec): Add comment.
(restore_current_uiout_cleanup): New function.
(ui_out_free_cleanup): New function.
(mi_on_normal_stop): If finishing an execution command started by
a CLI command, or any kind of breakpoint-like event triggered,
print the stop event to the output (CLI) stream.
* mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp (line_callee4_next_step): New global.
(top level): Test that output related to execution commands is
sent to the console with CLI commands, but not with MI commands.
Test that breakpoint events are always mirrored to the console.
Also expect the new source line to be output after a "next" in
async mode too. Make it a pass/fail test.
* gdb.mi/mi-solib.exp: Test that the CLI solib event note is
output.
* lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-03-11 21:31:36 +01:00
|
|
|
/* The interpreter that is active while `interp_exec' is active, NULL
|
|
|
|
at all other times. */
|
|
|
|
static struct interp *command_interpreter;
|
|
|
|
|
|
|
|
/* The interpreter that was active when a command was executed.
|
|
|
|
Normally that'd always be CURRENT_INTERPRETER, except that MI's
|
|
|
|
-interpreter-exec command doesn't actually flip the current
|
|
|
|
interpreter when running its sub-command. The
|
|
|
|
`command_interpreter' global tracks when interp_exec is called
|
|
|
|
(IOW, when -interpreter-exec is called). If that is set, it is
|
|
|
|
INTERP in '-interpreter-exec INTERP "CMD"' or in 'interpreter-exec
|
|
|
|
INTERP "CMD". Otherwise, interp_exec isn't active, and so the
|
|
|
|
interpreter running the command is the current interpreter. */
|
|
|
|
|
|
|
|
struct interp *
|
|
|
|
command_interp (void)
|
|
|
|
{
|
|
|
|
if (command_interpreter != NULL)
|
|
|
|
return command_interpreter;
|
|
|
|
else
|
|
|
|
return current_interpreter;
|
|
|
|
}
|
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
/* Run the current command interpreter's main loop. */
|
|
|
|
void
|
|
|
|
current_interp_command_loop (void)
|
|
|
|
{
|
2013-09-06 10:53:09 +02:00
|
|
|
gdb_assert (current_interpreter != NULL);
|
|
|
|
|
|
|
|
current_interpreter->procs->command_loop_proc (current_interpreter->data);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
interp_quiet_p (struct interp *interp)
|
|
|
|
{
|
|
|
|
if (interp != NULL)
|
|
|
|
return interp->quiet_p;
|
|
|
|
else
|
|
|
|
return current_interpreter->quiet_p;
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
static int
|
2003-02-06 06:30:17 +01:00
|
|
|
interp_set_quiet (struct interp *interp, int quiet)
|
|
|
|
{
|
|
|
|
int old_val = interp->quiet_p;
|
2010-05-14 23:25:51 +02:00
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
interp->quiet_p = quiet;
|
|
|
|
return old_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* interp_exec - This executes COMMAND_STR in the current
|
2011-01-09 04:08:57 +01:00
|
|
|
interpreter. */
|
2003-02-06 06:30:17 +01:00
|
|
|
|
2005-04-26 07:03:41 +02:00
|
|
|
struct gdb_exception
|
2003-02-06 06:30:17 +01:00
|
|
|
interp_exec (struct interp *interp, const char *command_str)
|
|
|
|
{
|
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode.
The other part of PR gdb/13860 is about console execution commands in
MI getting their output half lost. E.g., take the finish command,
executed on a frontend's GDB console:
sync:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
~"0x00000000004004d7 in foo () at stepinf.c:6\n"
~"6\t usleep (10);\n"
~"Value returned is $1 = 0\n"
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1"
async:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
Note how all the "Value returned" etc. output is missing in async mode.
The same happens with e.g., catchpoints:
=breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"}
~"\nCatchpoint "
~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n"
~"131\t pid = ARCH_FORK ();\n"
*stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0"
where all those ~ lines are missing in async mode, or just the "step"
current line indication:
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"13\t foo ();\n"
*stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3"
(gdb)
Or in the case of the PRs example, the "Stopped due to shared library
event" note:
start
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="21990"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3"
(gdb)
IMO, if you're typing execution commands in a frontend's console, you
expect to see their output. Indeed it's what you get in sync mode. I
think async mode should do the same. Deciding what to mirror to the
console wrt to breakpoints and random stops gets messy real fast.
E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the
event to the console in this case. But what about more complicated
cases like "s&; thread n; s&", and one of those steps spawning a new
thread, and that thread hitting a breakpoint? It's impossible in
general to track whether the thread had any relation to the commands
that had been executed. So I think we should just simplify and always
mirror breakpoints and random events to the console.
Notes:
- mi->out is the same as gdb_stdout when MI is the current
interpreter. I think that referring to that directly is cleaner.
An earlier revision of this patch made the changes that are now
done in mi_on_normal_stop directly in infrun.c:normal_stop, and so
not having an obvious place to put the new uiout by then, and not
wanting to abuse CLI's uiout, I made a temporary uiout when
necessary.
- Hopefuly the rest of the patch is more or less obvious given the
comments added.
Tested on x86_64 Fedora 20, no regressions.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdbthread.h (struct thread_control_state): New field
`command_interp'.
* infrun.c (follow_fork): Copy the new thread control field to the
child fork thread.
(clear_proceed_status_thread): Clear the new thread control field.
(proceed): Set the new thread control field.
* interps.h (command_interp): Declare.
* interps.c (command_interpreter): New global.
(command_interp): New function.
(interp_exec): Set `command_interpreter' while here.
* cli-out.c (cli_uiout_dtor): New function.
(cli_ui_out_impl): Install it.
* mi/mi-interp.c: Include cli-out.h.
(mi_cmd_interpreter_exec): Add comment.
(restore_current_uiout_cleanup): New function.
(ui_out_free_cleanup): New function.
(mi_on_normal_stop): If finishing an execution command started by
a CLI command, or any kind of breakpoint-like event triggered,
print the stop event to the output (CLI) stream.
* mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp (line_callee4_next_step): New global.
(top level): Test that output related to execution commands is
sent to the console with CLI commands, but not with MI commands.
Test that breakpoint events are always mirrored to the console.
Also expect the new source line to be output after a "next" in
async mode too. Make it a pass/fail test.
* gdb.mi/mi-solib.exp: Test that the CLI solib event note is
output.
* lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-03-11 21:31:36 +01:00
|
|
|
struct gdb_exception ex;
|
|
|
|
struct interp *save_command_interp;
|
|
|
|
|
2013-12-11 01:06:53 +01:00
|
|
|
gdb_assert (interp->procs->exec_proc != NULL);
|
|
|
|
|
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode.
The other part of PR gdb/13860 is about console execution commands in
MI getting their output half lost. E.g., take the finish command,
executed on a frontend's GDB console:
sync:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
~"0x00000000004004d7 in foo () at stepinf.c:6\n"
~"6\t usleep (10);\n"
~"Value returned is $1 = 0\n"
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1"
async:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
Note how all the "Value returned" etc. output is missing in async mode.
The same happens with e.g., catchpoints:
=breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"}
~"\nCatchpoint "
~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n"
~"131\t pid = ARCH_FORK ();\n"
*stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0"
where all those ~ lines are missing in async mode, or just the "step"
current line indication:
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"13\t foo ();\n"
*stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3"
(gdb)
Or in the case of the PRs example, the "Stopped due to shared library
event" note:
start
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="21990"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3"
(gdb)
IMO, if you're typing execution commands in a frontend's console, you
expect to see their output. Indeed it's what you get in sync mode. I
think async mode should do the same. Deciding what to mirror to the
console wrt to breakpoints and random stops gets messy real fast.
E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the
event to the console in this case. But what about more complicated
cases like "s&; thread n; s&", and one of those steps spawning a new
thread, and that thread hitting a breakpoint? It's impossible in
general to track whether the thread had any relation to the commands
that had been executed. So I think we should just simplify and always
mirror breakpoints and random events to the console.
Notes:
- mi->out is the same as gdb_stdout when MI is the current
interpreter. I think that referring to that directly is cleaner.
An earlier revision of this patch made the changes that are now
done in mi_on_normal_stop directly in infrun.c:normal_stop, and so
not having an obvious place to put the new uiout by then, and not
wanting to abuse CLI's uiout, I made a temporary uiout when
necessary.
- Hopefuly the rest of the patch is more or less obvious given the
comments added.
Tested on x86_64 Fedora 20, no regressions.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdbthread.h (struct thread_control_state): New field
`command_interp'.
* infrun.c (follow_fork): Copy the new thread control field to the
child fork thread.
(clear_proceed_status_thread): Clear the new thread control field.
(proceed): Set the new thread control field.
* interps.h (command_interp): Declare.
* interps.c (command_interpreter): New global.
(command_interp): New function.
(interp_exec): Set `command_interpreter' while here.
* cli-out.c (cli_uiout_dtor): New function.
(cli_ui_out_impl): Install it.
* mi/mi-interp.c: Include cli-out.h.
(mi_cmd_interpreter_exec): Add comment.
(restore_current_uiout_cleanup): New function.
(ui_out_free_cleanup): New function.
(mi_on_normal_stop): If finishing an execution command started by
a CLI command, or any kind of breakpoint-like event triggered,
print the stop event to the output (CLI) stream.
* mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp (line_callee4_next_step): New global.
(top level): Test that output related to execution commands is
sent to the console with CLI commands, but not with MI commands.
Test that breakpoint events are always mirrored to the console.
Also expect the new source line to be output after a "next" in
async mode too. Make it a pass/fail test.
* gdb.mi/mi-solib.exp: Test that the CLI solib event note is
output.
* lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-03-11 21:31:36 +01:00
|
|
|
/* See `command_interp' for why we do this. */
|
|
|
|
save_command_interp = command_interpreter;
|
|
|
|
command_interpreter = interp;
|
|
|
|
|
|
|
|
ex = interp->procs->exec_proc (interp->data, command_str);
|
|
|
|
|
|
|
|
command_interpreter = save_command_interp;
|
|
|
|
|
|
|
|
return ex;
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
2005-01-14 01:55:36 +01:00
|
|
|
/* A convenience routine that nulls out all the common command hooks.
|
|
|
|
Use it when removing your interpreter in its suspend proc. */
|
2003-02-06 06:30:17 +01:00
|
|
|
void
|
2003-02-09 11:47:37 +01:00
|
|
|
clear_interpreter_hooks (void)
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 01:52:21 +02:00
|
|
|
deprecated_init_ui_hook = 0;
|
|
|
|
deprecated_print_frame_info_listing_hook = 0;
|
2003-02-06 06:30:17 +01:00
|
|
|
/*print_frame_more_info_hook = 0; */
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 01:52:21 +02:00
|
|
|
deprecated_query_hook = 0;
|
|
|
|
deprecated_warning_hook = 0;
|
|
|
|
deprecated_interactive_hook = 0;
|
|
|
|
deprecated_readline_begin_hook = 0;
|
|
|
|
deprecated_readline_hook = 0;
|
|
|
|
deprecated_readline_end_hook = 0;
|
|
|
|
deprecated_register_changed_hook = 0;
|
|
|
|
deprecated_context_hook = 0;
|
|
|
|
deprecated_target_wait_hook = 0;
|
|
|
|
deprecated_call_command_hook = 0;
|
|
|
|
deprecated_error_begin_hook = 0;
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
static void
|
2003-02-06 06:30:17 +01:00
|
|
|
interpreter_exec_cmd (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
struct interp *old_interp, *interp_to_use;
|
|
|
|
char **prules = NULL;
|
|
|
|
char **trule = NULL;
|
|
|
|
unsigned int nrules;
|
|
|
|
unsigned int i;
|
|
|
|
int old_quiet, use_quiet;
|
2013-05-30 18:24:36 +02:00
|
|
|
struct cleanup *cleanup;
|
2003-02-06 06:30:17 +01:00
|
|
|
|
2008-10-03 18:36:10 +02:00
|
|
|
if (args == NULL)
|
|
|
|
error_no_arg (_("interpreter-exec command"));
|
|
|
|
|
|
|
|
prules = gdb_buildargv (args);
|
2013-05-30 18:24:36 +02:00
|
|
|
cleanup = make_cleanup_freeargv (prules);
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
nrules = 0;
|
2008-10-03 18:36:10 +02:00
|
|
|
for (trule = prules; *trule != NULL; trule++)
|
|
|
|
nrules++;
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
if (nrules < 2)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("usage: interpreter-exec <interpreter> [ <command> ... ]"));
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
old_interp = current_interpreter;
|
|
|
|
|
|
|
|
interp_to_use = interp_lookup (prules[0]);
|
|
|
|
if (interp_to_use == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Could not find interpreter \"%s\"."), prules[0]);
|
2003-02-06 06:30:17 +01:00
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Temporarily set interpreters quiet. */
|
2003-02-06 06:30:17 +01:00
|
|
|
old_quiet = interp_set_quiet (old_interp, 1);
|
|
|
|
use_quiet = interp_set_quiet (interp_to_use, 1);
|
|
|
|
|
2008-03-14 18:21:08 +01:00
|
|
|
if (!interp_set (interp_to_use, 0))
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Could not switch to interpreter \"%s\"."), prules[0]);
|
2003-02-06 06:30:17 +01:00
|
|
|
|
|
|
|
for (i = 1; i < nrules; i++)
|
|
|
|
{
|
2005-04-26 07:03:41 +02:00
|
|
|
struct gdb_exception e = interp_exec (interp_to_use, prules[i]);
|
2010-05-14 23:25:51 +02:00
|
|
|
|
2005-01-26 10:56:18 +01:00
|
|
|
if (e.reason < 0)
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
2008-03-14 18:21:08 +01:00
|
|
|
interp_set (old_interp, 0);
|
2006-09-16 06:10:41 +02:00
|
|
|
interp_set_quiet (interp_to_use, use_quiet);
|
|
|
|
interp_set_quiet (old_interp, old_quiet);
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("error in command: \"%s\"."), prules[i]);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-14 18:21:08 +01:00
|
|
|
interp_set (old_interp, 0);
|
2003-02-06 06:30:17 +01:00
|
|
|
interp_set_quiet (interp_to_use, use_quiet);
|
|
|
|
interp_set_quiet (old_interp, old_quiet);
|
2013-05-30 18:24:36 +02:00
|
|
|
|
|
|
|
do_cleanups (cleanup);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 04:08:57 +01:00
|
|
|
/* List the possible interpreters which could complete the given text. */
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
static VEC (char_ptr) *
|
Constify strings in tracepoint.c, lookup_cmd and the completers.
This is sort of a continuation of Keith's parse_exp_1 constification
patch. It started out by undoing these bits:
@@ -754,9 +754,12 @@ validate_actionline (char **line, struct
tmp_p = p;
for (loc = t->base.loc; loc; loc = loc->next)
{
- p = tmp_p;
- exp = parse_exp_1 (&p, loc->address,
+ const char *q;
+
+ q = tmp_p;
+ exp = parse_exp_1 (&q, loc->address,
block_for_pc (loc->address), 1);
+ p = (char *) q;
and progressively making more things const upwards, fixing fallout,
rinse repeat, until GDB built again (--enable-targets=all).
That ended up constifying lookup_cmd/add_cmd and (lots of) friends,
and the completers.
I didn't try to constify the command hooks themselves, because I know
upfront there are commands that write to the command string argument,
and I think I managed to stop at a nice non-hacky split point already.
I think the only non-really-super-obvious changes are
tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions.
The rest is just mostly about 'char *' => 'const char *', 'char **'=>
'const char **', and the occasional (e.g., deprecated_cmd_warning)
case of 'char **'=> 'const char *', where/when I noticed that nothing
actually cares about the pointer to pointer output.
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/
2013-03-13 Pedro Alves <palves@redhat.com>
* ada-lang.c (struct add_partial_datum) <text, text0, word>: Make
fields const.
(ada_make_symbol_completion_list): Make "text0" parameter const.
* ax-gdb.c (agent_eval_command_one): Make "exp" parameter const.
* breakpoint.c (condition_completer): Make "text" and "word"
parameters const. Adjust.
(check_tracepoint_command): Adjust to validate_actionline
prototype change.
(catch_syscall_completer): Make "text" and "word" parameters
const.
* cli/cli-cmds.c (show_user): Make "comname" local const.
(valid_command_p): Make "command" parameter const.
(alias_command): Make "alias_prefix" and "command_prefix" locals
const.
* cli/cli-decode.c (add_cmd): Make "name" parameter const.
(add_alias_cmd): Make "name" and "oldname" parameters const.
Adjust. No longer make copy of OLDNAME.
(add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd)
(add_setshow_cmd_full, add_setshow_enum_cmd)
(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
(add_setshow_filename_cmd, add_setshow_string_cmd)
(add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd)
(delete_cmd, add_info, add_info_alias, add_com, add_com_alias):
Make "name" parameter const.
(help_cmd): Rename "command" parameter to "arg". New const local
"command".
(find_cmd): Make "command" parameter const.
(lookup_cmd_1): Make "text" parameter pointer to const. Adjust to
deprecated_cmd_warning prototype change.
(undef_cmd_error): Make "cmdtype" parameter const.
(lookup_cmd): Make "line" parameter const.
(deprecated_cmd_warning): Change type of "text" parameter to
pointer to const char, from pointer to pointer to char. Adjust.
(lookup_cmd_composition): Make "text" parameter const.
(complete_on_cmdlist, complete_on_enum): Make "text" and "word"
parameters const.
* cli/cli-decode.h (struct cmd_list_element) <name>: Make field
const.
* cli/cli-script.c (validate_comname): Make "tem" local const.
(define_command): New const local "tem_c". Use it in calls to
lookup_cmd.
(document_command): Make "tem" and "comfull" locals const.
(show_user_1): Make "prefix" and "name" parameters const.
* cli-script.h (show_user_1): Make "prefix" and "name" parameters
const.
* command.h (add_cmd, add_alias_cmd, add_prefix_cmd)
(add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1)
(deprecated_cmd_warning, lookup_cmd_composition, add_com)
(add_com_alias, add_info, add_info_alias, complete_on_cmdlist)
(complete_on_enum, add_setshow_enum_cmd)
(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
(add_setshow_filename_cmd, add_setshow_string_cmd)
(add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Change prototypes, constifying strings.
* completer.c (noop_completer, filename_completer): Make "text"
and "prefix" parameters const.
(location_completer, expression_completer)
(complete_line_internal): Make "text" and "prefix" parameters
const and adjust.
(command_completer, signal_completer): Make "text" and "prefix"
parameters const.
* completer.h (noop_completer, filename_completer)
(expression_completer, location_completer, command_completer)
(signal_completer): Change prototypes.
* corefile.c (complete_set_gnutarget): Make "text" and "word"
parameters const.
* cp-abi.c (cp_abi_completer): Likewise.
* expression.h (parse_expression_for_completion): Change
prototype.
* f-lang.c (f_make_symbol_completion_list): Make "text" and "word"
parameters const.
* infcmd.c (_initialize_infcmd): Make "cmd_name" local const.
* infrun.c (handle_completer): Make "text" and "word" parameters
const.
* interps.c (interpreter_completer): Make "text" and "word"
parameters const.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Make "text" and "word"
parameters const.
* parse.c (parse_exp_1): Move const hack to parse_exp_in_context.
(parse_exp_in_context): Rename to ...
(parse_exp_in_context_1): ... this.
(parse_exp_in_context): Reimplement, with const hack from
parse_exp_1.
(parse_expression_for_completion): Make "string" parameter const.
* printcmd.c (decode_format): Make "string_ptr" parameter pointer
to pointer to const char. Adjust.
(print_command_1): Make "exp" parameter const.
(output_command): Rename to ...
(output_command_const): ... this. Make "exp" parameter const.
(output_command): Reimplement.
(x_command): Adjust.
(display_command): Rename "exp" parameter to "arg". New "exp"
local, const version of "arg".
* python/py-auto-load.c (gdbpy_initialize_auto_load): Make
"cmd_name" local const.
* python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree
call.
(cmdpy_completer): Make "text" and "word" parameters const.
(gdbpy_parse_command_name): Make "prefix_text2" local const.
* python/py-param.c (add_setshow_generic): Make "tmp_name" local
const.
* remote.c (_initialize_remote): Make "cmd_name" local const.
* symtab.c (language_search_unquoted_string): Make "text" and "p"
parameters const. Adjust.
(completion_list_add_fields): Make "sym_text", "text" and "word"
parameters const.
(struct add_name_data) <sym_text, text, word>: Make fields const.
(default_make_symbol_completion_list_break_on): Make "text" and
"word" parameters const. Adjust locals.
(default_make_symbol_completion_list)
(make_symbol_completion_list, make_symbol_completion_type)
(make_symbol_completion_list_fn): Make "text" and "word"
parameters const.
(make_file_symbol_completion_list): Make "text", "word" and
"srcfile" parameters const. Adjust locals.
(add_filename_to_list): Make "text" and "word" parameters const.
(struct add_partial_filename_data) <text, word>: Make fields
const.
(make_source_files_completion_list): Make "text" and "word"
parameters const.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_type enum type_code)
(make_symbol_completion_list_fn make_file_symbol_completion_list)
(make_source_files_completion_list): Change prototype.
* top.c (execute_command): Adjust to pass pointer to pointer to
const char to lookup_cmd, and to deprecated_cmd_warning prototype
change.
(set_verbose): Make "cmdname" local const.
* tracepoint.c (decode_agent_options): Make "exp" parameter const,
and adjust.
(validate_actionline): Make "line" parameter a pointer to const
char, and adjust.
(encode_actions_1): Make "action_exp" local const, and adjust.
(encode_actions): Adjust.
(replace_comma): Delete.
(trace_dump_actions): Make "action_exp" and "next_comma" locals
const, and adjust. Don't frob the action string while splitting
it at commas. Instead, make a copy of each split substring in
turn.
(trace_dump_command): Adjust to validate_actionline prototype
change.
* tracepoint.h (decode_agent_options, decode_agent_options)
(encode_actions, validate_actionline): Change prototypes.
* valprint.h (output_command): Delete declaration.
(output_command_const): Declare.
* value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 19:34:55 +01:00
|
|
|
interpreter_completer (struct cmd_list_element *ignore,
|
|
|
|
const char *text, const char *word)
|
2003-02-06 06:30:17 +01:00
|
|
|
{
|
|
|
|
int textlen;
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
VEC (char_ptr) *matches = NULL;
|
2003-02-06 06:30:17 +01:00
|
|
|
struct interp *interp;
|
|
|
|
|
|
|
|
textlen = strlen (text);
|
|
|
|
for (interp = interp_list; interp != NULL; interp = interp->next)
|
|
|
|
{
|
|
|
|
if (strncmp (interp->name, text, textlen) == 0)
|
|
|
|
{
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
char *match;
|
|
|
|
|
|
|
|
match = (char *) xmalloc (strlen (word) + strlen (interp->name) + 1);
|
2003-02-06 06:30:17 +01:00
|
|
|
if (word == text)
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
strcpy (match, interp->name);
|
2003-02-06 06:30:17 +01:00
|
|
|
else if (word > text)
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Return some portion of interp->name. */
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
strcpy (match, interp->name + (word - text));
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Return some of text plus interp->name. */
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
strncpy (match, word, text - word);
|
|
|
|
match[text - word] = '\0';
|
|
|
|
strcat (match, interp->name);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
2012-06-13 17:47:16 +02:00
|
|
|
VEC_safe_push (char_ptr, matches, match);
|
2003-02-06 06:30:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return matches;
|
|
|
|
}
|
|
|
|
|
2008-04-19 08:08:18 +02:00
|
|
|
struct interp *
|
|
|
|
top_level_interpreter (void)
|
|
|
|
{
|
|
|
|
return top_level_interpreter_ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
2008-03-14 18:21:08 +01:00
|
|
|
top_level_interpreter_data (void)
|
|
|
|
{
|
2008-04-19 08:08:18 +02:00
|
|
|
gdb_assert (top_level_interpreter_ptr);
|
|
|
|
return top_level_interpreter_ptr->data;
|
2008-03-14 18:21:08 +01:00
|
|
|
}
|
|
|
|
|
2003-02-06 06:30:17 +01:00
|
|
|
/* This just adds the "interpreter-exec" command. */
|
|
|
|
void
|
|
|
|
_initialize_interpreter (void)
|
|
|
|
{
|
|
|
|
struct cmd_list_element *c;
|
|
|
|
|
|
|
|
c = add_cmd ("interpreter-exec", class_support,
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
interpreter_exec_cmd, _("\
|
|
|
|
Execute a command in an interpreter. It takes two arguments:\n\
|
2003-02-06 06:30:17 +01:00
|
|
|
The first argument is the name of the interpreter to use.\n\
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
The second argument is the command to execute.\n"), &cmdlist);
|
2003-02-06 06:30:17 +01:00
|
|
|
set_cmd_completer (c, interpreter_completer);
|
|
|
|
}
|