From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4347 invoked by alias); 13 Mar 2009 14:28:28 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 4146 invoked by uid 9674); 13 Mar 2009 14:28:25 -0000 Date: Fri, 13 Mar 2009 14:28:00 -0000 Message-ID: <20090313142824.4131.qmail@sourceware.org> 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 X-Git-Refname: refs/heads/archer-jankratochvil-vla X-Git-Reftype: branch X-Git-Oldrev: 5c671cd0dd3905d98f3717d832923400b6434bef X-Git-Newrev: b0e1ceb829f093a468c347a2251a48a6a7f12dae X-SW-Source: 2009-q1/txt/msg00320.txt.bz2 List-Id: 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.