public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  gbenson/rtld-probes: Merge gbenson/rtld-probes-experiments
@ 2013-06-06  9:13 gary
  0 siblings, 0 replies; only message in thread
From: gary @ 2013-06-06  9:13 UTC (permalink / raw)
  To: archer-commits

The branch, gbenson/rtld-probes has been updated
       via  75a0afd098fac4e11dcd8f1160f3b4071dd37d77 (commit)
       via  7800d1f9fafd66ebb80fe43bbb7feda46bf37252 (commit)
       via  ceb976a4be06ac87e8f5bb05d33ddeb8f4bca445 (commit)
       via  0cbf6ae5e1f1cb6f8e4932a9d80fe45905d0161f (commit)
      from  4c8993236c61d720aad9a14f25cd9d67174cf773 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 75a0afd098fac4e11dcd8f1160f3b4071dd37d77
Merge: 4c89932 7800d1f
Author: Gary Benson <gbenson@redhat.com>
Date:   Thu Jun 6 10:12:00 2013 +0100

    Merge gbenson/rtld-probes-experiments

commit 7800d1f9fafd66ebb80fe43bbb7feda46bf37252
Merge: ceb976a bf30bd8
Author: Gary Benson <gbenson@redhat.com>
Date:   Fri May 17 11:37:19 2013 +0100

    Merge

commit ceb976a4be06ac87e8f5bb05d33ddeb8f4bca445
Author: Gary Benson <gbenson@redhat.com>
Date:   Fri May 17 10:54:16 2013 +0100

    Copy-acquire-release-unhook magic

commit 0cbf6ae5e1f1cb6f8e4932a9d80fe45905d0161f
Author: Gary Benson <gbenson@redhat.com>
Date:   Fri May 17 09:18:04 2013 +0100

    Make targets responsible for freeing the actual struct so_list too

-----------------------------------------------------------------------

Summary of changes:
 README.archer         |    7 ++-
 gdb/solib-aix.c       |    1 +
 gdb/solib-darwin.c    |    1 +
 gdb/solib-dsbt.c      |    1 +
 gdb/solib-frv.c       |    1 +
 gdb/solib-ia64-hpux.c |    2 +-
 gdb/solib-irix.c      |    1 +
 gdb/solib-osf.c       |    1 +
 gdb/solib-pa64.c      |    1 +
 gdb/solib-som.c       |    1 +
 gdb/solib-sunos.c     |    1 +
 gdb/solib-svr4.c      |   98 ++++++++++++++++++++++++++++++++++---------------
 gdb/solib-target.c    |    1 +
 gdb/solib.c           |    2 -
 14 files changed, 84 insertions(+), 35 deletions(-)

First 500 lines of diff:
diff --git a/README.archer b/README.archer
index d619d25..d7782db 100644
--- a/README.archer
+++ b/README.archer
@@ -1,9 +1,12 @@
-This branch implements a new runtime linker interface using
-SystemTap probes.
+This branch is for experimenting with the probes-based
+runtime linker interface.
 
 The glibc side of the interface was committed in this patch:
 http://sourceware.org/ml/libc-alpha/2012-07/txt00005.txt
 
+The GDB side of the interface was committed in these patches:
+http://sourceware.org/ml/gdb-patches/2013-06/msg00046.html
+
 For a description of the interface, please look in the file
 elf/rtld-debugger-interface.txt in the above patch.
 
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index efc0dc5..e76bbe3 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -446,6 +446,7 @@ solib_aix_free_so (struct so_list *so)
     fprintf_unfiltered (gdb_stdlog, "DEBUG: solib_aix_free_so (%s)\n",
 			so->so_name);
   solib_aix_xfree_lm_info (so->lm_info);
+  xfree (so);
 }
 
 /* Implement the "clear_solib" target_so_ops method.  */
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index c4c6308..177ce56 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -563,6 +563,7 @@ darwin_clear_solib (void)
 static void
 darwin_free_so (struct so_list *so)
 {
+  xfree (so);
 }
 
 /* The section table is built from bfd sections using bfd VMAs.
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 01dc4b7..1952261 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -1030,6 +1030,7 @@ dsbt_free_so (struct so_list *so)
 {
   xfree (so->lm_info->map);
   xfree (so->lm_info);
+  xfree (so);
 }
 
 static void
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 28fb4a4..b737721 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -889,6 +889,7 @@ frv_free_so (struct so_list *so)
   xfree (so->lm_info->dyn_syms);
   xfree (so->lm_info->dyn_relocs);
   xfree (so->lm_info);
+  xfree (so);
 }
 
 static void
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index 0a92904..478be84 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -371,6 +371,7 @@ static void
 ia64_hpux_free_so (struct so_list *so)
 {
   xfree (so->lm_info);
+  xfree (so);
 }
 
 /* The "clear_solib" target_so_ops routine for ia64-hpux.  */
@@ -386,7 +387,6 @@ ia64_hpux_clear_solib (void)
       so_list_head = so_list_head->next;
 
       ia64_hpux_free_so (so);
-      xfree (so);
     }
 }
 
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
index 0dbbb1b..eefba3c 100644
--- a/gdb/solib-irix.c
+++ b/gdb/solib-irix.c
@@ -617,6 +617,7 @@ static void
 irix_free_so (struct so_list *so)
 {
   xfree (so->lm_info);
+  xfree (so);
 }
 
 /* Clear backend specific state.  */
diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
index d05c5c1..76ac8c6 100644
--- a/gdb/solib-osf.c
+++ b/gdb/solib-osf.c
@@ -270,6 +270,7 @@ osf_free_so (struct so_list *so)
 	xfree ((void *) name);
     }
   xfree (so->lm_info);
+  //XXX xfree (so);
 }
 
 /* target_so_ops callback.  Discard information accumulated by this file and
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index f646cfb..827a79e 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -106,6 +106,7 @@ static void
 pa64_free_so (struct so_list *so)
 {
   xfree (so->lm_info);
+  xfree (so);
 }
 
 static void
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index f88b539..255af6a 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -738,6 +738,7 @@ static void
 som_free_so (struct so_list *so)
 {
   xfree (so->lm_info);
+  //XXX xfree (so);
 }
 
 static CORE_ADDR
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 5863fc2..1ee5c03 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -714,6 +714,7 @@ sunos_free_so (struct so_list *so)
 {
   xfree (so->lm_info->lm);
   xfree (so->lm_info);
+  //XXX xfree (so);
 }
 
 static void
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 2c8d893..6f78040 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -72,6 +72,12 @@ struct lm_info
 
     /* Values read in from inferior's fields of the same name.  */
     CORE_ADDR l_ld, l_next, l_prev, l_name;
+
+    /* XXX.  */
+    struct so_list *copy;
+
+    /* XXX.  */
+    unsigned int acquired : 1;
   };
 
 /* On SVR4 systems, a list of symbols in the dynamic linker where
@@ -1055,7 +1061,29 @@ struct svr4_library_list
 static void
 svr4_free_so (struct so_list *so)
 {
+  if (so->lm_info)
+    {
+      /* If this library is an acquired copy then release it. */
+      if (so->lm_info->acquired)
+	{
+	  so->lm_info->acquired = 0;
+	  return;
+	}
+
+      /* If the library has an acquired copy then unhook it.  */
+      if (so->lm_info->copy && so->lm_info->copy->lm_info->acquired)
+	{
+	  so->lm_info->copy->lm_info->acquired = 0;
+	  so->lm_info->copy = NULL;
+	}
+
+      /* If the library has an unacquired copy then free it.  */
+      if (so->lm_info->copy)
+	svr4_free_so (so->lm_info->copy);
+    }
+
   xfree (so->lm_info);
+  xfree (so);
 }
 
 /* Implement target_so_ops.clear_so.  */
@@ -1083,34 +1111,6 @@ svr4_free_library_list (void *p_list)
     }
 }
 
-/* Copy library list.  */
-
-static struct so_list *
-svr4_copy_library_list (struct so_list *src)
-{
-  struct so_list *dst = NULL;
-  struct so_list **link = &dst;
-
-  while (src != NULL)
-    {
-      struct so_list *new;
-
-      new = xmalloc (sizeof (struct so_list));
-      memcpy (new, src, sizeof (struct so_list));
-
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info));
-
-      new->next = NULL;
-      *link = new;
-      link = &new->next;
-
-      src = src->next;
-    }
-
-  return dst;
-}
-
 #ifdef HAVE_LIBEXPAT
 
 #include "xml-support.h"
@@ -1468,9 +1468,47 @@ svr4_current_sos (void)
   struct svr4_info *info = get_svr4_info ();
 
   /* If the solib list has been read and stored by the probes
-     interface then we return a copy of the stored list.  */
+     interface then XXX.  */
   if (info->solib_list != NULL)
-    return svr4_copy_library_list (info->solib_list);
+    {
+      struct so_list *so, *result, **link = &result;
+
+      for (so = info->solib_list; so; so = so->next)
+	{
+	  gdb_assert (so->lm_info != NULL);
+
+	  /* If the library has an acquired copy then unhook it.  */
+	  if (so->lm_info->copy && so->lm_info->copy->lm_info->acquired)
+	    {
+	      so->lm_info->copy->lm_info->acquired = 0;
+	      so->lm_info->copy = NULL;
+	    }
+
+	  /* If this library does not have a copy then create one.  */
+	  if (so->lm_info->copy == NULL)
+	    {
+	      struct so_list *copy;
+
+	      copy = XZALLOC (struct so_list);
+	      memcpy (copy, so, sizeof (struct so_list));
+
+	      copy->lm_info = xmalloc (sizeof (struct lm_info));
+	      memcpy (copy->lm_info, so->lm_info, sizeof (struct lm_info));
+
+	      so->lm_info->copy = copy;
+	    }
+
+	  /* Mark the copy as acquired and link it into the result.  */
+	  gdb_assert (!so->lm_info->copy->lm_info->acquired);
+	  so->lm_info->copy->lm_info->acquired = 1;
+
+	  so->lm_info->copy->next = NULL;
+	  *link = so->lm_info->copy;
+	  link = &so->lm_info->copy->next;
+	}
+
+      return result;
+    }
 
   /* Otherwise obtain the solib list directly from the inferior.  */
   return svr4_current_sos_direct (info);
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 483e5f9..6f5ecf2 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -327,6 +327,7 @@ solib_target_free_so (struct so_list *so)
   xfree (so->lm_info->offsets);
   VEC_free (CORE_ADDR, so->lm_info->segment_bases);
   xfree (so->lm_info);
+  xfree (so);
 }
 
 static void
diff --git a/gdb/solib.c b/gdb/solib.c
index c987fe5..f63d968 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -556,8 +556,6 @@ free_so (struct so_list *so)
 
   clear_so (so);
   ops->free_so (so);
-
-  xfree (so);
 }
 
 


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-06  9:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-06  9:13 [SCM] gbenson/rtld-probes: Merge gbenson/rtld-probes-experiments gary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).