GDB (xrefs)
/tmp/gdb-7.10/gdb/agent.c
Go to the documentation of this file.
1 /* Copyright (C) 2012-2015 Free Software Foundation, Inc.
2 
3  This file is part of GDB.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #include "defs.h"
19 #include "command.h"
20 #include "gdbcmd.h"
21 #include "target.h"
22 #include "agent.h"
23 
24 /* Enum strings for "set|show agent". */
25 
26 static const char can_use_agent_on[] = "on";
27 static const char can_use_agent_off[] = "off";
28 static const char *can_use_agent_enum[] =
29 {
32  NULL,
33 };
34 
35 static const char *can_use_agent = can_use_agent_off;
36 
37 static void
38 show_can_use_agent (struct ui_file *file, int from_tty,
39  struct cmd_list_element *c, const char *value)
40 {
41  fprintf_filtered (file,
42  _("Debugger's willingness to use agent in inferior "
43  "as a helper is %s.\n"), value);
44 }
45 
46 static void
47 set_can_use_agent (char *args, int from_tty, struct cmd_list_element *c)
48 {
50  /* Something wrong during setting, set flag to default value. */
52 }
53 
54 /* -Wmissing-prototypes */
56 
57 #include "observer.h"
58 #include "objfiles.h"
59 
60 static void
62 {
63  if (objfile == NULL || agent_loaded_p ())
64  return;
65 
66  agent_look_up_symbols (objfile);
67 }
68 
69 void
71 {
73 
76  &can_use_agent, _("\
77 Set debugger's willingness to use agent as a helper."), _("\
78 Show debugger's willingness to use agent as a helper."), _("\
79 If on, GDB will delegate some of the debugging operations to the\n\
80 agent, if the target supports it. This will speed up those\n\
81 operations that are supported by the agent.\n\
82 If off, GDB will not use agent, even if such is supported by the\n\
83 target."),
86  &setlist, &showlist);
87 }
initialize_file_ftype _initialize_agent
void add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
Definition: cli-decode.c:487
static const char * can_use_agent_enum[]
Definition: agent.c:28
static void show_can_use_agent(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition: agent.c:38
#define _(String)
Definition: gdb_locale.h:40
static const char * can_use_agent
Definition: agent.c:35
static const char can_use_agent_on[]
Definition: agent.c:26
struct cmd_list_element * setlist
Definition: cli-cmds.c:135
static const char can_use_agent_off[]
Definition: agent.c:27
void initialize_file_ftype(void)
Definition: defs.h:281
void fprintf_filtered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2351
struct cmd_list_element * showlist
Definition: cli-cmds.c:143
Definition: value.c:172
static void agent_new_objfile(struct objfile *objfile)
Definition: agent.c:61
static void set_can_use_agent(char *args, int from_tty, struct cmd_list_element *c)
Definition: agent.c:47
int agent_loaded_p(void)
Definition: agent.c:78
struct observer * observer_attach_new_objfile(observer_new_objfile_ftype *f)
#define target_use_agent(use)
Definition: target.h:2162
int agent_look_up_symbols(void *arg)
Definition: agent.c:87