public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-tromey-python: * python/python-type.c (pyty_type_object) <owned>: New field.
@ 2008-11-06 21:14 tromey
0 siblings, 0 replies; only message in thread
From: tromey @ 2008-11-06 21:14 UTC (permalink / raw)
To: archer-commits
The branch, archer-tromey-python has been updated
via 3c4a12486daf891d58920ad7f97ab6f78b40c11e (commit)
from 6f0db4dff8d078bd334fc4f364adf0f792687dc1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 3c4a12486daf891d58920ad7f97ab6f78b40c11e
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Nov 6 14:14:28 2008 -0700
* python/python-type.c (pyty_type_object) <owned>: New field.
(clean_up_objfile_types): Set it.
(set_type): Initialize new field. Always set prev and next
fields.
(typy_dealloc): Check new field.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 8 ++++++++
gdb/python/python-type.c | 33 +++++++++++++++++----------------
2 files changed, 25 insertions(+), 16 deletions(-)
First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 210f2af..8e34945 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2008-11-06 Tom Tromey <tromey@redhat.com>
+ * python/python-type.c (pyty_type_object) <owned>: New field.
+ (clean_up_objfile_types): Set it.
+ (set_type): Initialize new field. Always set prev and next
+ fields.
+ (typy_dealloc): Check new field.
+
+2008-11-06 Tom Tromey <tromey@redhat.com>
+
* python/python.c (source_python_script): New function.
* python/python.h (source_python_script): Declare.
* cli/cli-cmds.c (find_argument): New function.
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 62b7de6..1d27714 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -37,6 +37,10 @@ typedef struct pyty_type_object
underlying struct type when the objfile is deleted. */
struct pyty_type_object *prev;
struct pyty_type_object *next;
+
+ /* This is nonzero if the type is owned by this object and should be
+ freed when the object is deleted. */
+ int owned;
} type_object;
static PyTypeObject type_object_type;
@@ -276,6 +280,7 @@ clean_up_objfile_types (struct objfile *objfile, void *datum)
obj->next = NULL;
obj->prev = NULL;
+ obj->owned = 1;
obj = next;
}
@@ -287,24 +292,19 @@ static void
set_type (type_object *obj, struct type *type)
{
obj->type = type;
- if (type)
+ obj->owned = 0;
+ obj->prev = NULL;
+ if (type && TYPE_OBJFILE (type))
{
struct objfile *objfile = TYPE_OBJFILE (type);
- if (objfile)
- {
- obj->next = objfile_data (objfile, typy_objfile_data_key);
- if (obj->next)
- obj->next->prev = obj;
- obj->prev = NULL;
- set_objfile_data (objfile, typy_objfile_data_key, obj);
- }
- else
- {
- obj->prev = NULL;
- obj->next = NULL;
- }
+ obj->next = objfile_data (objfile, typy_objfile_data_key);
+ if (obj->next)
+ obj->next->prev = obj;
+ set_objfile_data (objfile, typy_objfile_data_key, obj);
}
+ else
+ obj->next = NULL;
}
static PyObject *
@@ -359,7 +359,7 @@ typy_dealloc (PyObject *obj)
if (type->type)
{
- if (!TYPE_OBJFILE (type->type))
+ if (type->owned)
{
/* We own the type, so delete it. */
htab_t deleted_types;
@@ -376,7 +376,8 @@ typy_dealloc (PyObject *obj)
{
/* Must reset head of list. */
struct objfile *objfile = TYPE_OBJFILE (type->type);
- set_objfile_data (objfile, typy_objfile_data_key, type->next);
+ if (objfile)
+ set_objfile_data (objfile, typy_objfile_data_key, type->next);
}
if (type->next)
type->next->prev = type->prev;
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-06 21:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-06 21:14 [SCM] archer-tromey-python: * python/python-type.c (pyty_type_object) <owned>: New field tromey
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).