This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 8/9] impl of use_agent and can_use_agent in linux-nat.


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  <yao@codesourcery.com>

	* 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;
 }
 
 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 ();
+      }
 
     if (from_tty && pattern && ! any_matches)
       printf_unfiltered
-- 
1.7.0.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]