PR python/14635:
authorTom Tromey <tromey@redhat.com>
Mon, 15 Oct 2012 15:23:47 +0000 (15:23 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 15 Oct 2012 15:23:47 +0000 (15:23 +0000)
* python/py-symtab.c (del_objfile_sal): Set 'symtab' field
to Py_None.
testsuite
* gdb.python/py-symtab.exp: Test sal and symtab destructors.

gdb/ChangeLog
gdb/python/py-symtab.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-symtab.exp

index 53087700b116d87fb85c71b5ae9c49154856b7e8..5f5eaf97ba57e150c17a60dc88803a705b2c21b8 100644 (file)
@@ -1,3 +1,9 @@
+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:
index b6f45e6d8d8f43c83f3d8fb83897cc148f956dac..21a172cadd8e63453c854950f918e599d76b9149 100644 (file)
@@ -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);
index 71c2d85e3a12cc7af5497c6399c169081a78435c..38a36932763ac9531ac88e678002d1c251215fab 100644 (file)
@@ -1,3 +1,7 @@
+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.
index da0c3e4be2947f6d6aa510e46d5b9072a86650bc..0d3a5f2d83ab4b6ff0f8e3992b97f021fd423b1c 100644 (file)
@@ -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"
This page took 0.044895 seconds and 4 git commands to generate.