diff options
author | Tom Tromey <tromey@redhat.com> | 2012-10-15 15:23:44 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-10-15 15:23:44 +0000 |
commit | f45e35bd6b08b2fe82fbfad76b316dba5ac22fdb (patch) | |
tree | 54a38c9f7dcbd6cb48b9b671c882fb8ff6b8bdd2 | |
parent | f4b02b440ffba0b7867d4fef1f2e13d44d1344ff (diff) | |
download | gdb-f45e35bd6b08b2fe82fbfad76b316dba5ac22fdb.tar.gz |
PR python/14635:
* python/py-symtab.c (del_objfile_sal): Set 'symtab' field
to Py_None.
testsuite
* gdb.python/py-symtab.exp: Test sal and symtab destructors.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/python/py-symtab.c | 5 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symtab.exp | 3 |
4 files changed, 17 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 53087700b11..5f5eaf97ba5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2012-10-15 Tom Tromey <tromey@redhat.com> + PR python/14635: + * python/py-symtab.c (del_objfile_sal): Set 'symtab' field + to Py_None. + +2012-10-15 Tom Tromey <tromey@redhat.com> + PR python/14634: * python/py-symbol.c (sympy_dealloc): Check for NULL symbol. diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index b6f45e6d8d8..21a172cadd8 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -470,7 +470,10 @@ del_objfile_sal (struct objfile *objfile, void *datum) { sal_object *next = obj->next; - obj->symtab = NULL; + Py_DECREF (obj->symtab); + obj->symtab = (symtab_object *) Py_None; + Py_INCREF (Py_None); + obj->next = NULL; obj->prev = NULL; xfree (obj->sal); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 71c2d85e3a1..38a36932763 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2012-10-15 Tom Tromey <tromey@redhat.com> + * gdb.python/py-symtab.exp: Test sal and symtab destructors. + +2012-10-15 Tom Tromey <tromey@redhat.com> + * gdb.python/py-symbol.exp: Test symbol destructor. 2012-10-14 Yao Qi <yao@codesourcery.com> diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp index da0c3e4be29..0d3a5f2d83a 100644 --- a/gdb/testsuite/gdb.python/py-symtab.exp +++ b/gdb/testsuite/gdb.python/py-symtab.exp @@ -73,3 +73,6 @@ gdb_test "python print \"simple_struct\" in static_symbols" "True" "Test simple_ gdb_unload gdb_test "python print sal.is_valid()" "False" "Test sal.is_valid" gdb_test "python print symtab.is_valid()" "False" "Test symtab.is_valid()" + +gdb_test_no_output "python sal = None" "Test sal destructor" +gdb_test_no_output "python symtab = None" "Test symtab destructor" |