Add gdb_caching_proc support_nested_function_tests to lib/gdb.exp
authorKevin Buettner <kevinb@redhat.com>
Sat, 9 Nov 2019 18:09:41 +0000 (11:09 -0700)
committerKevin Buettner <kevinb@redhat.com>
Tue, 10 Dec 2019 22:42:15 +0000 (15:42 -0700)
This commit adds the gdb_caching_proc, support_nested_function_tests,
to lib/gdb.exp.  It tests to see whether or not the C compiler has
support for nested function calls.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (support_nested_function_tests): New proc.

Change-Id: Ic2c93bc4cc200e07e104a2398f89a9c0514bdc75

gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index d3510d42cbc2f4bfef075c27a6e4ddd95ca27761..4b2e13215a0e6e0bd62e0a3ff5bcf17c8e222f66 100644 (file)
@@ -1,8 +1,12 @@
 2019-12-10  Kevin Buettner  <kevinb@redhat.com>
 
-            * lib/gdb.exp (gdb_compile_openmp): New proc.
-            (build_executable_from_specs): Add an "openmp" option.
-            (gdb_compile_pthreads): Add non-executable case.
+       * lib/gdb.exp (support_nested_function_tests): New proc.
+
+2019-12-10  Kevin Buettner  <kevinb@redhat.com>
+
+       * lib/gdb.exp (gdb_compile_openmp): New proc.
+       (build_executable_from_specs): Add an "openmp" option.
+       (gdb_compile_pthreads): Add non-executable case.
 
 2019-12-10  Tom Tromey  <tromey@adacore.com>
 
index 806e5a0c304e8b130909fd854f3fcd6ab07f5317..8b1ec62c9c21570f3d3cb4c9d3fa0bdce016876e 100644 (file)
@@ -6395,6 +6395,21 @@ gdb_caching_proc target_supports_scheduler_locking {
     return $supports_schedule_locking
 }
 
+# Return 1 if compiler supports use of nested functions.  Otherwise,
+# return 0.
+
+gdb_caching_proc support_nested_function_tests {
+    # Compile a test program containing a nested function
+    return [gdb_can_simple_compile nested_func {
+       int main () {
+           int foo () {
+               return 0;
+           }
+           return foo ();
+       }
+    } executable]
+}
+
 # gdb_target_symbol returns the provided symbol with the correct prefix
 # prepended.  (See gdb_target_symbol_prefix, above.)