From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [patch 3/8] Command `set agent on|off'
Date: Mon, 23 Jan 2012 13:54:00 -0000 [thread overview]
Message-ID: <4F1D659F.40608@codesourcery.com> (raw)
In-Reply-To: <4F1D55D7.7030506@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 154 bytes --]
We want to leave users to decide whether they want to use agent or not,
so we add a new command `set agent on|off' in this patch.
--
Yao (é½å°§)
[-- Attachment #2: 0003-add-agent.c-in-gdb.patch --]
[-- Type: text/x-patch, Size: 4346 bytes --]
2012-01-23 Yao Qi <yao@codesourcery.com>
* Makefile.in (SFILES): Add agent.c and common/agent.c.
(COMMON_OBS): Add agent.o and common/agent.o.
(common-agent.o): New rule.
* agent.c: New.
---
gdb/Makefile.in | 10 ++++++-
gdb/agent.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 2 deletions(-)
create mode 100644 gdb/agent.c
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 25067f1..1d5cf22 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -686,6 +686,7 @@ TARGET_FLAGS_TO_PASS = \
SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
addrmap.c \
auxv.c ax-general.c ax-gdb.c \
+ agent.c \
bcache.c \
bfd-target.c \
block.c blockframe.c breakpoint.c buildsym.c \
@@ -742,7 +743,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
annotate.c common/signals.c copying.c dfp.c gdb.c inf-child.c \
regset.c sol-thread.c windows-termcap.c \
common/common-utils.c common/xml-utils.c \
- common/ptid.c common/buffer.c gdb-dlfcn.c
+ common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c
LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
@@ -856,6 +857,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
annotate.o \
addrmap.o \
auxv.o \
+ agent.o \
bfd-target.o \
blockframe.o breakpoint.o findvar.o regcache.o \
charset.o continuations.o corelow.o disasm.o dummy-frame.o dfp.o \
@@ -910,7 +912,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \
inferior.o osdata.o gdb_usleep.o record.o gcore.o \
jit.o progspace.o skip.o \
- common-utils.o buffer.o ptid.o gdb-dlfcn.o
+ common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o
TSOBS = inflow.o
@@ -1932,6 +1934,10 @@ linux-procfs.o: $(srcdir)/common/linux-procfs.c
$(COMPILE) $(srcdir)/common/linux-procfs.c
$(POSTCOMPILE)
+common-agent.o: $(srcdir)/common/agent.c
+ $(COMPILE) $(srcdir)/common/agent.c
+ $(POSTCOMPILE)
+
#
# gdb/tui/ dependencies
#
diff --git a/gdb/agent.c b/gdb/agent.c
new file mode 100644
index 0000000..67862c5
--- /dev/null
+++ b/gdb/agent.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "command.h"
+#include "gdbcmd.h"
+#include "target.h"
+#include "agent.h"
+
+/* Enum strings for "set|show agent". */
+
+static const char can_use_agent_on[] = "on";
+static const char can_use_agent_off[] = "off";
+static const char *can_use_agent_enum[] =
+{
+ can_use_agent_on,
+ can_use_agent_off,
+ NULL,
+};
+
+static const char *can_use_agent = can_use_agent_off;
+
+static void
+show_can_use_agent (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file,
+ _("Debugger's willingness to use agent in inferior "
+ "as a helper is %s.\n"), value);
+}
+
+static void
+set_can_use_agent (char *args, int from_tty, struct cmd_list_element *c)
+{
+ if (target_use_agent (can_use_agent == can_use_agent_on))
+ can_use_agent = can_use_agent_on;
+ else
+ can_use_agent = can_use_agent_off;
+}
+
+void
+_initialize_agent (void)
+{
+ add_setshow_enum_cmd ("agent", class_run,
+ can_use_agent_enum,
+ &can_use_agent, _("\
+Set debugger's willingness to use agent as a helper."), _("\
+Show debugger's willingness to use agent as a helper."), _("\
+If on, gdb will use agent as a helper if it is supported by the target.\n\
+If off, gdb will not use agent, even if such is supported by the target\n"),
+ set_can_use_agent,
+ show_can_use_agent,
+ &setlist, &showlist);
+}
--
1.7.0.4
next prev parent reply other threads:[~2012-01-23 13:50 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-23 13:37 [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-01-23 13:48 ` [patch 1/8] Generalize interaction with agent in gdb/gdbserver Yao Qi
2012-01-30 11:25 ` Yao Qi
2012-02-09 19:21 ` Pedro Alves
2012-02-14 2:41 ` Yao Qi
2012-02-14 10:16 ` Pedro Alves
2012-01-23 13:50 ` [patch 2/8] Add to_use_agent in target_ops Yao Qi
2012-02-09 19:36 ` Pedro Alves
2012-01-23 13:54 ` Yao Qi [this message]
2012-01-23 17:14 ` [patch 3/8] Command `set agent on|off' Eli Zaretskii
2012-01-24 0:28 ` Yao Qi
2012-01-24 5:54 ` Eli Zaretskii
2012-01-26 1:32 ` Yao Qi
2012-02-09 20:19 ` Pedro Alves
2012-01-23 13:58 ` [patch 4/8] `use_agent' for remote and QAgent Yao Qi
2012-01-23 17:17 ` Eli Zaretskii
2012-01-26 2:17 ` Yao Qi
2012-01-26 17:43 ` Eli Zaretskii
2012-02-09 19:55 ` Pedro Alves
2012-01-23 14:03 ` [patch 5/8] Doc for agent Yao Qi
2012-01-23 18:12 ` Eli Zaretskii
2012-01-24 0:51 ` Yao Qi
2012-01-24 8:04 ` Eli Zaretskii
2012-01-26 1:53 ` Yao Qi
2012-01-26 17:15 ` Eli Zaretskii
2012-02-09 19:55 ` Pedro Alves
2012-02-10 13:30 ` Yao Qi
2012-02-10 15:01 ` Pedro Alves
2012-02-10 16:18 ` Yao Qi
2012-02-10 16:28 ` Pedro Alves
2012-02-23 7:51 ` Yao Qi
2012-02-23 19:50 ` Pedro Alves
2012-01-23 14:07 ` [patch 6/8] Agent's capability Yao Qi
2012-01-24 3:49 ` Yao Qi
2012-02-09 20:09 ` Pedro Alves
2012-02-10 12:25 ` Yao Qi
2012-02-10 12:37 ` Pedro Alves
2012-02-10 13:07 ` Yao Qi
2012-01-23 14:29 ` [patch 7/8] Agent capability for static tracepoint Yao Qi
2012-02-09 20:13 ` Pedro Alves
2012-02-10 14:29 ` Yao Qi
2012-02-10 14:56 ` Pedro Alves
2012-01-23 16:03 ` [patch 8/8] Control agent in testsuite Yao Qi
2012-02-09 20:16 ` Pedro Alves
2012-02-05 4:32 ` [ping] [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-02-09 19:02 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F1D659F.40608@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox