From c883ee025276822de723109d0039e7c5c8483dc18b7ab1550427e06a2b695bd7 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 11 Nov 2022 17:44:10 +0000 Subject: [PATCH] - Maintenance script qa.sh: * Handle librpm == "" and nolibrpm == "". - Maintenance script qa-remote.sh: * Make "Get remote testsuite results" even more verbose. * Make hardcoded pattern gdb-testresults-12.1-*.*.rpm more generic. * Add missing setting of rpm variable in "Getting rpms" case. - Patches added (backport from trunk): * gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch * powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=340 --- ...gdb.base-break-idempotent.exp-on-ppc.patch | 93 ++++++++++++ gdb.changes | 14 ++ gdb.spec | 4 + ...x-gdb.base-watchpoint.exp-on-power-9.patch | 138 ++++++++++++++++++ qa-remote.sh | 17 ++- qa.sh | 16 +- 6 files changed, 274 insertions(+), 8 deletions(-) create mode 100644 gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch create mode 100644 powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch diff --git a/gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch b/gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch new file mode 100644 index 0000000..48b6350 --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch @@ -0,0 +1,93 @@ +gdb/testsuite: fix gdb.base/break-idempotent.exp on ppc + +When running the gdb.base/break-idempotent.exp test on ppc, I was +seeing some test failures (or rather errors), that looked like this: + + (gdb) watch local + Hardware watchpoint 2: local + + has_hw_wp_support: Hardware watchpoint detected + ERROR: no fileid for gcc2-power8 + ERROR: Couldn't send delete breakpoints to GDB. + ERROR OCCURED: can't read "gdb_spawn_id": no such variable + while executing + "expect { + -i 1000 -timeout 100 + -re ".*A problem internal to GDB has been detected" { + fail "$message (GDB internal error)" + gdb_internal_erro..." + ("uplevel" body line 1) + invoked from within + +What happens is that in break-idempotent.exp we basically do this: + + if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} { + continue + } + + # .... + + if {![skip_hw_watchpoint_tests]} { + test_break $always_inserted "watch" + } + +The problem with this is that skip_hw_watchpoint_tests, includes this: + + if { [istarget "i?86-*-*"] + || [istarget "x86_64-*-*"] + || [istarget "ia64-*-*"] + || [istarget "arm*-*-*"] + || [istarget "aarch64*-*-*"] + || ([istarget "powerpc*-*-linux*"] && [has_hw_wp_support]) + || [istarget "s390*-*-*"] } { + return 0 + } + +For powerpc only we call has_hw_wp_support. This is a caching proc +that runs a test within GDB to detect if we have hardware watchpoint +support or not. + +Unfortunately, to run this test we restart GDB, and when the test has +completed, we exit GDB. This means that in break-idempotent.exp, when +we call skip_hw_watchpoint_tests for the first time on powerpc, GDB +will unexpectedly be exited. When we later call delete_breakpoints we +see the errors I reported above. + +The fix is to call skip_hw_watchpoint_tests early, before we start GDB +as part of the break-idempotent.exp script, and store the result in a +variable, we can then check this variable in the script as needed. + +After this change break-idempotent.exp runs fine on powerpc. + +Co-authored-by: Andrew Burgess + +--- + gdb/testsuite/gdb.base/break-idempotent.exp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp +index 29002f103a8..837ac000b57 100644 +--- a/gdb/testsuite/gdb.base/break-idempotent.exp ++++ b/gdb/testsuite/gdb.base/break-idempotent.exp +@@ -36,6 +36,12 @@ + + standard_testfile + ++# The skip_hw_watchpoint_tests starts GDB on a small test program to ++# check if HW watchpoints are supported. We do not want to restart ++# GDB after this test script has itself started GDB, so call ++# skip_hw_watchpoint_tests first and cache the result. ++set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests] ++ + # Force a breakpoint re-set in GDB. Currently this is done by + # reloading symbols with the "file" command. + +@@ -174,7 +180,7 @@ foreach_with_prefix pie { "nopie" "pie" } { + test_break $always_inserted "hbreak" + } + +- if {![skip_hw_watchpoint_tests]} { ++ if {!$skip_hw_watchpoint_tests_p} { + test_break $always_inserted "watch" + } + diff --git a/gdb.changes b/gdb.changes index 0bb4891..6e5e169 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Fri Nov 11 12:06:44 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Handle librpm == "" and nolibrpm == "". +- Maintenance script qa-remote.sh: + * Make "Get remote testsuite results" even more verbose. + * Make hardcoded pattern gdb-testresults-12.1-*.*.rpm more + generic. + * Add missing setting of rpm variable in "Getting rpms" case. +- Patches added (backport from trunk): + * gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch + * powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch + ------------------------------------------------------------------- Fri Oct 21 08:03:27 UTC 2022 - Tom de Vries diff --git a/gdb.spec b/gdb.spec index edd1b74..1cd794e 100644 --- a/gdb.spec +++ b/gdb.spec @@ -348,6 +348,8 @@ Patch2033: gdb-testsuite-fix-have_mpx-test.patch Patch2034: gdb-testsuite-fix-gdb.dwarf2-dw2-unspecified-type-foo.c-with-m32.patch Patch2035: gdb-add-support-for-readline-8.2.patch Patch2036: gdb-fix-assert-in-handle_jit_event.patch +Patch2037: gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch +Patch2038: powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch # Backports from master, not yet available in next release. @@ -785,6 +787,8 @@ find -name "*.info*"|xargs rm -f %patch2034 -p1 %patch2035 -p1 %patch2036 -p1 +%patch2037 -p1 +%patch2038 -p1 %patch2100 -p1 %patch2101 -p1 diff --git a/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch b/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch new file mode 100644 index 0000000..548908b --- /dev/null +++ b/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch @@ -0,0 +1,138 @@ +PowerPC, fix gdb.base/watchpoint.exp on Power 9 + +Test gdb.base/watchpoint.exp generates 4 test errors on Power 9. The +test uses the test [target_info exists gdb,no_hardware_watchpoints] to +determine if the processor supports hardware watchpoints. The check +only examines the processor type to determine if it supports hardware +watchpoints. + +The PowerPC processors support hardware watchpoints with the +exception of Power 9. The hardware watchpoint support is disabled on +Power 9. The test skip_hw_watchpoint_tests must be used to correctly +determine if the PowerPC processor supports hardware watchpoints. + +This patch replaces the [target_info exists gdb,no_hardware_watchpoints] +with the skip_hw_watchpoint_tests_p check. With the patch, the test runs +on Power 9 with hardware watchpoint force-disabled. The test runs on +all other PowerPC processors with and without hardware watchpoints +enabled. + +The patch has been tested on Power 9 to verify the test only runs with +hardware breakpoints disabled. The patch has been tested on X86-64 with +no regression failures. The test fails on Power 10 due to an internal GDB +error due to resource management. The resource management issue will be +addressed in another patch. + +--- + gdb/testsuite/gdb.base/watchpoint.exp | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp +index 377d3f9ff43..1916cd37cf5 100644 +--- a/gdb/testsuite/gdb.base/watchpoint.exp ++++ b/gdb/testsuite/gdb.base/watchpoint.exp +@@ -15,6 +15,13 @@ + + # This file was written by Fred Fish. (fnf@cygnus.com) + ++# The skip_hw_watchpoint_tests checks if watchpoints are supported by the ++# processor. On PowerPC, the check runs a small test program under gdb ++# to determine if the Power processor supports HW watchpoints. The check ++# must be done before starting the test so as to not disrupt the execution ++# of the actual test. ++ ++set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests] + + standard_testfile + +@@ -628,13 +635,14 @@ proc test_watch_location {} { + proc test_wide_location_1 {} { + global no_hw + global gdb_prompt ++ global skip_hw_watchpoint_tests_p + + # This test watches two words on most 32-bit ABIs, and one word on + # most 64-bit ABIs. + + # Platforms where the target can't watch such a large region + # should clear hw_expected below. +- if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] ++ if { $no_hw || $skip_hw_watchpoint_tests_p + || [istarget arm*-*-*] + || ([istarget powerpc*-*-*] && ![is_lp64_target])} { + set hw_expected 0 +@@ -675,13 +683,14 @@ proc test_wide_location_1 {} { + proc test_wide_location_2 {} { + global no_hw + global gdb_prompt ++ global skip_hw_watchpoint_tests_p + + # This test watches four words on most 32-bit ABIs, and two words + # on 64-bit ABIs. + + # Platforms where the target can't watch such a large region + # should clear hw_expected below. +- if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] ++ if { $no_hw || $skip_hw_watchpoint_tests_p + || [istarget arm*-*-*] + || [istarget powerpc*-*-*]} { + set hw_expected 0 +@@ -798,6 +807,7 @@ proc test_inaccessible_watchpoint {} { + + proc test_no_hw_watchpoints {} { + global testfile ++ global skip_hw_watchpoint_tests_p + + clean_restart $testfile + +@@ -843,7 +853,7 @@ proc test_no_hw_watchpoints {} { + + + # Re-enable hardware watchpoints if necessary. +- if ![target_info exists gdb,no_hardware_watchpoints] { ++ if {!$skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 1" "" + } + } +@@ -895,8 +905,9 @@ proc test_watchpoint_in_big_blob {} { + + proc test_watch_register_location {} { + global no_hw ++ global skip_hw_watchpoint_tests_p + +- if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} { ++ if {!$no_hw && !$skip_hw_watchpoint_tests_p} { + # Non-memory read/access watchpoints are not supported, they would + # require software read/access watchpoint support (which is not + # currently available). +@@ -920,10 +931,11 @@ test_no_hw_watchpoints + proc do_tests {} { + global testfile + global no_hw ++ global skip_hw_watchpoint_tests_p + + clean_restart $testfile + +- if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { ++ if {$no_hw || $skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } + +@@ -942,7 +954,7 @@ proc do_tests {} { + # `initialize' anymore. + clean_restart $testfile + +- if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { ++ if {$no_hw || $skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } + +@@ -979,7 +991,7 @@ proc do_tests {} { + # watchpoints force-disabled. + + do_tests +-if ![target_info exists gdb,no_hardware_watchpoints] { ++if {!$skip_hw_watchpoint_tests_p} { + with_test_prefix "no-hw" { + set no_hw 1 + do_tests diff --git a/qa-remote.sh b/qa-remote.sh index a742319..3a8471f 100644 --- a/qa-remote.sh +++ b/qa-remote.sh @@ -57,20 +57,32 @@ get_item () mkdir -p $dir fi - rpm=$(echo $dir/gdb-testresults-12.1-*.*.rpm) + rpm=$(echo $dir/gdb-testresults-*.*.rpm) rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) - if [ ! -f $rpm ]; then + rpm=$(basename $rpm) + if [ "$rpm" = "" ] || [ ! -f "$rpm" ]; then + echo "Getting rpms" osc getbinaries -q -M testsuite -d $dir $c $arch + rpm=$(echo $dir/gdb-testresults-*.rpm) + rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) + rpm=$(basename $rpm) + echo "Got rpm: $rpm" + else + echo "Already have rpm: $rpm" fi if [ ! -d $pkgs/gdb-testresults.$c.$arch ]; then ( + echo "Extracting rpm: $rpm" cd $dir extract $rpm ) + else + echo "Already extracted rpm: $rpm" fi if [ -d $dir/usr/share/doc/packages/gdb-testresults ]; then + echo "Renaming" mkdir $root/binaries-testsuite.$c.$arch mv \ $dir/usr/share/doc/packages/gdb-testresults \ @@ -78,6 +90,7 @@ get_item () fi if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + echo "Cleaning up" rm -Rf $dir fi } diff --git a/qa.sh b/qa.sh index 1a25b2a..4d20f29 100644 --- a/qa.sh +++ b/qa.sh @@ -546,12 +546,16 @@ case $n in | grep -v SLE-11) nolibrpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \ | grep SLE-11) - grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \ - $librpm \ - | grep -E -v ":1" - grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \ - $nolibrpm \ - | grep -E -v ":1" + if [ "$librpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \ + $librpm \ + | grep -E -v ":1" + fi + if [ "$nolibrpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \ + $nolibrpm \ + | grep -E -v ":1" + fi ;; -local)