]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/agent.c
gdb: Don't skip prologue for explicit line breakpoints in assembler
[thirdparty/binutils-gdb.git] / gdb / agent.c
CommitLineData
42a4f53d 1/* Copyright (C) 2012-2019 Free Software Foundation, Inc.
d1feda86
YQ
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"
4de283e4 22#include "common/agent.h"
d1feda86
YQ
23
24/* Enum strings for "set|show agent". */
25
26static const char can_use_agent_on[] = "on";
27static const char can_use_agent_off[] = "off";
28static const char *can_use_agent_enum[] =
29{
30 can_use_agent_on,
31 can_use_agent_off,
32 NULL,
33};
34
35static const char *can_use_agent = can_use_agent_off;
36
37static void
38show_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
46static void
eb4c3f4a 47set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
d1feda86
YQ
48{
49 if (target_use_agent (can_use_agent == can_use_agent_on) == 0)
50 /* Something wrong during setting, set flag to default value. */
51 can_use_agent = can_use_agent_off;
52}
53
76727919 54#include "observable.h"
5808517f
YQ
55#include "objfiles.h"
56
57static void
58agent_new_objfile (struct objfile *objfile)
59{
60 if (objfile == NULL || agent_loaded_p ())
61 return;
62
63 agent_look_up_symbols (objfile);
64}
65
d1feda86
YQ
66void
67_initialize_agent (void)
68{
76727919 69 gdb::observers::new_objfile.attach (agent_new_objfile);
5808517f 70
d1feda86
YQ
71 add_setshow_enum_cmd ("agent", class_run,
72 can_use_agent_enum,
73 &can_use_agent, _("\
74Set debugger's willingness to use agent as a helper."), _("\
75Show debugger's willingness to use agent as a helper."), _("\
76If on, GDB will delegate some of the debugging operations to the\n\
77agent, if the target supports it. This will speed up those\n\
78operations that are supported by the agent.\n\
79If off, GDB will not use agent, even if such is supported by the\n\
80target."),
81 set_can_use_agent,
82 show_can_use_agent,
83 &setlist, &showlist);
84}