diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9b7b0105db5..1a104b1f339 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-12-18 Hannes Domani + + * python/py-type.c (typy_get_composite): Add TYPE_CODE_METHOD. + 2020-12-18 Jameson Nash * coffread.c (linetab_offset): Change type to file_ptr. diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 1c7cacbddf3..3fc0f61c635 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -471,6 +471,7 @@ typy_get_composite (struct type *type) if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION && type->code () != TYPE_CODE_ENUM + && type->code () != TYPE_CODE_METHOD && type->code () != TYPE_CODE_FUNC) { PyErr_SetString (PyExc_TypeError, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 24df95135db..73425638a23 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-12-18 Hannes Domani + + * gdb.python/py-type.exp: Add tests for TYPE_CODE_METHOD. + 2020-12-18 Tom Tromey * gdb.ada/fixed_points.exp: Also run with diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index c01442c3887..5166f9ecee6 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -83,15 +83,18 @@ proc test_fields {lang} { gdb_test "python print (gdb.parse_and_eval ('C::a_method').type.fields ()\[0\].type)" "C \\* const" gdb_test "python print (gdb.parse_and_eval ('C::a_method').type.fields ()\[1\].type)" "int" gdb_test "python print (gdb.parse_and_eval ('C::a_method').type.fields ()\[2\].type)" "char" + gdb_test "python print (gdb.parse_and_eval ('c')\['a_method'\].type.fields ()\[0\].type)" "C \\* const" gdb_test "python print (len (gdb.parse_and_eval ('C::a_const_method').type.fields ()))" "3" gdb_test "python print (gdb.parse_and_eval ('C::a_const_method').type.fields ()\[0\].type)" "const C \\* const" gdb_test "python print (gdb.parse_and_eval ('C::a_const_method').type.fields ()\[1\].type)" "int" gdb_test "python print (gdb.parse_and_eval ('C::a_const_method').type.fields ()\[2\].type)" "char" + gdb_test "python print (gdb.parse_and_eval ('c')\['a_const_method'\].type.fields ()\[0\].type)" "const C \\* const" gdb_test "python print (len (gdb.parse_and_eval ('C::a_static_method').type.fields ()))" "2" gdb_test "python print (gdb.parse_and_eval ('C::a_static_method').type.fields ()\[0\].type)" "int" gdb_test "python print (gdb.parse_and_eval ('C::a_static_method').type.fields ()\[1\].type)" "char" + gdb_test "python print (gdb.parse_and_eval ('c')\['a_static_method'\].type.fields ()\[0\].type)" "int" } # Test normal fields usage in structs.