When gdb defaults to use debuginfod, gdb warns guality tests:

Spawning: gdb -nx -nw -quiet -batch -x pr36728-2.gdb ./pr36728-2.exe
spawn gdb -nx -nw -quiet -batch -x pr36728-2.gdb ./pr36728-2.exe
Breakpoint 1 at 0x4004ba: file /export/gnu/import/git/gitlab/x86-gcc/gcc/testsui
te/gcc.dg/guality/pr36728-2.c, line 18.

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) [answered N; input not from termi
nal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.

After 'set debuginfod enabled off' is added to ~/.gdbinit, gdb warning
doesn't go away since -nx option ignores ~/.gdbinit.  Silence gdb warning
by setting DEBUGINFOD_URLS to "" and restore if it exists.

PR testsuite/117300
* g++.dg/guality/guality.exp: Set DEBUGINFOD_URLS to "" and
restore it if it exists.
* gcc.dg/guality/guality.exp: Likewise.
* gfortran.dg/guality/guality.exp: Likewise.

Co-authored-by: Andrew Pinski <quic_apin...@quicinc.com>
Signed-off-by: H.J. Lu <hjl.to...@gmail.com>

-- 
H.J.
From 9cdffb8a969ed6a3c2fd2273b05abdbdc424af41 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sun, 27 Oct 2024 05:51:18 +0800
Subject: [PATCH] guality tests: Silence gdb debuginfod warning

When gdb defaults to use debuginfod, gdb warns guality tests:

Spawning: gdb -nx -nw -quiet -batch -x pr36728-2.gdb ./pr36728-2.exe
spawn gdb -nx -nw -quiet -batch -x pr36728-2.gdb ./pr36728-2.exe
Breakpoint 1 at 0x4004ba: file /export/gnu/import/git/gitlab/x86-gcc/gcc/testsuite/gcc.dg/guality/pr36728-2.c, line 18.

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.

After 'set debuginfod enabled off' is added to ~/.gdbinit, gdb warning
doesn't go away since -nx option ignores ~/.gdbinit.  Silence gdb warning
by setting DEBUGINFOD_URLS to "" and restore if it exists.

	PR testsuite/117300
	* g++.dg/guality/guality.exp: Set DEBUGINFOD_URLS to "" and
	restore it if it exists.
	* gcc.dg/guality/guality.exp: Likewise.
	* gfortran.dg/guality/guality.exp: Likewise.

Co-authored-by: Andrew Pinski <quic_apin...@quicinc.com>
Signed-off-by: H.J. Lu <hjl.to...@gmail.com>
---
 gcc/testsuite/g++.dg/guality/guality.exp      | 10 ++++++++++
 gcc/testsuite/gcc.dg/guality/guality.exp      | 10 ++++++++++
 gcc/testsuite/gfortran.dg/guality/guality.exp | 10 ++++++++++
 3 files changed, 30 insertions(+)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index cd56b06f2f0..6de5e8091a5 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -51,6 +51,12 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  set orig_debuginfod_urls "$::env(DEBUGINFOD_URLS)"
+  setenv DEBUGINFOD_URLS ""
+}
+
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
@@ -91,5 +97,9 @@ if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  setenv DEBUGINFOD_URLS "$orig_debuginfod_urls"
+}
+
 torture-finish
 dg-finish
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index a8f2921d888..0dc8f10762d 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -51,6 +51,12 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  set orig_debuginfod_urls "$::env(DEBUGINFOD_URLS)"
+  setenv DEBUGINFOD_URLS ""
+}
+
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 proc guality_transform_options { args } {
@@ -106,5 +112,9 @@ if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  setenv DEBUGINFOD_URLS "$orig_debuginfod_urls"
+}
+
 torture-finish
 dg-finish
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 610449523f0..105e08a70d8 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -32,6 +32,12 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  set orig_debuginfod_urls "$::env(DEBUGINFOD_URLS)"
+  setenv DEBUGINFOD_URLS ""
+}
+
 report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 global DG_TORTURE_OPTIONS
@@ -45,5 +51,9 @@ if [info exists guality_gdb_name] {
     unsetenv GUALITY_GDB_NAME
 }
 
+if [info exists ::env(DEBUGINFOD_URLS)] {
+  setenv DEBUGINFOD_URLS "$orig_debuginfod_urls"
+}
+
 torture-finish
 dg-finish
-- 
2.47.0

Reply via email to