gdb
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-type.exp
index e7ea8f0790aeed91925132654df45a609da46615..1cdb1c1f730e86d5e8b023816b4b71132b413399 100644 (file)
@@ -34,8 +34,8 @@ proc build_inferior {lang} {
   }
 }
 
-# Restart GDB, set breakpoint and run to that breakpoint.
-proc restart_gdb {bp} {
+# Restart GDB.
+proc restart_gdb {} { 
   global srcdir subdir srcfile binfile testfile hex
 
   gdb_exit
@@ -47,12 +47,14 @@ proc restart_gdb {bp} {
       perror "couldn't run to breakpoint"
       return
   }
+}
 
+# Set breakpoint and run to that breakpoint.
+proc runto_bp {bp} {
   gdb_breakpoint [gdb_get_line_number $bp]
   gdb_continue_to_breakpoint $bp
 }
 
-
 # Run a command in GDB, and report a failure if a Python exception is thrown.
 # If report_pass is true, report a pass if no exception is thrown.
 proc gdb_py_test_silent_cmd {cmd name report_pass} {
@@ -124,15 +126,39 @@ 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"
-restart_gdb "break to inspect struct and array."
+restart_gdb 
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+runto_bp "break to inspect struct and array."
 test_fields "c"
 
 # Perform C++ Tests.
 build_inferior "c++"
-restart_gdb "break to inspect struct and array."
+restart_gdb 
+runto_bp "break to inspect struct and array."
 test_fields "c++"
 test_base_class
 test_range
+test_template
This page took 0.027066 seconds and 4 git commands to generate.