diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2009-12-08 14:06:04 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2009-12-08 14:06:04 +0000 |
commit | 361ae042505053cb924612be0c8c79380d29d941 (patch) | |
tree | c652761b90b8d96b675146b80aac4b7e80926cc3 /gdb/testsuite | |
parent | 40b5c9fb4b794ff4337707edbd74af035bdbb0c2 (diff) | |
download | gdb-361ae042505053cb924612be0c8c79380d29d941.zip gdb-361ae042505053cb924612be0c8c79380d29d941.tar.gz gdb-361ae042505053cb924612be0c8c79380d29d941.tar.bz2 |
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
PR python/10804
* python/py-type.c (typy_range): New Function.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-type.exp (test_range): New test.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Types In Python): Describe range function.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.exp | 24 |
2 files changed, 28 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 65d1ee6..069280c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-12-08 Phil Muldoon <pmuldoon@redhat.com> + + * gdb.python/py-type.exp (test_range): New test. + 2009-12-03 Phil Muldoon <pmuldoon@redhat.com> PR python/10805 diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index fabda5b..5fa0877 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -102,6 +102,29 @@ proc test_base_class {} { gdb_test "python print fields\[1\].is_base_class" "False" "Check base class" } +proc test_range {} { + + # Test a valid range request. + gdb_py_test_silent_cmd "print ar" "print value" 1 + gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value from history" 1 + gdb_test "python print len(ar.type.range())" "2" "Check correct tuple length" + gdb_test "python print ar.type.range()\[0\]" "0" "Check low range" + gdb_test "python print ar.type.range()\[1\]" "1" "Check high range" + + # Test a range request on a ranged type. + gdb_py_test_silent_cmd "print ar" "print value" 1 + gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value from history" 1 + gdb_py_test_silent_cmd "python fields = ar.type.fields()" "get fields" 1 + gdb_test "python print fields\[0\].type.range()\[0\]" "0" "Check range type low bound" + gdb_test "python print fields\[0\].type.range()\[1\]" "1" "Check range type high bound" + + # Test where a range does not exist. + gdb_py_test_silent_cmd "print st" "print value" 1 + gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1 + gdb_test "python print st.type.range()" "RuntimeError: This type does not have a range.*" "Check range for non ranged type." +} + + # Perform C Tests. build_inferior "c" restart_gdb "break to inspect struct and array." @@ -112,3 +135,4 @@ build_inferior "c++" restart_gdb "break to inspect struct and array." test_fields "c++" test_base_class +test_range |