GDB (API)
/home/stan/gdb/src/gdb/agent.c
Go to the documentation of this file.
00001 /* Copyright (C) 2012-2013 Free Software Foundation, Inc.
00002 
00003    This file is part of GDB.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 3 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00017 
00018 #include "defs.h"
00019 #include "command.h"
00020 #include "gdbcmd.h"
00021 #include "target.h"
00022 #include "agent.h"
00023 
00024 /* Enum strings for "set|show agent".  */
00025 
00026 static const char can_use_agent_on[] = "on";
00027 static const char can_use_agent_off[] = "off";
00028 static const char *can_use_agent_enum[] =
00029 {
00030   can_use_agent_on,
00031   can_use_agent_off,
00032   NULL,
00033 };
00034 
00035 static const char *can_use_agent = can_use_agent_off;
00036 
00037 static void
00038 show_can_use_agent (struct ui_file *file, int from_tty,
00039                     struct cmd_list_element *c, const char *value)
00040 {
00041   fprintf_filtered (file,
00042                     _("Debugger's willingness to use agent in inferior "
00043                       "as a helper is %s.\n"), value);
00044 }
00045 
00046 static void
00047 set_can_use_agent (char *args, int from_tty, struct cmd_list_element *c)
00048 {
00049   if (target_use_agent (can_use_agent == can_use_agent_on) == 0)
00050     /* Something wrong during setting, set flag to default value.  */
00051     can_use_agent = can_use_agent_off;
00052 }
00053 
00054 /* -Wmissing-prototypes */
00055 extern initialize_file_ftype _initialize_agent;
00056 
00057 #include "observer.h"
00058 #include "objfiles.h"
00059 
00060 static void
00061 agent_new_objfile (struct objfile *objfile)
00062 {
00063   if (objfile == NULL || agent_loaded_p ())
00064     return;
00065 
00066   agent_look_up_symbols (objfile);
00067 }
00068 
00069 void
00070 _initialize_agent (void)
00071 {
00072   observer_attach_new_objfile (agent_new_objfile);
00073 
00074   add_setshow_enum_cmd ("agent", class_run,
00075                         can_use_agent_enum,
00076                         &can_use_agent, _("\
00077 Set debugger's willingness to use agent as a helper."), _("\
00078 Show debugger's willingness to use agent as a helper."), _("\
00079 If on, GDB will delegate some of the debugging operations to the\n\
00080 agent, if the target supports it.  This will speed up those\n\
00081 operations that are supported by the agent.\n\
00082 If off, GDB will not use agent, even if such is supported by the\n\
00083 target."),
00084                         set_can_use_agent,
00085                         show_can_use_agent,
00086                         &setlist, &showlist);
00087 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines