return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
# Reminder, "var" is an integer; all these types get converted to `int'.
CompileExpression::new "var"
CompileExpression::test "anon_e" {(3|GHI)}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "d.a_" 1
CompileExpression::test "d.b_" 2
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "a.public_" 1
CompileExpression::test "a.protected_" {(21|N::NB)}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "a->get_var ()" 21
CompileExpression::test "a->get_var (static_cast<unsigned long> (1))" 100
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "N1::N2::N3::N4::n4static" 400
CompileExpression::test "N1::N2::N3::N4::S4::s4static" 40
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "i1.a_" 2
CompileExpression::test "i2.a_" 3
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested \
- "compile command not supported (could not find libcc1 shared library?)"
- return -1
-}
-
gdb_breakpoint [gdb_get_line_number "break here" $srcfile]
gdb_continue_to_breakpoint "testing location"
+if {[skip_compile_feature_untested "var = 0"]} {
+ return -1
+}
+
CompileExpression::new "var"
CompileExpression::test "b.doit ()" 2
CompileExpression::test "c.doit ()" 3
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+
+if {[skip_compile_feature_untested "var = 0"]} {
return -1
}
"The program being debugged was signaled while in a function called from GDB\\.\r\nGDB has restored the context to what it was before the call\\.\r\n.*" \
"compile code segfault second"
-gdb_breakpoint [gdb_get_line_number "break-here"]
-gdb_continue_to_breakpoint "break-here" ".* break-here .*"
-
# C++ Specific tests.
## Public methods and members
# feature check below will work.
gdb_test_no_output "set language c" ""
- if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+ if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return 0
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
return -1
}
-if {[skip_compile_feature_tests]} {
- untested "compile command not supported (could not find libcc1 shared library?)"
+if {[skip_compile_feature_untested]} {
return -1
}
# Generic/oft used support routines for testing GDB's compile feature.
-# Return 1 if we should skip tests of the "compile" feature.
-# This must be invoked after the inferior has been started.
+# Helper function for skip_compile_feature_tests. This does the real
+# work, but should not be called directly. Returns a failure reason
+# (a string) on failure, or the empty string on success.
-proc skip_compile_feature_tests {} {
+proc _do_check_compile {expr} {
global gdb_prompt
- set result 0
- gdb_test_multiple "compile code -- ;" "check for working compile command" {
+ set result ""
+ gdb_test_multiple "compile code -- $expr;" "check for working compile command" {
"Could not load libcc1.*\r\n$gdb_prompt $" {
- set result 1
+ set result "could not find libcc1"
+ }
+ "Could not load libcp1.*\r\n$gdb_prompt $" {
+ set result "could not find libcp1"
+ }
+ -re "WARNING .* there are active plugins, do not report this" {
+ # Note that the regexp above does not check for the
+ # prompt. This avoids a gratuitous timeout.
+ set result "GCC crashed"
+ }
+ -re "confused by earlier errors, bailing out" {
+ # This scenario can happen when either GCC or GDB is
+ # confused by some other debuginfo.
+ # See PR compile/29541.
+ set result "confused by glibc debuginfo"
}
-re "\r\n$gdb_prompt $" {
}
return $result
}
+# Return 1 if we should skip tests of the "compile" feature.
+# This must be invoked after the inferior has been started.
+# EXPR is the expression to test, if any (using the default empty EXPR
+# works fine in most cases).
+
+proc skip_compile_feature_tests {{expr ""}} {
+ return [expr {[string length [_do_check_compile $expr]] > 0}]
+}
+
+# Like skip_compile_feature_tests, but also issue an "untested" when
+# skipping.
+
+proc skip_compile_feature_untested {{expr ""}} {
+ set output [_do_check_compile $expr]
+ if {[string length $output] > 0} {
+ untested "compile command not supported ($output)"
+ return 1
+ }
+ return 0
+}
+
# This namespace provides some convenience functions for running
# "compile code" and "compile print" tests.
#