aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-03-13 09:55:12 -0700
committerDoug Evans <xdje42@gmail.com>2014-03-13 09:55:12 -0700
commit5a1e8c7a83c17df130a48fb0a736cde6f22bfca9 (patch)
tree6c2bdd8d5cc7ee9dbf331b1f98208a6f5361f28d /gdb/guile
parent350e1a768cca6deab7aeca8adcff9561faeb1f35 (diff)
downloadgdb-5a1e8c7a83c17df130a48fb0a736cde6f22bfca9.zip
gdb-5a1e8c7a83c17df130a48fb0a736cde6f22bfca9.tar.gz
gdb-5a1e8c7a83c17df130a48fb0a736cde6f22bfca9.tar.bz2
Fix pr 16612.
* guile/scm-type.c (tyscm_copy_type_recursive): Move type to its new eq?-hashtab. testsuite/ * gdb.guile/scm-value.ep (test_value_after_death): Do a garbage collect after discarding symbols.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/scm-type.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 4fa0c28..9345c28 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -363,11 +363,30 @@ tyscm_copy_type_recursive (void **slot, void *info)
type_smob *t_smob = (type_smob *) *slot;
htab_t copied_types = info;
struct objfile *objfile = TYPE_OBJFILE (t_smob->type);
+ htab_t htab;
+ eqable_gdb_smob **new_slot;
+ type_smob t_smob_for_lookup;
gdb_assert (objfile != NULL);
htab_empty (copied_types);
t_smob->type = copy_type_recursive (objfile, t_smob->type, copied_types);
+
+ /* The eq?-hashtab that the type lived in is going away.
+ Add the type to its new eq?-hashtab: Otherwise if/when the type is later
+ garbage collected we'll assert-fail if the type isn't in the hashtab.
+ PR 16612.
+
+ Types now live in "arch space", and things like "char" that came from
+ the objfile *could* be considered eq? with the arch "char" type.
+ However, they weren't before the objfile got deleted, so making them
+ eq? now is debatable. */
+ htab = tyscm_type_map (t_smob->type);
+ t_smob_for_lookup.type = t_smob->type;
+ new_slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &t_smob_for_lookup.base);
+ gdb_assert (*new_slot == NULL);
+ gdbscm_fill_eqable_gsmob_ptr_slot (new_slot, &t_smob->base);
+
return 1;
}