diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/store.exp | 65 |
2 files changed, 50 insertions, 20 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index bf3fcc7..7352e9f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-12 Tom de Vries <tdevries@suse.de> + + * gdb.base/store.exp: Allow register variables to be optimized out at + -O0. + 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.ada/rdv_wait.exp: Update to new task names. diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp index c5a7584..9c19ce1 100644 --- a/gdb/testsuite/gdb.base/store.exp +++ b/gdb/testsuite/gdb.base/store.exp @@ -55,18 +55,29 @@ proc check_set { t l r new add } { } } - gdb_test "print l" " = ${l}" \ - "${prefix}; print old l, expecting ${l}" - gdb_test "print r" " = ${r}" \ - "${prefix}; print old r, expecting ${r}" - gdb_test_no_output "set variable l = 4" \ - "${prefix}; setting l to 4" - gdb_test "print l" " = ${new}" \ - "${prefix}; print new l, expecting ${new}" - gdb_test "next" "return l \\+ r;" \ - "${prefix}; next over add call" - gdb_test "print l" " = ${add}" \ - "${prefix}; print incremented l, expecting ${add}" + set supported 1 + set test "${prefix}; print old l, expecting ${l}" + gdb_test_multiple "print l" "$test" { + -re " = <optimized out>\r\n$gdb_prompt $" { + unsupported $test + set supported 0 + } + -re " = ${l}\r\n$gdb_prompt $" { + pass $test + } + } + if { $supported } { + gdb_test "print r" " = ${r}" \ + "${prefix}; print old r, expecting ${r}" + gdb_test_no_output "set variable l = 4" \ + "${prefix}; setting l to 4" + gdb_test "print l" " = ${new}" \ + "${prefix}; print new l, expecting ${new}" + gdb_test "next" "return l \\+ r;" \ + "${prefix}; next over add call" + gdb_test "print l" " = ${add}" \ + "${prefix}; print incremented l, expecting ${add}" + } } check_set "charest" "-1 .*" "-2 .*" "4 ..004." "2 ..002." @@ -81,20 +92,34 @@ check_set "doublest" "-1" "-2" "4" "2" # proc up_set { t l r new } { + global gdb_prompt + set prefix "upvar ${t} l" gdb_test "tbreak add_${t}" gdb_test "continue" "return u . v;" \ "continue to add_${t}" gdb_test "up" "l = add_${t} .l, r.;" \ "${prefix}; up" - gdb_test "print l" " = ${l}" \ - "${prefix}; print old l, expecting ${l}" - gdb_test "print r" " = ${r}" \ - "${prefix}; print old r, expecting ${r}" - gdb_test_no_output "set variable l = 4" \ - "${prefix}; set l to 4" - gdb_test "print l" " = ${new}" \ - "${prefix}; print new l, expecting ${new}" + + set supported 1 + set test "${prefix}; print old l, expecting ${l}" + gdb_test_multiple "print l" "$test" { + -re " = <optimized out>\r\n$gdb_prompt $" { + unsupported $test + set supported 0 + } + -re " = ${l}\r\n$gdb_prompt $" { + pass $test + } + } + if { $supported } { + gdb_test "print r" " = ${r}" \ + "${prefix}; print old r, expecting ${r}" + gdb_test_no_output "set variable l = 4" \ + "${prefix}; set l to 4" + gdb_test "print l" " = ${new}" \ + "${prefix}; print new l, expecting ${new}" + } } up_set "charest" "-1 .*" "-2 .*" "4 ..004." |