diff options
author | Tom Tromey <tromey@redhat.com> | 2010-07-28 20:50:17 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-07-28 20:50:17 +0000 |
commit | 326fd672ca2f8c6b38d1068636702766a1f381b5 (patch) | |
tree | 5a9f191f2f3ba1bafde948b816cb911429a4390b /gdb/testsuite | |
parent | 4ac8c4da1d26746d82e7c41e5eb2e9215d10e8a2 (diff) | |
download | gdb-326fd672ca2f8c6b38d1068636702766a1f381b5.zip gdb-326fd672ca2f8c6b38d1068636702766a1f381b5.tar.gz gdb-326fd672ca2f8c6b38d1068636702766a1f381b5.tar.bz2 |
gdb
PR python/11060:
* python/py-type.c (typy_legacy_template_argument): New function,
extracted from typy_template_argument.
(typy_template_argument): Use TYPE_TEMPLATE_ARGUMENT. Return a
value when needed.
gdb/testsuite
PR python/11060:
* gdb.python/py-type.c (Temargs): New template.
(temvar): New variable.
* gdb.python/py-type.exp (test_template): New proc.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.c | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.exp | 18 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 44ee3b9..5739a8e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-07-28 Tom Tromey <tromey@redhat.com> + + PR python/11060: + * gdb.python/py-type.c (Temargs): New template. + (temvar): New variable. + * gdb.python/py-type.exp (test_template): New proc. + 2010-07-28 Daniel Jacobowitz <dan@codesourcery.com> * gdb.cp/member-ptr.exp, gdb.cp/printmethod.exp, diff --git a/gdb/testsuite/gdb.python/py-type.c b/gdb/testsuite/gdb.python/py-type.c index f9c15cc..4650525 100644 --- a/gdb/testsuite/gdb.python/py-type.c +++ b/gdb/testsuite/gdb.python/py-type.c @@ -33,6 +33,14 @@ struct D : C int e; int f; }; + +template<typename T, int I, int C::*MP> +struct Temargs +{ +}; + +Temargs<D, 23, &C::c> temvar; + #endif int diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 63117ad..1cdb1c1 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -126,6 +126,23 @@ proc test_range {} { gdb_test "python print st.type.range()" "RuntimeError: This type does not have a range.*" "Check range for non ranged type." } +# Some tests of template arguments. +proc test_template {} { + gdb_py_test_silent_cmd \ + "python ttype = gdb.parse_and_eval('temvar').type" \ + "get type of temvar" \ + 1 + + gdb_test "python print ttype.template_argument(0)" "D" + gdb_test "python print isinstance(ttype.template_argument(0), gdb.Type)" \ + "True" + # The next two tests require a GCC that emits DW_TAG_template_*. + gdb_test "python print ttype.template_argument(1)" "23" + gdb_test "python print isinstance(ttype.template_argument(1), gdb.Value)" \ + "True" + setup_kfail "gcc/41736" *-*-* + gdb_test "python print ttype.template_argument(2)" "&C::c" +} # Perform C Tests. build_inferior "c" @@ -144,3 +161,4 @@ runto_bp "break to inspect struct and array." test_fields "c++" test_base_class test_range +test_template |