From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26427 invoked by alias); 24 Feb 2012 13:05:52 -0000 Received: (qmail 26418 invoked by uid 22791); 24 Feb 2012 13:05:51 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Feb 2012 13:05:33 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1S0uq4-0006EG-Hd from Yao_Qi@mentor.com ; Fri, 24 Feb 2012 05:05:32 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 24 Feb 2012 05:05:32 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Fri, 24 Feb 2012 05:05:30 -0800 Message-ID: <4F478ADD.60307@codesourcery.com> Date: Fri, 24 Feb 2012 13:13:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120130 Thunderbird/10.0 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH 3/9] command set agent on and off. References: <1329447300-18841-1-git-send-email-yao@codesourcery.com> <1329447300-18841-4-git-send-email-yao@codesourcery.com> <4F46ADB9.1010900@redhat.com> In-Reply-To: <4F46ADB9.1010900@redhat.com> Content-Type: multipart/mixed; boundary="------------000102090008010201050807" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00552.txt.bz2 --------------000102090008010201050807 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 525 On 02/24/2012 05:20 AM, Pedro Alves wrote: >> > + gdb_test_no_output "set agent on" >> > >> > set marker_bar_addr "" >> > set marker_bar2_addr "" > Hmm, is it really the right thing to do to require turning this > on for static tracepoints? We didn't need it before, and there's > not way for doing static tracepoints without the in-process agent, > so it just looks like unnecessary extra trouble for the user. I agree. These changes in test case strace.exp are removed out of the patch. -- Yao (齐尧) --------------000102090008010201050807 Content-Type: text/x-patch; name="0003-command-set-agent-on-and-off.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-command-set-agent-on-and-off.patch" Content-length: 4531 This patch adds new command `set agent on|off'. 2012-02-17 Yao Qi * 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 | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 gdb/agent.c diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 38c93c9..edd616f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -682,6 +682,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 \ @@ -738,7 +739,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 @@ -852,6 +853,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 \ @@ -906,7 +908,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 @@ -1923,6 +1925,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..c10ed89 --- /dev/null +++ b/gdb/agent.c @@ -0,0 +1,70 @@ +/* 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 . */ + +#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) == 0) + /* Something wrong during setting, set flag to default value. */ + 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 delegate some of the debugging operations to the\n\ +agent, if the target supports it. This will speed up those\n\ +operations that are supported by the agent.\n\ +If off, GDB will not use agent, even if such is supported by the\n\ +target."), + set_can_use_agent, + show_can_use_agent, + &setlist, &showlist); +} -- 1.7.0.4 --------------000102090008010201050807--