summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-inferior.exp
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-03-17 09:36:17 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-03-17 09:36:17 +0000
commit29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5 (patch)
treec0999d1a168f21196c3c8ba5b1401f05b00236d3 /gdb/testsuite/gdb.python/py-inferior.exp
parenta6363bfc3832f13436cb744783aa96eaec972006 (diff)
downloadbinutils-gdb-29703da4b1a5b80034c3f33b0c8f34ce6e1f08d5.tar.gz
2011-03-17 Phil Muldoon <pmuldoon@redhat.com>
* python/py-symtab.c: Populate symtab_object_methods, sal_object_methods. (stpy_is_valid): New function. (salpy_is_valid): Ditto. * python/py-symbol.c: Declare symbol_object_methods. Populate. (sympy_is_valid): New function. * python/py-objfile.c: Declare objfile_object_methods. Populate. (objfpy_is_valid): New function. * python/py-inferior.c: Populate inferior_object_methods. (infpy_is_valid): New function. * python/py-infthread.c: Populate thread_object_methods. (thpy_is_valid): New function. * python/py-block.c: Declare block_object_methods. Populate. Declare block_iterator_object_methods. Populate. (blpy_is_valid): New function. (blpy_iter_is_valid): Ditto. 2010-03-17 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/Makefile.in: Add py-objfile. * gdb.python/py-objfile.exp: New file. * gdb.python/py-objfile.c: New file. * gdb.python/py-block.exp: Add is_valid tests. * gdb.python/py-inferior.exp: Ditto. * gdb.python/py-infthread.exp: Ditto. * gdb.python/py-symbol.exp: Ditto. * gdb.python/py-symtab.exp: Ditto. 2011-03-17 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Blocks In Python): Add is_valid method description. (Inferiors In Python): Likewise. (Threads In Python): Likewise. (Symbols In Python): Likewise. (Objfiles In Python): Likewise. (Symbol Tables In Python): Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-inferior.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-inferior.exp20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 138c0fb19d2..42ca920a820 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -191,3 +191,23 @@ if [isnative] {
gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)" \
"${one_pattern_found}" "find pattern straddling chunk boundary"
}
+
+# Test Inferior is_valid. This must always be the last test in
+# this testcase as it kills the inferior.
+
+gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get initial list" 1
+gdb_test "python print len(inf_list)" "1" "Get inferior list length"
+gdb_test "python print inf_list\[0\].is_valid()" "True" \
+ "Check inferior validity"
+gdb_test "add-inferior" "Added inferior 2.*" "add empty inferior 2"
+gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get new list" 1
+gdb_test "python print len(inf_list)" "2" "Get inferior list length"
+gdb_test "python print inf_list\[0\].is_valid()" "True" \
+ "Check inferior validity"
+gdb_test "python print inf_list\[1\].is_valid()" "True" \
+ "Check inferior validity"
+gdb_test_no_output "remove-inferiors 2" "remove-inferiors 2"
+gdb_test "python print inf_list\[0\].is_valid()" "False" \
+ "Check inferior validity"
+gdb_test "python print inf_list\[1\].is_valid()" "True" \
+ "Check inferior validity"