}
}
-# 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
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} {
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