From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27346 invoked by alias); 23 Feb 2012 22:11:31 -0000 Received: (qmail 27337 invoked by uid 22791); 23 Feb 2012 22:11:30 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Feb 2012 22:11:17 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1NMBEMu002605 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Feb 2012 17:11:14 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1NMBDKx015631; Thu, 23 Feb 2012 17:11:13 -0500 Message-ID: <4F46B981.5070108@redhat.com> Date: Thu, 23 Feb 2012 22:15:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org 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> In-Reply-To: <1329447300-18841-9-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00523.txt.bz2 On 02/17/2012 02:54 AM, Yao Qi wrote: > This patch is to implement two target_ops hooks on linux-nat, and look up symbols > when a solib is added. > > 2012-01-13 Yao Qi > > * linux-nat.c (linux_child_use_agent): New. > (linux_child_can_use_agent): New. > (linux_target_install_ops): Initialize fields `to_use_agent' > and `to_can_use_agent'. > * solib.c (solib_add): Call agent_look_up_symbol. > --- > gdb/linux-nat.c | 22 ++++++++++++++++++++++ > gdb/solib.c | 6 +++++- > 2 files changed, 27 insertions(+), 1 deletions(-) > > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 6aab087..3e81fd0 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -59,6 +59,7 @@ > #include "solib.h" > #include "linux-osdata.h" > #include "linux-tdep.h" > +#include "agent.h" > > #ifndef SPUFS_MAGIC > #define SPUFS_MAGIC 0x23c9b64e > @@ -4800,6 +4801,24 @@ linux_xfer_partial (struct target_ops *ops, enum target_object object, > offset, len); > } > > +static int > +linux_child_use_agent (int use) > +{ > + if (agent_loaded_p ()) > + { > + use_agent = use; > + return 1; > + } > + else > + return 0; > +} > + > +static int > +linux_child_can_use_agent (void) > +{ > + return agent_loaded_p (); > +} > + > /* Create a prototype generic GNU/Linux target. The client can override > it with local methods. */ > > @@ -4821,6 +4840,9 @@ linux_target_install_ops (struct target_ops *t) > > super_xfer_partial = t->to_xfer_partial; > t->to_xfer_partial = linux_xfer_partial; > + > + 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. > > struct target_ops * > diff --git a/gdb/solib.c b/gdb/solib.c > index 84b9019..4f04f39 100644 > --- a/gdb/solib.c > +++ b/gdb/solib.c > @@ -46,6 +46,7 @@ > #include "solib.h" > #include "interps.h" > #include "filesystem.h" > +#include "agent.h" > > /* Architecture-specific operations. */ > > @@ -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. > + } > > if (from_tty && pattern && ! any_matches) > printf_unfiltered > -- 1.7.0.4 -- Pedro Alves