Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 8/9] impl of use_agent and can_use_agent in linux-nat.
Date: Fri, 24 Feb 2012 13:31:00 -0000	[thread overview]
Message-ID: <4F478E15.1080703@codesourcery.com> (raw)
In-Reply-To: <4F46B981.5070108@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

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 (齐尧)

[-- Attachment #2: 0008-impl-of-use_agent-and-can_use_agent-in-inf-child.patch --]
[-- Type: text/x-patch, Size: 2074 bytes --]


2012-02-23  Yao Qi  <yao@codesourcery.com>

	* 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 <sys/param.h>		/* 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


  parent reply	other threads:[~2012-02-24 13:19 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17  2:56 [patch v2] GDB/GDBserver talks with agents Yao Qi
2012-02-17  2:56 ` [PATCH 3/9] command set agent on and off Yao Qi
2012-02-23 21:51   ` Pedro Alves
2012-02-24 13:13     ` Yao Qi
2012-02-24 14:15       ` Pedro Alves
2012-02-17  2:56 ` [PATCH 1/9] move agent related code from gdbserver to common/agent.c Yao Qi
2012-02-17  9:55   ` Mark Kettenis
2012-02-23 21:05   ` Pedro Alves
2012-02-23 21:17     ` Pedro Alves
2012-02-24  7:57     ` Yao Qi
2012-02-24 13:40       ` Yao Qi
2012-02-17  2:57 ` [PATCH 5/9] agent capability Yao Qi
2012-02-17  2:57 ` [PATCH 4/9] agent doc Yao Qi
2012-02-17 11:38   ` Eli Zaretskii
2012-02-17 13:34     ` Yao Qi
2012-02-17 16:10       ` Pedro Alves
2012-02-18 17:11       ` Eli Zaretskii
2012-02-20  3:56         ` Yao Qi
2012-02-20  6:22           ` Eli Zaretskii
2012-02-21 18:18           ` Pedro Alves
2012-02-22  1:56             ` Yao Qi
2012-02-22 20:41               ` Pedro Alves
2012-02-22 23:43                 ` Eli Zaretskii
2012-02-27 13:23                 ` Yao Qi
2012-02-17  2:57 ` [PATCH 7/9] move in_process_agent_loaded to agent_loaded_p Yao Qi
2012-02-23 22:11   ` Pedro Alves
2012-02-23 22:27     ` Pedro Alves
2012-02-17  2:57 ` [PATCH 2/9] add target_ops fields use_agent and can_use_agent Yao Qi
2012-02-17 11:40   ` Eli Zaretskii
2012-02-23 21:21   ` Pedro Alves
2012-02-24 13:01     ` Yao Qi
2012-02-24 13:05       ` Pedro Alves
2012-02-17  2:57 ` [PATCH 8/9] impl of use_agent and can_use_agent in linux-nat Yao Qi
2012-02-23 22:15   ` Pedro Alves
2012-02-24  8:34     ` Yao Qi
2012-02-24 10:47       ` Pedro Alves
2012-02-24 13:31     ` Yao Qi [this message]
2012-02-24 14:10       ` Pedro Alves
2012-02-24 14:34         ` Yao Qi
2012-02-17  2:57 ` [PATCH 6/9] agent capability of static tracepoint Yao Qi
2012-02-23 22:06   ` Pedro Alves
2012-02-24 13:19     ` Yao Qi
2012-02-24 14:25       ` Pedro Alves
2012-02-17  3:02 ` [PATCH 9/9] info static tracepoint in linux-nat Yao Qi
2012-02-24 13:37   ` Yao Qi
2012-02-17  4:02 ` [patch v2] GDB/GDBserver talks with agents Yao Qi
2012-02-17 12:03 ` Eli Zaretskii
2012-02-27  9:43   ` Yao Qi
2012-02-27 18:04     ` Eli Zaretskii

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=4F478E15.1080703@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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