aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r--gdb/testsuite/gdb.python/python-value.exp10
-rw-r--r--gdb/testsuite/gdb.python/python.exp3
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()" "\\\[\\\]"