diff options
author | Tom Tromey <tromey@redhat.com> | 2009-05-28 00:40:24 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-05-28 00:40:24 +0000 |
commit | 89c73adef9f9fac7e1efeb6961a867f46e54e24b (patch) | |
tree | a1023e41bebc2f1ce3cf04909ee2cce0a3a6f706 /gdb/testsuite/gdb.python | |
parent | 58683880f52b1ae4b0233ea1565e7ee39a36b9b0 (diff) | |
download | gdb-89c73adef9f9fac7e1efeb6961a867f46e54e24b.zip gdb-89c73adef9f9fac7e1efeb6961a867f46e54e24b.tar.gz gdb-89c73adef9f9fac7e1efeb6961a867f46e54e24b.tar.bz2 |
gdb
2009-04-01 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Phil Muldoon <pmuldoon@redhat.com>
* python/python.c: Include objfiles.h, observer.h.
(gdbpy_auto_load): New global.
(gdbpy_current_objfile): Likewise.
(GDBPY_AUTO_FILENAME): New define.
(gdbpy_new_objfile): New function.
(gdbpy_get_current_objfile): Likewise.
(gdbpy_objfiles): Likewise.
(_initialize_python): Add "maint set auto-load". Call
gdbpy_initialize_objfile. Attach objfile observer.
(GdbMethods): New methods current_objfile, objfiles.
* python/python-objfile.c: New file.
* python/python-internal.h (objfile_to_objfile_object): Declare.
(objfpy_get_printers): Likewise.
(gdbpy_initialize_objfile): Likewise.
* Makefile.in (SUBDIR_PYTHON_OBS): Add python-objfile.o.
(SUBDIR_PYTHON_SRCS): Add python-objfile.c.
(python-objfile.o): New target.
gdb/doc
2009-04-01 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.texinfo (Python API): Update.
(Auto-loading): New node.
(Objfiles In Python): New node.
gdb/testsuite
2009-04-06 Tom Tromey <tromey@redhat.com>
* gdb.python/python.exp (gdb_py_test_multiple): Add two objfile
tests.
* gdb.python/python-value.exp (py_objfile_tests): New proc.
Call it.
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r-- | gdb/testsuite/gdb.python/python-value.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp index b3b5746..93e9d89 100644 --- a/gdb/testsuite/gdb.python/python-value.exp +++ b/gdb/testsuite/gdb.python/python-value.exp @@ -236,6 +236,15 @@ proc test_value_in_inferior {} { gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute" } +# A few objfile tests. +proc test_objfiles {} { + gdb_test "python\nok=False\nfor file in gdb.objfiles():\n if 'python-value' in file.filename:\n ok=True\nprint ok\nend" "True" + + gdb_test "python print gdb.objfiles()\[0\].pretty_printers" "\\\[\\\]" + + gdb_test "python gdb.objfiles()\[0\].pretty_printers = 0" \ + "pretty_printers attribute must be a list.*Error while executing Python code." +} # Start with a fresh gdb. @@ -256,6 +265,7 @@ test_value_creation test_value_numeric_ops test_value_boolean test_value_compare +test_objfiles # The following tests require execution. diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index a0c9b39..5223fc8 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -71,3 +71,6 @@ gdb_py_test_multiple "indented multi-line python command" \ " print 'hello, world!'" "" \ "foo ()" "" \ "end" "hello, world!" + +gdb_test "python print gdb.current_objfile()" "None" +gdb_test "python print gdb.objfiles()" "\\\[\\\]" |