]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/guile/scm-auto-load.c
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / guile / scm-auto-load.c
CommitLineData
ed3ef339
DE
1/* GDB routines for supporting auto-loaded Guile scripts.
2
4a94e368 3 Copyright (C) 2010-2022 Free Software Foundation, Inc.
ed3ef339
DE
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
ed3ef339 21#include "top.h"
ed3ef339
DE
22#include "gdbcmd.h"
23#include "objfiles.h"
24#include "cli/cli-cmds.h"
25#include "auto-load.h"
26#include "guile.h"
27#include "guile-internal.h"
28
29/* User-settable option to enable/disable auto-loading of Guile scripts:
30 set auto-load guile-scripts on|off
31 This is true if we should auto-load associated Guile scripts when an
32 objfile is opened, false otherwise. */
491144b5 33static bool auto_load_guile_scripts = true;
ed3ef339
DE
34
35/* "show" command for the auto_load_guile_scripts configuration variable. */
36
37static void
38show_auto_load_guile_scripts (struct ui_file *file, int from_tty,
39 struct cmd_list_element *c, const char *value)
40{
41 fprintf_filtered (file, _("Auto-loading of Guile scripts is %s.\n"), value);
42}
43
db972fce 44/* See guile-internal.h. */
ed3ef339 45
db972fce 46bool
ed3ef339
DE
47gdbscm_auto_load_enabled (const struct extension_language_defn *extlang)
48{
49 return auto_load_guile_scripts;
50}
51
52/* Wrapper for "info auto-load guile-scripts". */
53
54static void
5fed81ff 55info_auto_load_guile_scripts (const char *pattern, int from_tty)
ed3ef339
DE
56{
57 auto_load_info_scripts (pattern, from_tty, &extension_language_guile);
58}
59\f
60void
61gdbscm_initialize_auto_load (void)
62{
63 add_setshow_boolean_cmd ("guile-scripts", class_support,
64 &auto_load_guile_scripts, _("\
65Set the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
66Show the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
67If enabled, auto-loaded Guile scripts are loaded when the debugger reads\n\
68an executable or shared library.\n\
69This options has security implications for untrusted inferiors."),
70 NULL, show_auto_load_guile_scripts,
71 auto_load_set_cmdlist_get (),
72 auto_load_show_cmdlist_get ());
73
74 add_cmd ("guile-scripts", class_info, info_auto_load_guile_scripts,
75 _("Print the list of automatically loaded Guile scripts.\n\
76Usage: info auto-load guile-scripts [REGEXP]"),
77 auto_load_info_cmdlist_get ());
78}