Different compilers link the epilogue of functions to different lines.
As an example, gcc links it to the closing brace of the function,
whereas clang links it to the last statement of the function. This
difference is important for the testsuite, since the where GDB will land
after a step can be wildly different. Where possible, this dependency
should be side-stepped in the testsuite, but it isn't always possible,
so this commit adds a gdb_caching_proc that is able to detect where the
epilogue is linked, so tests can react accordingly.
}
}
+# Check if the compiler emits epilogue information associated
+# with the closing brace or with the last statement line.
+#
+# This proc restarts GDB
+#
+# Returns True if it is associated with the closing brace,
+# False if it is the last statement
+gdb_caching_proc have_epilogue_line_info {
+
+ set main {
+ int
+ main ()
+ {
+ return 0;
+ }
+ }
+ if {![gdb_simple_compile "simple_program" $main]} {
+ return False
+ }
+
+ clean_restart $obj
+
+ gdb_test_multiple "info line 6" "epilogue test" {
+ -re -wrap ".*starts at address.*and ends at.*" {
+ return True
+ }
+ -re -wrap ".*" {
+ return False
+ }
+ }
+}
+
# Always load compatibility stuff.
load_lib future.exp