Add Guile as an extension language.
[deliverable/binutils-gdb.git] / gdb / guile / scm-auto-load.c
1 /* GDB routines for supporting auto-loaded Guile scripts.
2
3 Copyright (C) 2010-2014 Free Software Foundation, Inc.
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"
21 #include <string.h>
22 #include "top.h"
23 #include "exceptions.h"
24 #include "gdbcmd.h"
25 #include "objfiles.h"
26 #include "cli/cli-cmds.h"
27 #include "auto-load.h"
28 #include "guile.h"
29 #include "guile-internal.h"
30
31 /* User-settable option to enable/disable auto-loading of Guile scripts:
32 set auto-load guile-scripts on|off
33 This is true if we should auto-load associated Guile scripts when an
34 objfile is opened, false otherwise. */
35 static int auto_load_guile_scripts = 1;
36
37 /* "show" command for the auto_load_guile_scripts configuration variable. */
38
39 static void
40 show_auto_load_guile_scripts (struct ui_file *file, int from_tty,
41 struct cmd_list_element *c, const char *value)
42 {
43 fprintf_filtered (file, _("Auto-loading of Guile scripts is %s.\n"), value);
44 }
45
46 /* Return non-zero if auto-loading Guile scripts is enabled.
47 This is the extension_language_script_ops.auto_load_enabled "method". */
48
49 int
50 gdbscm_auto_load_enabled (const struct extension_language_defn *extlang)
51 {
52 return auto_load_guile_scripts;
53 }
54
55 /* Wrapper for "info auto-load guile-scripts". */
56
57 static void
58 info_auto_load_guile_scripts (char *pattern, int from_tty)
59 {
60 auto_load_info_scripts (pattern, from_tty, &extension_language_guile);
61 }
62 \f
63 void
64 gdbscm_initialize_auto_load (void)
65 {
66 add_setshow_boolean_cmd ("guile-scripts", class_support,
67 &auto_load_guile_scripts, _("\
68 Set the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
69 Show the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
70 If enabled, auto-loaded Guile scripts are loaded when the debugger reads\n\
71 an executable or shared library.\n\
72 This options has security implications for untrusted inferiors."),
73 NULL, show_auto_load_guile_scripts,
74 auto_load_set_cmdlist_get (),
75 auto_load_show_cmdlist_get ());
76
77 add_cmd ("guile-scripts", class_info, info_auto_load_guile_scripts,
78 _("Print the list of automatically loaded Guile scripts.\n\
79 Usage: info auto-load guile-scripts [REGEXP]"),
80 auto_load_info_cmdlist_get ());
81 }
This page took 0.0311 seconds and 4 git commands to generate.