public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][testsuite/guality] Be verbose about gdb version used
@ 2018-06-22 11:35 Tom de Vries
  2018-06-22 16:01 ` Jeff Law
  0 siblings, 1 reply; 8+ messages in thread
From: Tom de Vries @ 2018-06-22 11:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Mike Stump, Rainer Orth

Hi,

by default, guality invokes gdb with --quiet to avoid being unnecessarily
verbose for each test.  But as a consequence, we don't see which version of
gdb is used.

This patch adds printing of the full path to the gdb used, as well as the
gdb version as printed by gdb.

Tested on x86_64.

OK for trunk?

Thanks,
- Tom

[testsuite/guality] Be verbose about gdb version used

2018-06-22  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (report_gdb): New proc.
	* g++.dg/guality/guality.exp: Use report_gdb.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.

---
 gcc/testsuite/g++.dg/guality/guality.exp      |  1 +
 gcc/testsuite/gcc.dg/guality/guality.exp      |  1 +
 gcc/testsuite/gfortran.dg/guality/guality.exp |  1 +
 gcc/testsuite/lib/gcc-gdb-test.exp            | 10 ++++++++++
 4 files changed, 13 insertions(+)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 5bffd9df1a0..72f23c8cca7 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -43,6 +43,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index d2b863397ba..7eebd27b544 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -43,6 +43,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 3f96a04bd26..62875fd54b8 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -24,6 +24,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 0c4d2a533f6..f3726635c03 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -139,3 +139,13 @@ proc gdb-test { args } {
     file delete $cmd_file
     return
 }
+
+# Report the gdb path and version log the .log file
+# Argument 0 is the gdb path
+# Argument 1 is the location where gdb is used
+# 
+proc report_gdb { gdb loc } {
+    send_log "gdb used in $loc: $gdb\n"
+    set gdb_version [exec $gdb -v]
+    send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
+}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-22 11:35 [PATCH][testsuite/guality] Be verbose about gdb version used Tom de Vries
@ 2018-06-22 16:01 ` Jeff Law
  2018-06-23 17:06   ` Christophe Lyon
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Law @ 2018-06-22 16:01 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches; +Cc: Mike Stump, Rainer Orth

On 06/22/2018 05:35 AM, Tom de Vries wrote:
> Hi,
> 
> by default, guality invokes gdb with --quiet to avoid being unnecessarily
> verbose for each test.  But as a consequence, we don't see which version of
> gdb is used.
> 
> This patch adds printing of the full path to the gdb used, as well as the
> gdb version as printed by gdb.
> 
> Tested on x86_64.
> 
> OK for trunk?
> 
> Thanks,
> - Tom
> 
> [testsuite/guality] Be verbose about gdb version used
> 
> 2018-06-22  Tom de Vries  <tdevries@suse.de>
> 
> 	* lib/gcc-gdb-test.exp (report_gdb): New proc.
> 	* g++.dg/guality/guality.exp: Use report_gdb.
> 	* gcc.dg/guality/guality.exp: Same.
> 	* gfortran.dg/guality/guality.exp: Same.
OK.
jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-22 16:01 ` Jeff Law
@ 2018-06-23 17:06   ` Christophe Lyon
  2018-06-23 23:47     ` Tom de Vries
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Lyon @ 2018-06-23 17:06 UTC (permalink / raw)
  To: Jeff Law; +Cc: tdevries, gcc Patches, Mike Stump, Rainer Orth

Hello,

On Fri, 22 Jun 2018 at 18:01, Jeff Law <law@redhat.com> wrote:
>
> On 06/22/2018 05:35 AM, Tom de Vries wrote:
> > Hi,
> >
> > by default, guality invokes gdb with --quiet to avoid being unnecessarily
> > verbose for each test.  But as a consequence, we don't see which version of
> > gdb is used.
> >
> > This patch adds printing of the full path to the gdb used, as well as the
> > gdb version as printed by gdb.
> >
> > Tested on x86_64.
> >
> > OK for trunk?
> >
> > Thanks,
> > - Tom
> >
> > [testsuite/guality] Be verbose about gdb version used
> >
> > 2018-06-22  Tom de Vries  <tdevries@suse.de>
> >
> >       * lib/gcc-gdb-test.exp (report_gdb): New proc.
> >       * g++.dg/guality/guality.exp: Use report_gdb.
> >       * gcc.dg/guality/guality.exp: Same.
> >       * gfortran.dg/guality/guality.exp: Same.
> OK.

It looks like this patch is causing problems when not building gdb. I
my GCC testing, I'm now seeing:
ERROR: tcl error sourcing /gcc/testsuite/gfortran.dg/guality/guality.exp.
ERROR: which: no aarch64-none-linux-gnu-gdb in
(/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/bin:/work/local/bin:/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/utils/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin)
    while executing
"exec which $::env(GUALITY_GDB_NAME)"
    invoked from within
"report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]"


> jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-23 17:06   ` Christophe Lyon
@ 2018-06-23 23:47     ` Tom de Vries
  2018-06-25 12:32       ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Tom de Vries @ 2018-06-23 23:47 UTC (permalink / raw)
  To: Christophe Lyon, Jeff Law; +Cc: gcc Patches, Mike Stump, Rainer Orth

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

On 06/23/2018 07:05 PM, Christophe Lyon wrote:
> Hello,
> 
> On Fri, 22 Jun 2018 at 18:01, Jeff Law <law@redhat.com> wrote:
>>
>> On 06/22/2018 05:35 AM, Tom de Vries wrote:
>>> Hi,
>>>
>>> by default, guality invokes gdb with --quiet to avoid being unnecessarily
>>> verbose for each test.  But as a consequence, we don't see which version of
>>> gdb is used.
>>>
>>> This patch adds printing of the full path to the gdb used, as well as the
>>> gdb version as printed by gdb.
>>>
>>> Tested on x86_64.
>>>
>>> OK for trunk?
>>>
>>> Thanks,
>>> - Tom
>>>
>>> [testsuite/guality] Be verbose about gdb version used
>>>
>>> 2018-06-22  Tom de Vries  <tdevries@suse.de>
>>>
>>>       * lib/gcc-gdb-test.exp (report_gdb): New proc.
>>>       * g++.dg/guality/guality.exp: Use report_gdb.
>>>       * gcc.dg/guality/guality.exp: Same.
>>>       * gfortran.dg/guality/guality.exp: Same.
>> OK.
> 
> It looks like this patch is causing problems when not building gdb. I
> my GCC testing, I'm now seeing:
> ERROR: tcl error sourcing /gcc/testsuite/gfortran.dg/guality/guality.exp.
> ERROR: which: no aarch64-none-linux-gnu-gdb in
> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/bin:/work/local/bin:/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/utils/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin)
>     while executing
> "exec which $::env(GUALITY_GDB_NAME)"
>     invoked from within
> "report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]"
> 

Hi,

the problem is not related to building or not building gdb, it's related
to whether the gdb that guality.exp is trying to use, is available in
PATH or not.

I've fixed this in attached patch.

Thanks,
- Tom

[-- Attachment #2: 0001-testsuite-guality-Fix-tcl-error-on-missing-gdb.patch --]
[-- Type: text/x-patch, Size: 2830 bytes --]

[testsuite/guality] Fix tcl error on missing gdb

2018-06-24  Tom de Vries  <tdevries@suse.de>

	* g++.dg/guality/guality.exp: Don't use which on gdb arg to report_gdb.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.
	* lib/gcc-gdb-test.exp: Do early out if which gdb fails.

---
 gcc/testsuite/g++.dg/guality/guality.exp      | 2 +-
 gcc/testsuite/gcc.dg/guality/guality.exp      | 2 +-
 gcc/testsuite/gfortran.dg/guality/guality.exp | 2 +-
 gcc/testsuite/lib/gcc-gdb-test.exp            | 5 +++++
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index e5eaceedc9a..4be22baa19c 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -46,7 +46,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index 2a90ec3c8c8..04e889caa2f 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -46,7 +46,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 3784cac1ef3..f76347dd52f 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -27,7 +27,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index f3726635c03..9aff6218300 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -145,6 +145,11 @@ proc gdb-test { args } {
 # Argument 1 is the location where gdb is used
 # 
 proc report_gdb { gdb loc } {
+    if { [catch { exec which $gdb } msg] } {
+	send_log "gdb not found in $loc: $msg\n"
+	return
+    }
+    set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
     set gdb_version [exec $gdb -v]
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-23 23:47     ` Tom de Vries
@ 2018-06-25 12:32       ` Andreas Schwab
  2018-06-25 13:18         ` Tom de Vries
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2018-06-25 12:32 UTC (permalink / raw)
  To: Tom de Vries
  Cc: Christophe Lyon, Jeff Law, gcc Patches, Mike Stump, Rainer Orth

I'm still getting this error:

Running /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp ...
gdb used in /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp: /usr/bin/gdb
ERROR: tcl error sourcing /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp.
ERROR: GNU gdb (GDB; SUSE Linux Enterprise 11) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "ia64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
[GDB failed to load libunwind-ia64.so.8: libunwind-ia64.so.8: cannot open shared object file: No such file or directory]
[GDB failed to load libunwind-ia64.so.7: /usr/lib/libunwind-ia64.so.7: undefined symbol: _Uelf64_get_proc_name]
    while executing
"exec $gdb -v"
    (procedure "report_gdb" line 8)
    invoked from within
"report_gdb $::env(GUALITY_GDB_NAME) [info script]"
    (file "/usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp" line 49)
    invoked from within
"source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
testcase /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp completed in 0 seconds

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-25 12:32       ` Andreas Schwab
@ 2018-06-25 13:18         ` Tom de Vries
  2018-06-25 14:36           ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Tom de Vries @ 2018-06-25 13:18 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Christophe Lyon, Jeff Law, gcc Patches, Mike Stump, Rainer Orth

On 06/25/2018 02:32 PM, Andreas Schwab wrote:
> I'm still getting this error:
> 
> Running /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp ...
> gdb used in /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp: /usr/bin/gdb
> ERROR: tcl error sourcing /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp.
> ERROR: GNU gdb (GDB; SUSE Linux Enterprise 11) 7.9.1
> Copyright (C) 2015 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "ia64-suse-linux".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://bugs.opensuse.org/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word".
> [GDB failed to load libunwind-ia64.so.8: libunwind-ia64.so.8: cannot open shared object file: No such file or directory]
> [GDB failed to load libunwind-ia64.so.7: /usr/lib/libunwind-ia64.so.7: undefined symbol: _Uelf64_get_proc_name]
>     while executing
> "exec $gdb -v"
>     (procedure "report_gdb" line 8)
>     invoked from within
> "report_gdb $::env(GUALITY_GDB_NAME) [info script]"
>     (file "/usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp" line 49)
>     invoked from within
> "source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name""
> testcase /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp completed in 0 seconds

Hi,

Can you try this patch to see if it fixes the error?

Thanks,
- Tom

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp
b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..a83c4ca04c7 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
+    if { [catch { set gdb_version [exec $gdb -v] }] } {
+       send_log "gdb used in $loc: getting version failed\n"
+       return
+    }
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-25 13:18         ` Tom de Vries
@ 2018-06-25 14:36           ` Andreas Schwab
  2018-06-25 16:02             ` Tom de Vries
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2018-06-25 14:36 UTC (permalink / raw)
  To: Tom de Vries
  Cc: Christophe Lyon, Jeff Law, gcc Patches, Mike Stump, Rainer Orth

On Jun 25 2018, Tom de Vries <tdevries@suse.de> wrote:

> @@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
>      }
>      set gdb [exec which $gdb]
>      send_log "gdb used in $loc: $gdb\n"
> -    set gdb_version [exec $gdb -v]
> +    if { [catch { set gdb_version [exec $gdb -v] }] } {
> +       send_log "gdb used in $loc: getting version failed\n"
> +       return
> +    }
>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>  }

How about this instead:

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..26fb7cd2f4d 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,6 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
+    catch { exec $gdb -v } gdb_version
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
 }

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][testsuite/guality] Be verbose about gdb version used
  2018-06-25 14:36           ` Andreas Schwab
@ 2018-06-25 16:02             ` Tom de Vries
  0 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2018-06-25 16:02 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Christophe Lyon, Jeff Law, gcc Patches, Mike Stump, Rainer Orth

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On 06/25/2018 04:36 PM, Andreas Schwab wrote:
> On Jun 25 2018, Tom de Vries <tdevries@suse.de> wrote:
> 
>> @@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
>>      }
>>      set gdb [exec which $gdb]
>>      send_log "gdb used in $loc: $gdb\n"
>> -    set gdb_version [exec $gdb -v]
>> +    if { [catch { set gdb_version [exec $gdb -v] }] } {
>> +       send_log "gdb used in $loc: getting version failed\n"
>> +       return
>> +    }
>>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>>  }
> 
> How about this instead:
> 
> diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
> index 9aff6218300..26fb7cd2f4d 100644
> --- a/gcc/testsuite/lib/gcc-gdb-test.exp
> +++ b/gcc/testsuite/lib/gcc-gdb-test.exp
> @@ -151,6 +151,6 @@ proc report_gdb { gdb loc } {
>      }
>      set gdb [exec which $gdb]
>      send_log "gdb used in $loc: $gdb\n"
> -    set gdb_version [exec $gdb -v]
> +    catch { exec $gdb -v } gdb_version
>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>  }

Hmm, eliminating the set in the catch body is a good idea. But I want to
start with a note that running gdb -v failed.

Committed as attached.

Thanks,
- Tom

[-- Attachment #2: 0001-testsuite-guality-Fix-tcl-error-on-gdb-v-failure.patch --]
[-- Type: text/x-patch, Size: 926 bytes --]

[testsuite/guality] Fix tcl error on gdb -v failure

2018-06-25  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (report_gdb): Handle gdb -v failure.

---
 gcc/testsuite/lib/gcc-gdb-test.exp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..2ef9ca15c12 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,12 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
-    send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
+
+    send_log "gdb used in $loc: "
+    if { [catch { exec $gdb -v } gdb_version] } {
+	send_log "getting version failed:\n"
+    } else {
+	send_log "version:\n"
+    }
+    send_log -- "---\n$gdb_version\n---\n"
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-25 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 11:35 [PATCH][testsuite/guality] Be verbose about gdb version used Tom de Vries
2018-06-22 16:01 ` Jeff Law
2018-06-23 17:06   ` Christophe Lyon
2018-06-23 23:47     ` Tom de Vries
2018-06-25 12:32       ` Andreas Schwab
2018-06-25 13:18         ` Tom de Vries
2018-06-25 14:36           ` Andreas Schwab
2018-06-25 16:02             ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).