diff options
author | Tom Tromey <tromey@redhat.com> | 2009-05-28 00:47:20 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-05-28 00:47:20 +0000 |
commit | 2c74e8338149ee8a2c5effa422866d04aef73063 (patch) | |
tree | 7de8b596fa8e4fbc781e298e938c1f319835e5d8 /gdb/testsuite/gdb.python/python-value.exp | |
parent | 89c73adef9f9fac7e1efeb6961a867f46e54e24b (diff) | |
download | gdb-2c74e8338149ee8a2c5effa422866d04aef73063.zip gdb-2c74e8338149ee8a2c5effa422866d04aef73063.tar.gz gdb-2c74e8338149ee8a2c5effa422866d04aef73063.tar.bz2 |
gdb
2009-05-27 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Phil Muldoon <pmuldoon@redhat.com>
Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python.c (_initialize_python): Call
gdbpy_initialize_types.
(GdbMethods): Add "lookup_type".
* python/python-value.c (value_object) <type>: New field.
(valpy_dealloc): Decref type.
(valpy_new): Initialize type.
(valpy_get_type): New function.
(value_to_value_object): Initialize type.
(valpy_cast): New function.
(value_object_getset): Add "type".
(value_object_methods): Add "cast".
* python/python-internal.h (type_to_type_object): Declare.
(type_object_to_type): Likewise.
(gdbpy_initialize_types): Likewise.
(gdbpy_lookup_type): Declare.
* Makefile.in (SUBDIR_PYTHON_OBS): Add python-type.o.
(SUBDIR_PYTHON_SRCS): Add python-type.c.
(python-type.o): New target.
* python/python-type.c: New file.
gdb/doc
2009-05-27 Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Types In Python): New node.
(Values From Inferior): "type" is now an attribute.
(Python API): Update.
gdb/testsuite
2009-05-27 Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com>
Pedro Alves <pedro@codesourcery.com>
Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/python-template.exp: New file.
* gdb.python/python-template.cc: New file.
* gdb.python/python.exp (gdb_py_test_multiple): Add two objfile
tests.
* gdb.python/python-value.exp (py_objfile_tests): New proc.
Call it.
(test_value_after_death): New proc.
* gdb.python/python-value.c (PTR): New typedef.
(main): New variable 'x'.
Diffstat (limited to 'gdb/testsuite/gdb.python/python-value.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/python-value.exp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp index 93e9d89..20333f6 100644 --- a/gdb/testsuite/gdb.python/python-value.exp +++ b/gdb/testsuite/gdb.python/python-value.exp @@ -246,6 +246,33 @@ proc test_objfiles {} { "pretty_printers attribute must be a list.*Error while executing Python code." } +proc test_value_after_death {} { + # Construct a type while the inferior is still running. + gdb_py_test_silent_cmd "python ptrtype = gdb.lookup_type('PTR')" \ + "create PTR type" 1 + + # Kill the inferior and remove the symbols. + gdb_test "kill" "" "kill the inferior" \ + "Kill the program being debugged. .y or n. $" \ + "y" + gdb_test "file" "" "Discard the symbols" \ + "Discard symbol table from.*y or n. $" \ + "y" + + # Now create a value using that type. Relies on arg0, created by + # test_value_in_inferior. + gdb_py_test_silent_cmd "python castval = arg0.cast(ptrtype.pointer())" \ + "cast arg0 to PTR" 1 + + # Make sure the type is deleted. + gdb_py_test_silent_cmd "python ptrtype = None" \ + "delete PTR type" 1 + + # Now see if the value's type is still valid. + gdb_test "python print castval.type" "PTR ." \ + "print value's type" +} + # Start with a fresh gdb. gdb_exit @@ -275,3 +302,4 @@ if ![runto_main] then { } test_value_in_inferior +test_value_after_death |