[binutils-gdb] [gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info

Tom de Vries vries@sourceware.org
Tue Feb 18 09:18:00 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d4295de4f3d6cb24289d79c424d430b0df38db07

commit d4295de4f3d6cb24289d79c424d430b0df38db07
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Feb 18 10:18:36 2020 +0100

    [gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info
    
    After de-installing gnatmake, I get on stdout/stderr:
    ...
    Running src/gdb/testsuite/gdb.base/gdb-caching-proc.exp ...
    FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
      ...
    FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
    ...
    
    In gdb.sum, we see these FAILs (each paired with an UNSUPPORTED as well)
    followed by:
    ...
    PASS: gdb-caching-proc.exp: gnat_runtime_has_debug_info consistency
    ...
    
    Likewise, after re-installing gnatmake, I get a PASS for each of the
    UNSUPPORTEDs, and the FAILs disappear.
    
    The FAIL comes from gnat_runtime_has_debug_info, the PASS/UNSUPPORTED comes
    from gdb_compile_ada.
    
    Fix this by removing the corresponding fail call in
    gnat_runtime_has_debug_info, as well as using a new variant gdb_compile_ada_1
    that doesn't call pass/unsupported.
    
    Tested on x86_64-linux, with gnatmake installed and de-installed.
    
    gdb/testsuite/ChangeLog:
    
    2020-02-18  Tom de Vries  <tdevries@suse.de>
    
    	* lib/ada.exp (gdb_compile_ada_1): Factor out of ...
    	(gdb_compile_ada): ... here.
    	(gnat_runtime_has_debug_info): Remove fail call for gdb_compile_ada
    	failure.  Use gdb_compile_ada_1 instead of gdb_compile_ada.

Diff:
---
 gdb/testsuite/ChangeLog   |  7 +++++++
 gdb/testsuite/lib/ada.exp | 16 ++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1a9203c..e8ef3d3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-18  Tom de Vries  <tdevries@suse.de>
+
+	* lib/ada.exp (gdb_compile_ada_1): Factor out of ...
+	(gdb_compile_ada): ... here.
+	(gnat_runtime_has_debug_info): Remove fail call for gdb_compile_ada
+	failure.  Use gdb_compile_ada_1 instead of gdb_compile_ada.
+
 2020-02-14  Tom Tromey  <tom@tromey.com>
 
 	* lib/gdbserver-support.exp (find_gdbserver): Find gdbserver in
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 9933cc9..6648566 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -52,9 +52,9 @@ proc target_compile_ada_from_dir {builddir source dest type options} {
     return -options $options $result
 }
 
-# Compile some Ada code.
+# Compile some Ada code.  Return "" if the compile was successful.
 
-proc gdb_compile_ada {source dest type options} {
+proc gdb_compile_ada_1 {source dest type options} {
 
     set srcdir [file dirname $source]
     set gprdir [file dirname $srcdir]
@@ -80,6 +80,15 @@ proc gdb_compile_ada {source dest type options} {
     # We therefore simply check whether the dest file has been created
     # or not. Unless not present, the build has succeeded.
     if [file exists $dest] { set result "" }
+    return $result
+}
+
+# Compile some Ada code.  Generate "PASS: foo.exp: compilation SOURCE" if the
+# compile was successful.
+
+proc gdb_compile_ada {source dest type options} {
+    set result [gdb_compile_ada_1 $source $dest $type $options]
+
     gdb_compile_test $source $result
     return $result
 }
@@ -162,8 +171,7 @@ gdb_caching_proc gnat_runtime_has_debug_info {
     set src "$srcdir/lib/gnat_debug_info_test.adb"
     set dst [standard_output_file "gnat_debug_info_test"]
 
-    if { [gdb_compile_ada $src $dst executable {debug}] != "" } {
-	fail "failed to compile gnat-debug-info test binary"
+    if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } {
 	return 0
     }



More information about the Gdb-cvs mailing list