public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: jkratoch@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-jankratochvil-vla: Merge commit 'origin/archer-jankratochvil-type-refcount' into archer-jankratochvil-vla
Date: Fri, 13 Mar 2009 14:28:00 -0000	[thread overview]
Message-ID: <20090313142824.4131.qmail@sourceware.org> (raw)

The branch, archer-jankratochvil-vla has been updated
       via  b0e1ceb829f093a468c347a2251a48a6a7f12dae (commit)
       via  352a9c0849c0a71fa3b8e5365463de077150bef0 (commit)
       via  79ec68e9e31e73cb97eb9832fbf41baea3acdacc (commit)
       via  d87cd027f197ddd4ee727c099222a1dd19d039ea (commit)
       via  4d4a27cd210fbfa28bab83e3c88e7d56e4ac4f9a (commit)
      from  5c671cd0dd3905d98f3717d832923400b6434bef (commit)

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

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 gdb/value.c  |    5 ++++-
 gdb/value.h  |    3 +++
 gdb/varobj.c |   39 +++++++++++++++++++++++++++++++++++++++
 gdb/varobj.h |    2 ++
 4 files changed, 48 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/value.c b/gdb/value.c
index 47739c9..3f3945e 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -37,6 +37,7 @@
 #include "dfp.h"
 #include "objfiles.h"
 #include "valprint.h"
+#include "varobj.h"
 
 #include "python/python.h"
 
@@ -1089,7 +1090,7 @@ internalvar_name (struct internalvar *var)
 /* Update VALUE before discarding OBJFILE.  COPIED_TYPES is used to
    prevent cycles / duplicates.  */
 
-static void
+void
 preserve_one_value (struct value *value, struct objfile *objfile,
 		    htab_t copied_types)
 {
@@ -1142,6 +1143,8 @@ preserve_values (struct objfile *objfile)
   for (val = values_in_python; val; val = val->next)
     preserve_one_value (val, objfile, copied_types);
 
+  preserve_variables (objfile, copied_types);
+
   htab_delete (copied_types);
 }
 
diff --git a/gdb/value.h b/gdb/value.h
index ad5306a..e25b339 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -640,6 +640,9 @@ extern void typedef_print (struct type *type, struct symbol *news,
 
 extern char *internalvar_name (struct internalvar *var);
 
+extern void preserve_one_value (struct value *value, struct objfile *objfile,
+				htab_t copied_types);
+
 extern void preserve_values (struct objfile *);
 
 /* From values.c */
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 0147ecb..27bcf24 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -541,6 +541,7 @@ varobj_create (char *objname,
 	}
       else 
 	var->type = value_type (value);
+      type_incref (var->type);
 
       install_new_value (var, value, 1 /* Initial assignment */);
 
@@ -1425,6 +1426,38 @@ uninstall_variable (struct varobj *var)
 
 }
 
+/* Update GDB variable objects when OBJFILE is discarded; we must copy the
+   types out of the objfile.  Usually varobj_invalidate (by clear_symtab_users)
+   gets called which does not require this functionality.  But according to the
+   free_objfile comment this is not always the case.  */
+
+void
+preserve_variables (struct objfile *objfile, htab_t copied_types)
+{
+  unsigned int index;
+
+  for (index = 0; index < VAROBJ_TABLE_SIZE; index++)
+    {
+      struct vlist *vlist;
+
+      for (vlist = varobj_table[index]; vlist; vlist = vlist->next)
+	{
+	  struct varobj *var = vlist->var;
+
+	  if (var->value)
+	    preserve_one_value (var->value, objfile, copied_types);
+
+	  if (var->type && TYPE_OBJFILE (var->type) == objfile)
+	    {
+	      /* No need to decref the old type here, since we know it has no
+		 reference count.  */
+	      var->type = copy_type_recursive (var->type, copied_types);
+	      type_incref (var->type);
+	    }
+	}
+    }
+}
+
 /* Create and install a child of the parent of the given name */
 static struct varobj *
 create_child (struct varobj *parent, int index, char *name)
@@ -1455,6 +1488,8 @@ create_child (struct varobj *parent, int index, char *name)
     /* Otherwise, we must compute the type. */
     child->type = (*child->root->lang->type_of_child) (child->parent, 
 						       child->index);
+  if (child->type)
+    type_incref (child->type);
   install_new_value (child, value, 1);
 
   return child;
@@ -1513,6 +1548,8 @@ static void
 free_variable (struct varobj *var)
 {
   value_free (var->value);
+  if (var->type)
+    type_decref (var->type);
 
   /* Free the expression if this is a root variable. */
   if (is_root_p (var))
@@ -2784,6 +2821,8 @@ varobj_invalidate (void)
           else
               (*varp)->root->is_valid = 0;
         }
+	/* FIXME: If VALID_BLOCK does not belong to OBJFILE being removed we
+	   should keep this varobj valid.  */
         else /* locals must be invalidated.  */
           (*varp)->root->is_valid = 0;
 
diff --git a/gdb/varobj.h b/gdb/varobj.h
index f2cdcf8..14b978b 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -141,4 +141,6 @@ extern int varobj_editable_p (struct varobj *var);
 
 extern int varobj_floating_p (struct varobj *var);
 
+extern void preserve_variables (struct objfile *objfile, htab_t copied_types);
+
 #endif /* VAROBJ_H */


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


             reply	other threads:[~2009-03-13 14:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 14:28 jkratoch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-06-13  9:57 jkratoch
2009-05-24 17:07 jkratoch
2009-05-23 21:49 jkratoch
2009-04-19 17:07 jkratoch
2009-04-13 12:45 jkratoch
2009-03-27 13:42 jkratoch
2009-03-20 17:08 jkratoch
2009-03-12 20:10 jkratoch
2009-02-28 19:22 jkratoch
2009-02-23 23:00 jkratoch
2009-02-21  0:35 jkratoch
2009-02-09 14:37 jkratoch
2009-01-27 21:43 jkratoch
2009-01-10 23:36 jkratoch
2009-01-07 23:30 jkratoch
2009-01-06 17:48 jkratoch
2008-12-28 16:15 jkratoch

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=20090313142824.4131.qmail@sourceware.org \
    --to=jkratoch@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).