convert to_set_syscall_catchpoint
[deliverable/binutils-gdb.git] / gdb / python / py-auto-load.c
CommitLineData
8a1ea21f
DE
1/* GDB routines for supporting auto-loaded scripts.
2
ecd75fc8 3 Copyright (C) 2010-2014 Free Software Foundation, Inc.
8a1ea21f
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"
0e9f083f 21#include <string.h>
8a1ea21f
DE
22#include "top.h"
23#include "exceptions.h"
8a1ea21f 24#include "gdbcmd.h"
8a1ea21f
DE
25#include "objfiles.h"
26#include "python.h"
e2207b9a 27#include "auto-load.h"
88a1906b
DE
28#include "python-internal.h"
29
bf88dd68
JK
30/* User-settable option to enable/disable auto-loading of Python scripts:
31 set auto-load python-scripts on|off
32 This is true if we should auto-load associated Python scripts when an
33 objfile is opened, false otherwise. */
34static int auto_load_python_scripts = 1;
35
bf88dd68
JK
36/* "show" command for the auto_load_python_scripts configuration variable. */
37
38static void
39show_auto_load_python_scripts (struct ui_file *file, int from_tty,
40 struct cmd_list_element *c, const char *value)
41{
42 fprintf_filtered (file, _("Auto-loading of Python scripts is %s.\n"), value);
43}
44
6dddc817
DE
45/* Return non-zero if auto-loading Python scripts is enabled.
46 This is the extension_language_script_ops.auto_load_enabled "method". */
bf88dd68 47
6dddc817
DE
48int
49gdbpy_auto_load_enabled (const struct extension_language_defn *extlang)
bf88dd68 50{
5b2bf947 51 return auto_load_python_scripts;
bf88dd68 52}
8a1ea21f 53
bf88dd68
JK
54/* Wrapper for "info auto-load python-scripts". */
55
56static void
57info_auto_load_python_scripts (char *pattern, int from_tty)
58{
6dddc817 59 auto_load_info_scripts (pattern, from_tty, &extension_language_python);
bf88dd68 60}
8a1ea21f 61\f
999633ed 62int
8a1ea21f
DE
63gdbpy_initialize_auto_load (void)
64{
bf88dd68 65 struct cmd_list_element *cmd;
6f937416 66 const char *cmd_name;
bf88dd68
JK
67
68 add_setshow_boolean_cmd ("python-scripts", class_support,
69 &auto_load_python_scripts, _("\
70Set the debugger's behaviour regarding auto-loaded Python scripts."), _("\
71Show the debugger's behaviour regarding auto-loaded Python scripts."), _("\
72If enabled, auto-loaded Python scripts are loaded when the debugger reads\n\
73an executable or shared library.\n\
74This options has security implications for untrusted inferiors."),
75 NULL, show_auto_load_python_scripts,
76 auto_load_set_cmdlist_get (),
77 auto_load_show_cmdlist_get ());
78
a86caf66 79 add_setshow_boolean_cmd ("auto-load-scripts", class_support,
bf88dd68
JK
80 &auto_load_python_scripts, _("\
81Set the debugger's behaviour regarding auto-loaded Python scripts, "
82 "deprecated."),
83 _("\
84Show the debugger's behaviour regarding auto-loaded Python scripts, "
85 "deprecated."),
86 NULL, NULL, show_auto_load_python_scripts,
87 &setlist, &showlist);
88 cmd_name = "auto-load-scripts";
89 cmd = lookup_cmd (&cmd_name, setlist, "", -1, 1);
90 deprecate_cmd (cmd, "set auto-load python-scripts");
91
92 /* It is needed because lookup_cmd updates the CMD_NAME pointer. */
93 cmd_name = "auto-load-scripts";
94 cmd = lookup_cmd (&cmd_name, showlist, "", -1, 1);
95 deprecate_cmd (cmd, "show auto-load python-scripts");
96
97 add_cmd ("python-scripts", class_info, info_auto_load_python_scripts,
98 _("Print the list of automatically loaded Python scripts.\n\
99Usage: info auto-load python-scripts [REGEXP]"),
100 auto_load_info_cmdlist_get ());
101
102 cmd = add_info ("auto-load-scripts", info_auto_load_python_scripts, _("\
103Print the list of automatically loaded Python scripts, deprecated."));
104 deprecate_cmd (cmd, "info auto-load python-scripts");
999633ed
TT
105
106 return 0;
8a1ea21f 107}
This page took 0.409755 seconds and 4 git commands to generate.