public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp
@ 2021-09-21 10:07 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-09-21 10:07 UTC (permalink / raw)
  To: gdb-patches

Hi,

In test-case gdb.base/gdb-caching-proc.exp, we run all procs declared with
gdb_caching_proc.  Some of these require a gdb instance, some not.

We could just do a clean_restart every time, but that would amount to 44 gdb
restarts.  We try to minimize this by doing this only for the few procs that
need it, and hardcoding those in the test-case.

For those procs, we do a clean_restart, execute the proc, and then do a
gdb_exit, to make sure the gdb instance doesn't linger such that we detect
procs that need a gdb instance but are not listed in the test-case.

However, that doesn't work in the case of gnat_runtime_has_debug_info.  This
proc doesn't require a gdb instance because it starts its own.  But it doesn't
clean up the gdb instance, and since it's not listed, the test-case
doesn't clean up the gdb instance eiter.  Consequently, the proc
supports_memtag (which should be listed, but isn't) uses the gdb instance
started by gnat_runtime_has_debug_info rather than throwing an error.  Well,
unless gnat_runtime_has_debug_info fails before starting a gdb instance, in
which case we do run into the error.

Fix this by:
- doing gdb_exit unconditionally
- fixing the resulting error by adding supports_memtag in the test-case to
  the "needing gdb instance" list

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp

---
 gdb/testsuite/gdb.base/gdb-caching-proc.exp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/gdb-caching-proc.exp b/gdb/testsuite/gdb.base/gdb-caching-proc.exp
index 82675dfc061..a3f08f5db32 100644
--- a/gdb/testsuite/gdb.base/gdb-caching-proc.exp
+++ b/gdb/testsuite/gdb.base/gdb-caching-proc.exp
@@ -85,6 +85,7 @@ proc test_file { file } {
 	    switch $procname {
 		"is_address_zero_readable" { set setup_gdb 1 }
 		"target_is_gdbserver" { set setup_gdb 1 }
+		"supports_memtag" { set setup_gdb 1 }
 		default {set setup_gdb 0 }
 	    }
 
@@ -94,9 +95,7 @@ proc test_file { file } {
 
 	    test_proc $procname
 
-	    if { $setup_gdb } {
-		gdb_exit
-	    }
+	    gdb_exit
 	}
     }
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-21 10:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 10:07 [committed][gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp 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).