public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported
@ 2019-09-22  4:14 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-09-22  4:14 UTC (permalink / raw)
  To: gdb-cvs

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

commit 77d036789aab73c90dc7f4c798f34748b03de726
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Sep 22 06:14:29 2019 +0200

    [gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported
    
    We currently run into:
    ...
    248       n = callee1 (n + l5);
    (gdb) PASS: gdb.base/restore.exp: caller5 calls callee1; return callee now
    print l1
    $51 = <optimized out>
    (gdb) FAIL: gdb.base/restore.exp: caller5 calls callee1; return restored l1 \
      to 32492
    ...
    
    The problem is that we try to access the value of l1 in function caller5, but
    variable l1 has no DW_AT_location attribute.  Since l1 is declared using the
    register keyword, it's valid for gcc to emit no DW_AT_location at -O0.
    
    Change the FAIL into an UNSUPPORTED.
    
    Tested on x86_64-linux.
    
    gdb/testsuite/ChangeLog:
    
    2019-09-22  Tom de Vries  <tdevries@suse.de>
    
    	* gdb.base/restore.exp: Allow register variables to be optimized out at
    	-O0.

Diff:
---
 gdb/testsuite/ChangeLog            |  5 +++++
 gdb/testsuite/gdb.base/restore.exp | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 64c7d38..37e323f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-22  Tom de Vries  <tdevries@suse.de>
+
+	* gdb.base/restore.exp: Allow register variables to be optimized out at
+	-O0.
+
 2019-09-20  Ulrich Weigand  <uweigand@de.ibm.com>
 
 	* gdb.arch/spu-info.exp: Remove file.
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index 947fe58..56c2f5e 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -73,8 +73,17 @@ proc restore_tests { } {
 	    # they should be.
             for {set var 1} {$var <= $c} {incr var} {
                 set expected [expr 0x7eeb + $var]
-	        gdb_test "print l$var" " = $expected" \
-		    "caller$c calls callee$e; return restored l$var to $expected"
+		set test "caller$c calls callee$e; return restored l$var to $expected"
+		set pass_pattern " = $expected"
+		set unsupported_pattern " = <optimized out>"
+	        gdb_test_multiple "print l$var" $test {
+		    -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+			pass $test
+		    }
+		    -re "\[\r\n\]*(?:$unsupported_pattern)\[\r\n\]+$gdb_prompt $" {
+			unsupported $test
+		    }
+		}
             }
         }
     }


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

only message in thread, other threads:[~2019-09-22  4:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22  4:14 [binutils-gdb] [gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported 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).