From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12192 invoked by alias); 24 Feb 2012 13:19:31 -0000 Received: (qmail 12181 invoked by uid 22791); 24 Feb 2012 13:19:30 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,TW_BJ 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:19:17 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1S0v3M-0007fV-8Z from Yao_Qi@mentor.com ; Fri, 24 Feb 2012 05:19:16 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 24 Feb 2012 05:19:11 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Fri, 24 Feb 2012 05:19:14 -0800 Message-ID: <4F478E15.1080703@codesourcery.com> Date: Fri, 24 Feb 2012 13:31: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 8/9] impl of use_agent and can_use_agent in linux-nat. References: <1329447300-18841-1-git-send-email-yao@codesourcery.com> <1329447300-18841-9-git-send-email-yao@codesourcery.com> <4F46B981.5070108@redhat.com> In-Reply-To: <4F46B981.5070108@redhat.com> Content-Type: multipart/mixed; boundary="------------060208040901050206090009" 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/msg00554.txt.bz2 --------------060208040901050206090009 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 858 On 02/24/2012 06:11 AM, Pedro Alves wrote: >> > + >> > + t->to_use_agent = linux_child_use_agent; >> > + t->to_can_use_agent = linux_child_can_use_agent; >> > } > Are these ever going to be different on other native targets? We could > put them in inf-child.c instead, to get them all covered at once. > No, they are the same on other native targets. New target_ops hooks functions are moved to inf-child.c. >> > @@ -925,7 +926,10 @@ solib_add (char *pattern, int from_tty, >> > } >> > >> > if (loaded_any_symbols) >> > - breakpoint_re_set (); >> > + { >> > + breakpoint_re_set (); >> > + agent_look_up_symbols (); > The right place to do this is in a new new_objfile observer. > Done. Note that, in new_objfile observer, I pass OBJFILE to agent_look_up_symbols as one parameter, so patch 1/9 will be updated. -- Yao (齐尧) --------------060208040901050206090009 Content-Type: text/x-patch; name="0008-impl-of-use_agent-and-can_use_agent-in-inf-child.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0008-impl-of-use_agent-and-can_use_agent-in-inf-child.patch" Content-length: 2074 2012-02-23 Yao Qi * inf-child.c (inf_child_use_agent): New. (inf_child_can_use_agent): New. (inf_child_target): Initialize fields `to_use_agent' and `to_can_use_agent'. * agent.c (agent_new_objfile): New. (_initialize_agent): Add agent_new_objfile to new_objfile observer. --- gdb/agent.c | 14 ++++++++++++++ gdb/inf-child.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/gdb/agent.c b/gdb/agent.c index c10ed89..bd537ea 100644 --- a/gdb/agent.c +++ b/gdb/agent.c @@ -51,9 +51,23 @@ set_can_use_agent (char *args, int from_tty, struct cmd_list_element *c) can_use_agent = can_use_agent_off; } +#include "observer.h" +#include "objfiles.h" + +static void +agent_new_objfile (struct objfile *objfile) +{ + if (objfile == NULL || agent_loaded_p ()) + return; + + agent_look_up_symbols (objfile); +} + void _initialize_agent (void) { + observer_attach_new_objfile (agent_new_objfile); + add_setshow_enum_cmd ("agent", class_run, can_use_agent_enum, &can_use_agent, _("\ diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 96c1157..5531102 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -29,6 +29,7 @@ #include "gdb_stat.h" #include "inf-child.h" #include "gdb/fileio.h" +#include "agent.h" #ifdef HAVE_SYS_PARAM_H #include /* for MAXPATHLEN */ @@ -332,6 +333,23 @@ inf_child_fileio_readlink (const char *filename, int *target_errno) #endif } +static int +inf_child_use_agent (int use) +{ + if (agent_loaded_p ()) + { + use_agent = use; + return 1; + } + else + return 0; +} + +static int +inf_child_can_use_agent (void) +{ + return agent_loaded_p (); +} struct target_ops * inf_child_target (void) @@ -371,5 +389,7 @@ inf_child_target (void) t->to_fileio_unlink = inf_child_fileio_unlink; t->to_fileio_readlink = inf_child_fileio_readlink; t->to_magic = OPS_MAGIC; + t->to_use_agent = inf_child_use_agent; + t->to_can_use_agent = inf_child_can_use_agent; return t; } -- 1.7.0.4 --------------060208040901050206090009--