5fed81ff35
This removes cmd_cfunc_ftype and the non-const overload of add_cmd; then fixes up the fallout. For the most part this patch is straightforward. There are a few files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not compile; so I made a best effort there. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt) (go32_pde, go32_pte, go32_pte_for_address): Constify. * gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd) (set_thread_default_pause_cmd, set_thread_default_run_cmd) (show_thread_default_run_cmd, set_thread_default_detach_sc_cmd) (parse_int_arg, show_thread_default_detach_sc_cmd) (set_signals_cmd, show_signals_cmd, set_sig_thread_cmd) (show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd) (set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd) (show_task_pause_cmd, set_task_detach_sc_cmd) (show_task_detach_sc_cmd, set_task_exc_port_cmd) (set_noninvasive_cmd, set_thread_pause_cmd) (show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd) (set_thread_detach_sc_cmd, show_thread_detach_sc_cmd) (set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify. * windows-nat.c (display_selectors): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Remove non-const "cfunc". * cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload. (cmd_cfunc_eq): Likewise. (struct cmd_list_element): Likewise. (do_cfunc): Remove. (cli_user_command_p): Update. * command.h (add_cmd): Remove non-const overload. (cmd_cfunc_ftype): Remove typedef. (cmd_cfunc_eq): Remove non-const overload. * value.c (show_values): Constify. * thread.c (thread_apply_all_command): Constify. * symfile.c (load_command): Constify. * source.c (directory_command): Constify. * maint.c (maintenance_internal_error) (maintenance_demangler_warning, maintenance_space_display) (maintenance_print_architecture, maintenance_translate_address) (maintenance_info_selftests, maintenance_internal_warning): Constify. * breakpoint.c (disable_trace_command, enable_trace_command): Constify. * auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir): Constify. (add_auto_load_safe_path): Constify. * guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify. * top.h (show_commands): Constify. * linux-thread-db.c (info_auto_load_libthread_db): Constify. * sparc64-tdep.c (adi_examine_command): Constify. (adi_assign_command): Constify.
80 lines
2.7 KiB
C
80 lines
2.7 KiB
C
/* GDB routines for supporting auto-loaded Guile scripts.
|
||
|
||
Copyright (C) 2010-2017 Free Software Foundation, 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
|
||
the Free Software Foundation; either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||
|
||
#include "defs.h"
|
||
#include "top.h"
|
||
#include "gdbcmd.h"
|
||
#include "objfiles.h"
|
||
#include "cli/cli-cmds.h"
|
||
#include "auto-load.h"
|
||
#include "guile.h"
|
||
#include "guile-internal.h"
|
||
|
||
/* User-settable option to enable/disable auto-loading of Guile scripts:
|
||
set auto-load guile-scripts on|off
|
||
This is true if we should auto-load associated Guile scripts when an
|
||
objfile is opened, false otherwise. */
|
||
static int auto_load_guile_scripts = 1;
|
||
|
||
/* "show" command for the auto_load_guile_scripts configuration variable. */
|
||
|
||
static void
|
||
show_auto_load_guile_scripts (struct ui_file *file, int from_tty,
|
||
struct cmd_list_element *c, const char *value)
|
||
{
|
||
fprintf_filtered (file, _("Auto-loading of Guile scripts is %s.\n"), value);
|
||
}
|
||
|
||
/* Return non-zero if auto-loading Guile scripts is enabled.
|
||
This is the extension_language_script_ops.auto_load_enabled "method". */
|
||
|
||
int
|
||
gdbscm_auto_load_enabled (const struct extension_language_defn *extlang)
|
||
{
|
||
return auto_load_guile_scripts;
|
||
}
|
||
|
||
/* Wrapper for "info auto-load guile-scripts". */
|
||
|
||
static void
|
||
info_auto_load_guile_scripts (const char *pattern, int from_tty)
|
||
{
|
||
auto_load_info_scripts (pattern, from_tty, &extension_language_guile);
|
||
}
|
||
|
||
void
|
||
gdbscm_initialize_auto_load (void)
|
||
{
|
||
add_setshow_boolean_cmd ("guile-scripts", class_support,
|
||
&auto_load_guile_scripts, _("\
|
||
Set the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
|
||
Show the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
|
||
If enabled, auto-loaded Guile scripts are loaded when the debugger reads\n\
|
||
an executable or shared library.\n\
|
||
This options has security implications for untrusted inferiors."),
|
||
NULL, show_auto_load_guile_scripts,
|
||
auto_load_set_cmdlist_get (),
|
||
auto_load_show_cmdlist_get ());
|
||
|
||
add_cmd ("guile-scripts", class_info, info_auto_load_guile_scripts,
|
||
_("Print the list of automatically loaded Guile scripts.\n\
|
||
Usage: info auto-load guile-scripts [REGEXP]"),
|
||
auto_load_info_cmdlist_get ());
|
||
}
|