aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-04-24 13:40:31 -0600
committerTom Tromey <tromey@adacore.com>2020-04-24 13:40:33 -0600
commit1acda8039ba681e88416a7da6a6e3abdcae6b86b (patch)
tree4ca5562817e90e1a657fc47eced4369a0c75b342 /gdb/testsuite/gdb.ada
parentadfb981595c1ea12736b6d3c4686973040f171ff (diff)
downloadgdb-1acda8039ba681e88416a7da6a6e3abdcae6b86b.zip
gdb-1acda8039ba681e88416a7da6a6e3abdcae6b86b.tar.gz
gdb-1acda8039ba681e88416a7da6a6e3abdcae6b86b.tar.bz2
Add Python support for dynamic types
This changes the gdb Python API to add support for dynamic types. In particular, this adds an attribute to gdb.Type, and updates some attributes to reflect dynamic sizes and field offsets. There's still no way to get the dynamic type from one of its concrete instances. This could perhaps be added if needed. gdb/ChangeLog 2020-04-24 Tom Tromey <tromey@adacore.com> PR python/23662: * python/py-type.c (convert_field): Handle FIELD_LOC_KIND_DWARF_BLOCK. (typy_get_sizeof): Handle TYPE_HAS_DYNAMIC_LENGTH. (typy_get_dynamic): Nw function. (type_object_getset): Add "dynamic". * NEWS: Add entry. gdb/doc/ChangeLog 2020-04-24 Tom Tromey <tromey@adacore.com> PR python/23662: * python.texi (Types In Python): Document new features. gdb/testsuite/ChangeLog 2020-04-24 Tom Tromey <tromey@adacore.com> PR python/23662: * gdb.ada/variant.exp: Add Python checks. * gdb.rust/simple.exp: Add dynamic type checks.
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r--gdb/testsuite/gdb.ada/variant.exp10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/variant.exp b/gdb/testsuite/gdb.ada/variant.exp
index 490956a..da51f7b 100644
--- a/gdb/testsuite/gdb.ada/variant.exp
+++ b/gdb/testsuite/gdb.ada/variant.exp
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib "ada.exp"
+load_lib "gdb-python.exp"
standard_ada_testfile pkg
@@ -43,4 +44,13 @@ foreach_with_prefix scenario {none all minimal} {
" = \\(one => 3, two => 0, str => \"zzz\", onevalue => 33, str2 => \"\"\\)"
gdb_test "print nav3" \
" = \\(one => 3, two => 7, str => \"zzz\", onevalue => 33, str2 => \"qqqqqqq\", twovalue => 88\\)"
+
+ # This is only supported for the DWARF encoding.
+ if {$scenario == "minimal" && ![skip_python_tests]} {
+ gdb_test_no_output \
+ "python t = gdb.lookup_type('nested_and_variable')" \
+ "fetch type for python"
+ gdb_test "python print(t.dynamic)" "True"
+ gdb_test "python print(t\['onevalue'\].bitpos)" "None"
+ }
}