Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gdb for openSUSE:Factory checked in at 2021-12-01 20:46:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gdb (Old) and /work/SRC/openSUSE:Factory/.gdb.new.31177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gdb" Wed Dec 1 20:46:24 2021 rev:157 rq:934734 version:11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/gdb/gdb.changes 2021-11-06 18:14:04.968761432 +0100 +++ /work/SRC/openSUSE:Factory/.gdb.new.31177/gdb.changes 2021-12-02 02:12:31.279162780 +0100 @@ -1,0 +2,164 @@ +Tue Nov 30 10:45:32 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patches added (swo#27028, swo#27257): + * gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch + * gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch + +------------------------------------------------------------------- +Fri Nov 26 14:04:38 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patch added (swo#28539, bsc#1192285): + * gdb-symtab-fix-segfault-in-search_one_symtab.patch + +------------------------------------------------------------------- +Mon Nov 22 19:40:55 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patches removed: + * gdb-testsuite-debug-gdb.arch-i386-sse.exp.patch + +------------------------------------------------------------------- +Mon Nov 22 17:47:57 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Maintenance script qa.sh: + - Drop openSUSE Leap 15.1. + - Add KFAILs for PR28617. + +------------------------------------------------------------------- +Mon Nov 22 09:25:32 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Fix SLE-12 x86_64 unresolvable by removing BuildRequire gcc-java. + +------------------------------------------------------------------- +Mon Nov 22 09:00:45 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Fix openSUSE_Factory_ARM armv7l unresolvable by not doing + BuildRequire babeltrace-devel. + +------------------------------------------------------------------- + +Mon Nov 22 08:24:21 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Fix SLE-12 x86_64 unresolvable by not doing BuildRequire + babeltrace-devel. + +------------------------------------------------------------------- +Fri Nov 19 15:31:46 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patches added (backport from master): + * gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch +- Add BuildRequire libsource-highlight. + +------------------------------------------------------------------- +Thu Nov 18 14:01:30 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Maintenance script qa.sh: + - Add KFAIL. +- Patches updated (increase sleep time): + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch +- Patches added (debug hard to reproduce failure): + * gdb-testsuite-debug-gdb.arch-i386-sse.exp.patch + +------------------------------------------------------------------- +Thu Nov 18 11:45:00 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Maintenance script qa.sh: + - Add internal-error KFAILs. + - Rewrite gdb.suse check to distinguish between: + "zypper hint printed (librpm)" and + "zypper hint printed (no librpm)". + +------------------------------------------------------------------- +Tue Nov 16 15:50:08 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patch updated (zypper hint doesn't use librpm on SLE-11): + * gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch + +------------------------------------------------------------------- +Thu Nov 11 10:36:08 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patches added (backports from trunk): + * gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch + * gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch + * gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch + * gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch + * gdb-doc-fix-print-inferior-events-default.patch + * gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch + * gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch + * gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch + * gdb-exp-improve-error-reading-variable-message.patch + * fix-gdb.base-sigstep.exp-test-for-ppc.patch + * gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch +- Patches added (backports from ml): + * gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch +- Maintenance script qa.sh: + - Add -m32/-pie to known clean configs. + - Add kfail for PR28467. + +------------------------------------------------------------------- +Tue Nov 9 15:54:58 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Fix empty patch: + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch + +------------------------------------------------------------------- +Tue Nov 9 08:05:16 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Limit SLE extra targets to SLE targets. +- Add avr-elf and pru-elf to openSUSE extra targets. + +------------------------------------------------------------------- +Mon Nov 8 14:53:20 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Maintenance script qa.sh: + * Add note. + * Add KFAIL, improve KFAIL patterns. +- Patch updated: + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch + +------------------------------------------------------------------- +Sat Nov 6 09:25:28 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Replace patch (patch from mailing list, fix SLE-11 apply failure): + * gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch + with (now backported from release branch): + * aarch64-make-gdbserver-register-set-selection-dynamic.patch +- Patches added: + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch +- Patches dropped: + * gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch +- Replace patch: + * gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch + with (updated version, and patchname now generated by + import-patches.sh): + * gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch +- Maintenance script import-patches.sh: + * Improve argument checking. + * Add usage. + * Use filterdiff to filter out ChangeLog entries. +- Maintenance script qa.sh: + * Fix usage. + * Document todo. + +------------------------------------------------------------------- +Fri Nov 5 23:04:35 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Re-enable big endian powerpc, but keep testing disabled. +- Add KFAIL for PR28553. + +------------------------------------------------------------------- +Fri Nov 5 19:15:43 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Patch added (move zypper hint test to testsuite): + * gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch + +------------------------------------------------------------------- +Fri Nov 5 15:21:03 UTC 2021 - Tom de Vries <tdevr...@suse.com> + +- Maintenance script qa.sh: + * Add PR28551 KFAIL. + * Add missing quotes for some KFAILs. + * Remove PR28355 KFAIL. + +------------------------------------------------------------------- Old: ---- gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch New: ---- aarch64-make-gdbserver-register-set-selection-dynamic.patch fix-gdb.base-sigstep.exp-test-for-ppc.patch gdb-doc-fix-print-inferior-events-default.patch gdb-exp-improve-error-reading-variable-message.patch gdb-symtab-fix-segfault-in-search_one_symtab.patch gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gdb.spec ++++++ --- /var/tmp/diff_new_pack.wOBhte/_old 2021-12-02 02:12:33.675155472 +0100 +++ /var/tmp/diff_new_pack.wOBhte/_new 2021-12-02 02:12:33.675155472 +0100 @@ -1,5 +1,5 @@ # -# spec file +# spec file for package gdb # # Copyright (c) 2021 SUSE LLC # Copyright (c) 2012 RedHat @@ -29,6 +29,10 @@ # In a qemu_user_space_build ptrace is not supported, so we can't test gdb. ExclusiveArch: do_not_build %endif + +# Disable big-endian ppc testing. +ExcludeArch: ppc ppc64 + %define build_main 0 %define build_testsuite 1 %else @@ -54,7 +58,7 @@ %if %{build_main} Summary: A GNU source-level debugger for C, C++, Fortran and other languages -License: GPL-3.0-only WITH GCC-exception-3.1 AND GPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later +License: SUSE-Public-Domain Group: Development/Languages/C and C++ %endif %if %{build_testsuite} @@ -273,6 +277,8 @@ # It would be nice to upstream this, but in order to do that I'd like to have # an explanation of why this happens, so for now, park this here. Patch1102: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch +# Tests the zypper install hints. +Patch1103: gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch # Patches to upstream @@ -299,6 +305,7 @@ Patch1900: gdb-build-add-cxx_dialect-to-cxx.patch Patch1901: gdb-tui-fix-breakpoint-display-functionality.patch +Patch1902: aarch64-make-gdbserver-register-set-selection-dynamic.patch # Backports from master, available in next release. @@ -325,6 +332,18 @@ Patch2020: gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch Patch2021: gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch Patch2022: gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch +Patch2023: gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch +Patch2024: gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch +Patch2025: gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch +Patch2026: gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch +Patch2027: gdb-doc-fix-print-inferior-events-default.patch +Patch2028: gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch +Patch2029: gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch +Patch2030: gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch +Patch2031: gdb-exp-improve-error-reading-variable-message.patch +Patch2032: fix-gdb.base-sigstep.exp-test-for-ppc.patch +Patch2033: gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch +Patch2034: gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch # Backports from master, not yet available in next release. @@ -350,18 +369,26 @@ Patch2107: gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182855.html Patch2108: gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182857.html -Patch2109: gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182868.html -Patch2110: gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch -#https://sourceware.org/pipermail/gdb-patches/2021-October/182919.html +Patch2110: gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182919.html Patch2111: gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch -#https://sourceware.org/pipermail/gdb-patches/2021-October/182921.html +# https://sourceware.org/pipermail/gdb-patches/2021-October/182921.html Patch2112: gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/182985.html -Patch2113: gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch # https://sourceware.org/pipermail/gdb-patches/2021-May/178990.html Patch2114: gdb-cli-add-ignore-errors-command.patch +# https://sourceware.org/pipermail/gdb-patches/2021-November/183183.html +Patch2115: gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182887.html +Patch2116: gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-November/date.html +Patch2117: gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-November/183363.html +Patch2118: gdb-symtab-fix-segfault-in-search_one_symtab.patch +# https://sourceware.org/pipermail/gdb-patches/2021-November/183939.html +Patch2119: gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch +# https://sourceware.org/pipermail/gdb-patches/2021-November/183960.html +Patch2120: gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch BuildRequires: bison BuildRequires: flex @@ -426,26 +453,21 @@ ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x %endif # 0%{?el5:1} -# Disable big-endian ppc. -ExcludeArch: ppc ppc64 - %ifarch s390x %if %{suse_version} > 1500 BuildRequires: babeltrace-devel %endif %endif -%ifarch ppc64 + +%ifarch i386 x86_64 ppc64 ppc64le aarch64 riscv64 %if %{suse_version} >= 1500 BuildRequires: babeltrace-devel %endif %endif -%ifarch %{ix86} x86_64 -%if %{suse_version} >= 1200 -BuildRequires: babeltrace-devel -%endif -%endif -%ifarch aarch64 riscv64 -BuildRequires: babeltrace-devel + +%if 0%{?suse_version} >= 1500 +BuildRequires: libboost_regex-devel +BuildRequires: libsource-highlight-devel %endif %if %{build_testsuite} @@ -484,9 +506,6 @@ BuildRequires: sharutils # gcc-objc++ is not covered by the GDB testsuite. BuildRequires: %{gcc}-fortran -%if 0%{?gcc_version} < 7 && 0%{suse_version} > 1110 -BuildRequires: %{gcc}-java -%endif BuildRequires: %{gcc}-objc %ifarch %ada_arch BuildRequires: %{gcc}-ada @@ -728,6 +747,7 @@ %patch1100 -p1 %patch1101 -p1 %patch1102 -p1 +%patch1103 -p1 %patch1500 -p1 %patch1501 -p1 @@ -738,6 +758,7 @@ %patch1900 -p1 %patch1901 -p1 +%patch1902 -p1 %patch2000 -p1 %patch2001 -p1 @@ -762,6 +783,18 @@ %patch2020 -p1 %patch2021 -p1 %patch2022 -p1 +%patch2023 -p1 +%patch2024 -p1 +%patch2025 -p1 +%patch2026 -p1 +%patch2027 -p1 +%patch2028 -p1 +%patch2029 -p1 +%patch2030 -p1 +%patch2031 -p1 +%patch2032 -p1 +%patch2033 -p1 +%patch2034 -p1 %patch2100 -p1 %patch2101 -p1 @@ -772,12 +805,16 @@ %patch2106 -p1 %patch2107 -p1 %patch2108 -p1 -%patch2109 -p1 %patch2110 -p1 %patch2111 -p1 %patch2112 -p1 -%patch2113 -p1 %patch2114 -p1 +%patch2115 -p1 +%patch2116 -p1 +%patch2117 -p1 +%patch2118 -p1 +%patch2119 -p1 +%patch2120 -p1 #unpack libipt %if 0%{have_libipt} @@ -875,11 +912,24 @@ %else %define build_multitarget 0 %endif -%define target_list i686 powerpc powerpc64 powerpc64le s390 s390x x86_64 arm aarch64 m68k ia64 riscv64 + +%define extra_target_list_common i686 powerpc64le s390x x86_64 aarch64 +%if 0%{?is_opensuse} +%define extra_target_list %{extra_target_list_common} powerpc powerpc64 s390 arm m68k ia64 riscv64 +%define have_elf_extra_target_list 1 +%define elf_extra_target_list avr pru spu +%else +%define extra_target_list %{extra_target_list_common} +%define have_elf_extra_target_list 0 +%endif + %define DIST %(echo '%distribution' | sed 's, /.*,,') + %if %build_multitarget -EXTRA_TARGETS="%(printf ,%%s-suse-linux %target_list)" -EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf" +EXTRA_TARGETS="%(printf ,%%s-suse-linux %{extra_target_list})" +%if %{have_elf_extra_target_list} +EXTRA_TARGETS="$EXTRA_TARGETS%(printf ,%%s-elf %{elf_extra_target_list})" +%endif %else EXTRA_TARGETS= %endif @@ -1012,74 +1062,6 @@ cd .. fi -# This is a build-time test, but still a test. So, skip if we don't do tests. -# This is relevant for %%qemu_user_space_build == 1 builds, which atm is -# the case for riscv64. -%if %{build_testsuite} -if [ "$LIBRPM" != "no" ]; then - cd gdb - cat \ - > hello.c \ - <<EOF -#include <stdio.h> -int -main (void) -{ - printf ("hello\n"); - return 0; -} -EOF - $CC hello.c - libc=$(ldd a.out \ - | grep libc.so \ - | awk '{print $3}') - if readelf -SW $libc \ - | grep -q "\.gnu_debuglink"; then - cat \ - > test.exp \ - <<EOF -expect { - "(gdb) " { - puts "\nPASS: first prompt" - send "start\n" - } - default { - puts "\nFAIL: first prompt (eof or timeout)" - exit 1 - } -} -expect { - -re {Missing separate debuginfos, use: zypper install glibc-debuginfo-.*\(gdb\) } { - puts "\nPASS: zypper install message" - send "quit\n" - exit 0 - } - "(gdb) " { - puts "\nFAIL: zypper install message" - send "quit\n" - exit 1 - } - default { - puts "\nFAIL: zypper install message (eof or timeout)" - exit 1 - } -} -EOF - gdb="./gdb -q -nw -nx -data-directory $(pwd -P)/data-directory" - # Due to bsc#1146899 "gdb's zypper install message disappears with - # -batch", we need to use an expect test. - expect -c "spawn $gdb ./a.out" -f test.exp - rm ./test.exp - else - # If packages are not build with debuginfo, we cannot expect a zypper - # install message. - echo "UNSUPPORTED: zypper install message" - fi - rm ./hello.c ./a.out - cd .. -fi -%endif - cd .. done # fprofile ++++++ gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch -> aarch64-make-gdbserver-register-set-selection-dynamic.patch ++++++ --- /work/SRC/openSUSE:Factory/gdb/gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch 2021-11-06 18:14:04.932761414 +0100 +++ /work/SRC/openSUSE:Factory/.gdb.new.31177/aarch64-make-gdbserver-register-set-selection-dynamic.patch 2021-12-02 02:12:30.919163878 +0100 @@ -1,11 +1,53 @@ -@@ -, +, @@ +[AArch64] Make gdbserver register set selection dynamic + +The current register set selection mechanism for AArch64 is static, based +on a pre-populated array of register sets. + +This means that we might potentially probe register sets that are not +available. This is OK if the kernel errors out during ptrace, but probing the +tag_ctl register, for example, does not result in a ptrace error if the kernel +supports the tagged address ABI but not MTE (PR 28355). + +Making the register set selection dynamic, based on feature checks, solves +this and simplifies the code a bit. It allows us to list all of the register +sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties. + +gdb/ChangeLog: + +2021-11-03 Luis Machado <luis.mach...@linaro.org> + + PR gdb/28355 + + * arch/aarch64.h (struct aarch64_features): New struct. + +gdbserver/ChangeLog: + +2021-11-03 Luis Machado <luis.mach...@linaro.org> + + PR gdb/28355 + + * linux-aarch64-low.cc (is_sve_tdesc): Remove. + (aarch64_target::low_arch_setup): Rework to adjust the register sets. + (aarch64_regsets): Update to list all register sets. + (aarch64_regsets_info, regs_info_aarch64): Replace NULL with nullptr. + (aarch64_sve_regsets, aarch64_sve_regsets_info) + (regs_info_aarch64_sve): Remove. + (aarch64_adjust_register_sets): New. + (aarch64_target::get_regs_info): Remove references to removed structs. + (initialize_low_arch): Likewise. + --- + gdb/ChangeLog | 6 ++ gdb/arch/aarch64.h | 9 ++ - gdbserver/linux-aarch64-low.cc | 185 ++++++++++++++++++--------------- - 2 files changed, 110 insertions(+), 84 deletions(-) ---- a/gdb/arch/aarch64.h -+++ a/gdb/arch/aarch64.h -@@ -22,6 +22,15 @@ + gdbserver/ChangeLog | 14 ++++ + gdbserver/linux-aarch64-low.cc | 186 ++++++++++++++++++++++------------------- + 4 files changed, 130 insertions(+), 85 deletions(-) + +diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h +index 0eb702c5b5e..95edb664b55 100644 +--- a/gdb/arch/aarch64.h ++++ b/gdb/arch/aarch64.h +@@ -22,6 +22,15 @@ #include "gdbsupport/tdesc.h" @@ -21,8 +63,10 @@ /* Create the aarch64 target description. A non zero VQ value indicates both the presence of SVE and the Vector Quotient - the number of 128bit chunks in an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH ---- a/gdbserver/linux-aarch64-low.cc -+++ a/gdbserver/linux-aarch64-low.cc +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index daccfef746e..9a8cb4169a7 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc @@ -196,16 +196,6 @@ is_64bit_tdesc (void) return register_size (regcache->tdesc, 0) == 8; } @@ -81,7 +125,7 @@ /* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */ static void -@@ -730,20 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf) +@@ -730,21 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf) return aarch64_sve_regs_copy_from_reg_buf (regcache, buf); } @@ -91,7 +135,6 @@ + + Their sizes are set to 0 here, but they will be adjusted later depending + on whether each register set is available or not. */ -+ static struct regset_info aarch64_regsets[] = { + /* GPR registers. */ @@ -119,11 +162,13 @@ + /* Tagged address control / MTE registers. */ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, - AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset, -+ 0, OPTIONAL_REGS, aarch64_fill_mteregset, - aarch64_store_mteregset }, +- aarch64_store_mteregset }, ++ 0, OPTIONAL_REGS, ++ aarch64_fill_mteregset, aarch64_store_mteregset }, NULL_REGSET }; -@@ -752,47 +724,95 @@ static struct regsets_info aarch64_regsets_info = + +@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info = { aarch64_regsets, /* regsets */ 0, /* num_regsets */ @@ -232,7 +277,7 @@ + features.sve = (vq > 0); + /* A-profile PAC is 64-bit only. */ + features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA; -+ /* A-profile MTE is AArch64-only. */ ++ /* A-profile MTE is 64-bit only. */ + features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE; + + current_process ()->tdesc @@ -250,7 +295,7 @@ /* Implementation of linux target ops method "get_regs_info". */ -@@ -802,9 +822,7 @@ aarch64_target::get_regs_info () +@@ -802,9 +821,7 @@ aarch64_target::get_regs_info () if (!is_64bit_tdesc ()) return ®s_info_aarch32; @@ -261,10 +306,9 @@ return ®s_info_aarch64; } -@@ -3294,5 +3312,4 @@ initialize_low_arch (void) +@@ -3294,5 +3311,4 @@ initialize_low_arch (void) initialize_low_arch_aarch32 (); initialize_regsets_info (&aarch64_regsets_info); - initialize_regsets_info (&aarch64_sve_regsets_info); } --- ++++++ fix-gdb.base-sigstep.exp-test-for-ppc.patch ++++++ Fix gdb.base/sigstep.exp test for ppc The test stops at <signal_handler called> which is the call to the handler rather than in the handler as intended. This patch replaces the gdb_test "$enter_cmd to handler" with a gdb_test_multiple test. The multiple test looks for the stop at <signal_handler called>. If found, the command is issued again. The test passes if gdb stops in the handler as expected. (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step from handler: continue to signal stepi <signal handler called> 1: x/i $pc => 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>: bctrl (gdb) stepi handler (sig=551) at sigstep.c:32 32 { 1: x/i $pc => 0x10000097c <handler>: addis r2,r12,2 (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step from handler: stepi to handler Patch has been tested on x86_64-linux and ppc64le-linux with no test failures. --- gdb/testsuite/gdb.base/sigstep.exp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp index ea254af5297..176918b67d6 100644 --- a/gdb/testsuite/gdb.base/sigstep.exp +++ b/gdb/testsuite/gdb.base/sigstep.exp @@ -79,6 +79,7 @@ validate_backtrace proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { global gdb_prompt inferior_exited_re global clear_done other_handler_location + global decimal set prefix "$enter_cmd to handler, $in_handler_prefix in handler, $exit_cmd from handler" @@ -93,7 +94,16 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { gdb_test "handle SIGVTALRM print pass stop" gdb_test "continue" "Program received signal.*" "continue to signal" } - gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler" + + gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" { + -re -wrap "\r\n<signal handler called>.*" { + send_gdb "$enter_cmd\n" + exp_continue + } + -re -wrap "\r\n(Breakpoint $decimal, )?handler \\(sig=.*" { + pass $gdb_test_name + } + } delete_breakpoints ++++++ gdb-doc-fix-print-inferior-events-default.patch ++++++ [gdb/doc] Fix print inferior-events default In the docs about print inferior-events we read: ... By default, these messages will not be printed. ... That used to be the case, but is no longer so since commit f67c0c91715 "Enable 'set print inferior-events' and improve detach/fork/kill/exit messages". Fix this by updating the docs. --- gdb/doc/gdb.texinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 1700b0305c5..d53c9a03704 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3395,7 +3395,7 @@ control use @w{@code{set print inferior-events}}: The @code{set print inferior-events} command allows you to enable or disable printing of messages when @value{GDBN} notices that new inferiors have started or that inferiors have exited or have been -detached. By default, these messages will not be printed. +detached. By default, these messages will be printed. @kindex show print inferior-events @item show print inferior-events ++++++ gdb-exp-improve-error-reading-variable-message.patch ++++++ [gdb/exp] Improve <error reading variable> message When printing a variable x in a subroutine foo: ... subroutine foo (x) integer(4) :: x (*) x(3) = 1 end subroutine foo ... where x is an array with unknown bounds, we get: ... $ gdb -q -batch outputs/gdb.fortran/array-no-bounds/array-no-bounds \ -ex "break foo" \ -ex run \ -ex "print x" Breakpoint 1 at 0x4005cf: file array-no-bounds.f90, line 18. Breakpoint 1, foo (x=...) at array-no-bounds.f90:18 18 x(3) = 1 $1 = <error reading variable> ... Improve the error message by printing the details of the error, such that we have instead: ... $1 = <error reading variable: failed to get range bounds> ... This is a change in gdb/valprint.c, and grepping through the sources reveals that this is a common pattern. Tested on x86_64-linux. --- gdb/testsuite/gdb.fortran/array-no-bounds.exp | 44 +++++++++++++++++++++++++++ gdb/testsuite/gdb.fortran/array-no-bounds.f90 | 30 ++++++++++++++++++ gdb/valprint.c | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.exp b/gdb/testsuite/gdb.fortran/array-no-bounds.exp new file mode 100644 index 00000000000..a686232cb0e --- /dev/null +++ b/gdb/testsuite/gdb.fortran/array-no-bounds.exp @@ -0,0 +1,44 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file is part of the gdb testsuite. It contains test to ensure that +# array bounds accept LONGEST. + +if { [skip_fortran_tests] } { return -1 } + +standard_testfile .f90 +load_lib fortran.exp + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ + {f90 debug}] } { + return -1 +} + +if { ![fortran_runto_main] } { + perror "Could not run to main." + continue +} + +# Go to foo. +gdb_breakpoint foo +gdb_continue_to_breakpoint "foo" + +# Print x, and check that we get a useful error message. +gdb_test "p x" \ + " = <error reading variable: failed to get range bounds>" + +# Print x using @ syntax. +gdb_test "p x(1)@5" \ + " = \\(0, 0, 0, 0, 0\\)" diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.f90 b/gdb/testsuite/gdb.fortran/array-no-bounds.f90 new file mode 100644 index 00000000000..7b9ca998fff --- /dev/null +++ b/gdb/testsuite/gdb.fortran/array-no-bounds.f90 @@ -0,0 +1,30 @@ +! Copyright 2021 Free Software Foundation, Inc. + +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see <http://www.gnu.org/licenses/>. + +subroutine foo (x) + integer(4) :: x (*) + x(3) = 1 +end subroutine foo + +program test + interface + subroutine foo (x) + integer(4) :: x (*) + end subroutine + end interface + integer(4) :: x (5) + x(:) = 0 + call foo (x) +end program diff --git a/gdb/valprint.c b/gdb/valprint.c index 324055da93f..05740c838ad 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1050,7 +1050,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse, catch (const gdb_exception_error &except) { fprintf_styled (stream, metadata_style.style (), - _("<error reading variable>")); + _("<error reading variable: %s>"), except.what ()); } } ++++++ gdb-symtab-fix-segfault-in-search_one_symtab.patch ++++++ [gdb/symtab] Fix segfault in search_one_symtab PR28539 describes a segfault in lambda function search_one_symtab due to psymbol_functions::expand_symtabs_matching calling expansion_notify with a nullptr symtab: ... struct compunit_symtab *symtab = psymtab_to_symtab (objfile, ps); if (expansion_notify != NULL) if (!expansion_notify (symtab)) return false; ... This happens as follows. The partial symtab ps is a dwarf2_include_psymtab for some header file: ... (gdb) p ps.filename $5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h" ... The includer of ps is a shared symtab for a partial unit, with as user: ... (gdb) p ps.includer().user.filename $11 = 0x64fc9f0 \ "/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp" ... The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently the shared symtab), but returns nullptr because: ... struct dwarf2_include_psymtab : public partial_symtab { ... compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override { return nullptr; } ... Fix this by returning the Decl.cpp symtab instead, which fixes the segfault in the PR. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539 --- gdb/dwarf2/read.c | 5 +- .../gdb.dwarf2/dw2-symtab-includes-lookup.exp | 101 +++++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e73c0855fc1..ea6c6344247 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5756,7 +5756,10 @@ struct dwarf2_include_psymtab : public partial_symtab compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override { - return nullptr; + compunit_symtab *cust = includer ()->get_compunit_symtab (objfile); + while (cust != nullptr && cust->user != nullptr) + cust = cust->user; + return cust; } private: diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp new file mode 100644 index 00000000000..7228f85c9bb --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp @@ -0,0 +1,101 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Lookup a type in a partial unit with DW_AT_stmt_list. +# +# The test-case is setup such that the partial symtab expansion route is +# .h partial symtab -> shared partial symtab -> toplevel symtab. +# +# That is, the partial symtabs (as displayed by maint print objfiles) are: +# +# ../sysdeps/x86_64/crtn.S at 0x3d944e0^M +# elf-init.c at 0x3d94440^M +# dw2-symtab-includes.h at 0x3d7c7a0^M +# <unknown> at 0x31ef870^M +# bla.c at 0x33985f0^M +# ../sysdeps/x86_64/crti.S at 0x33e9a00^M +# init.c at 0x33fa600^M +# ../sysdeps/x86_64/start.S at 0x33f3fd0^M +# +# and the expansion of dw2-symtab-includes.h triggers the expansion of its +# includer <unknown>, which triggers expansion of user bla.c. +# +# The problem in PR28539 was that after expansion of dw2-symtab-includes.h +# the expansion_notify function in psymbol_functions::expand_symtabs_matching +# should be called with the bla.c symtab, but instead it got called with +# nullptr, which caused a segfault. + +load_lib dwarf.exp + +# This test can only be run on targets which support DWARF-2 and use gas. +if {![dwarf2_support]} { + return 0 +} + +standard_testfile main.c .S + +# Create the DWARF. +set asm_file [standard_output_file $srcfile2] +Dwarf::assemble $asm_file { + declare_labels partial_label lines_label + global srcdir subdir srcfile + + cu {} { + partial_label: partial_unit { + {stmt_list ${lines_label} DW_FORM_sec_offset} + } { + DW_TAG_base_type { + {DW_AT_byte_size 4 DW_FORM_sdata} + {DW_AT_encoding @DW_ATE_signed} + {DW_AT_name myint} + } + } + } + + cu {} { + compile_unit { + {language @DW_LANG_C} + {DW_AT_name bla.c} + } { + imported_unit { + {import $partial_label ref_addr} + } + } + } + + lines {version 2} lines_label { + include_dir "${srcdir}/${subdir}" + file_name "dw2-symtab-includes.h" 1 + program { + {DW_LNS_advance_line 1} + } + } +} + +if { [prepare_for_testing "failed to prepare" $testfile \ + "${asm_file} ${srcfile}" {}] } { + return -1 +} + +# Check that no symtabs are expanded. +set test "no symtabs expanded" +if { [readnow] } { + unsupported $test + return -1 +} +gdb_test_no_output "maint info symtabs" $test + +# Lookup myint. Regression test for PR28539. +gdb_test "ptype myint" "type = myint" ++++++ gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch ++++++ [gdb/tdep] Fix avx512 -m32 support in gdbserver PR27257 reports a problem that can be reproduced as follows: - use x86_64 machine with avx512 support - compile a hello world with -m32 to a.out - start a gdbserver session with a.out - use gdb to connect to the gdbserver session This makes us run into: ... Listening on port 2346 Remote debugging from host ::1, port 34940 src/gdbserver/regcache.cc:257: \ A problem internal to GDBserver has been detected. Unknown register zmm16h requested ... The problem is that i387_xsave_to_cache in gdbserver/i387-fp.cc can't find a register zmm16h in the register cache. To understand how this happens, first some background. SSE has 16 128-bit wide xmm registers. AVX extends the SSE registers set as follows: - it extends the 16 existing 128-bit wide xmm registers to 256-bit wide ymm registers. AVX512 extends the AVX register set as follows: - it extends the 16 existing 256-bit wide ymm registers to 512-bit wide zmm registers. - it adds 16 additional 512-bit wide zmm registers (with corresponding ymm and xmm subregisters added as well) However, in 32-bit mode, there are only 8 xmm/ymm/zmm registers. The problem we're running into is that gdbserver/i387-fp.cc uses these constants to describe the size of the register file: ... static const int num_avx512_zmmh_low_registers = 16; static const int num_avx512_zmmh_high_registers = 16; static const int num_avx512_ymmh_registers = 16; static const int num_avx512_xmm_registers = 16; ... which are all incorrect for the 32-bit case. Fix this by replacing the constants with variables that have the appropriate values in 64-bit and 32-bit mode. Tested on x86_64-linux with native and unix/-m32. --- gdbserver/i387-fp.cc | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc index 6d9b62ed8ce..9b07ded592d 100644 --- a/gdbserver/i387-fp.cc +++ b/gdbserver/i387-fp.cc @@ -23,10 +23,6 @@ static const int num_mpx_bnd_registers = 4; static const int num_mpx_cfg_registers = 2; static const int num_avx512_k_registers = 8; -static const int num_avx512_zmmh_low_registers = 16; -static const int num_avx512_zmmh_high_registers = 16; -static const int num_avx512_ymmh_registers = 16; -static const int num_avx512_xmm_registers = 16; static const int num_pkeys_registers = 1; /* Note: These functions preserve the reserved bits in control registers. @@ -256,14 +252,22 @@ void i387_cache_to_xsave (struct regcache *regcache, void *buf) { struct i387_xsave *fp = (struct i387_xsave *) buf; + bool amd64 = register_size (regcache->tdesc, 0) == 8; int i; unsigned long val, val2; unsigned long long xstate_bv = 0; unsigned long long clear_bv = 0; char raw[64]; char *p; + /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; + int num_xmm_registers = amd64 ? 16 : 8; + /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ + int num_avx512_zmmh_low_registers = num_xmm_registers; + /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ + int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; + int num_avx512_ymmh_registers = amd64 ? 16 : 0; + int num_avx512_xmm_registers = amd64 ? 16 : 0; /* The supported bits in `xstat_bv' are 8 bytes. Clear part in vector registers if its bit in xstat_bv is zero. */ @@ -452,7 +456,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) /* Check if any of ZMM16H-ZMM31H registers are changed. */ if ((x86_xcr0 & X86_XSTATE_ZMM)) { - int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); + int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "zmm16h")); for (i = 0; i < num_avx512_zmmh_high_registers; i++) { @@ -469,7 +475,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) /* Check if any XMM_AVX512 registers are changed. */ if ((x86_xcr0 & X86_XSTATE_ZMM)) { - int xmm_avx512_regnum = find_regno (regcache->tdesc, "xmm16"); + int xmm_avx512_regnum = (num_avx512_xmm_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "xmm16")); for (i = 0; i < num_avx512_xmm_registers; i++) { @@ -486,7 +494,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) /* Check if any YMMH_AVX512 registers are changed. */ if ((x86_xcr0 & X86_XSTATE_ZMM)) { - int ymmh_avx512_regnum = find_regno (regcache->tdesc, "ymm16h"); + int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "ymm16h")); for (i = 0; i < num_avx512_ymmh_registers; i++) { @@ -710,12 +720,20 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) { struct i387_xsave *fp = (struct i387_xsave *) buf; struct i387_fxsave *fxp = (struct i387_fxsave *) buf; + bool amd64 = register_size (regcache->tdesc, 0) == 8; int i, top; unsigned long val; unsigned long long clear_bv; gdb_byte *p; - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; + + /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ + int num_xmm_registers = amd64 ? 16 : 8; + /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ + int num_avx512_zmmh_low_registers = num_xmm_registers; + /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ + int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; + int num_avx512_ymmh_registers = amd64 ? 16 : 0; + int num_avx512_xmm_registers = amd64 ? 16 : 0; /* The supported bits in `xstat_bv' are 8 bytes. Clear part in vector registers if its bit in xstat_bv is zero. */ @@ -845,9 +863,15 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) if ((x86_xcr0 & X86_XSTATE_ZMM) != 0) { - int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); - int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h"); - int xmm16_regnum = find_regno (regcache->tdesc, "xmm16"); + int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "zmm16h")); + int ymm16h_regnum = (num_avx512_ymmh_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "ymm16h")); + int xmm16_regnum = (num_avx512_xmm_registers == 0 + ? -1 + : find_regno (regcache->tdesc, "xmm16")); if ((clear_bv & X86_XSTATE_ZMM) != 0) { ++++++ gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch ++++++ [gdb/tdep, rs6000] Don't skip system call in skip_prologue I ran into a case where a breakpoint on _exit never triggered, because it was set past the end of the _exit prologue, past the end of the exit_group system call (which does not return). More concretely, the breakpoint was set at the last insn show here: ... Dump of assembler code for function _exit: 0x00007ffff7e42ea0 <+0>: 12 00 4c 3c addis r2,r12,18 0x00007ffff7e42ea4 <+4>: 60 43 42 38 addi r2,r2,17248 0x00007ffff7e42ea8 <+8>: 00 00 00 60 nop 0x00007ffff7e42eac <+12>: f8 ff e1 fb std r31,-8(r1) 0x00007ffff7e42eb0 <+16>: 78 1b 7f 7c mr r31,r3 0x00007ffff7e42eb4 <+20>: f0 ff c1 fb std r30,-16(r1) 0x00007ffff7e42eb8 <+24>: ea 00 00 38 li r0,234 0x00007ffff7e42ebc <+28>: a0 8b 22 e9 ld r9,-29792(r2) 0x00007ffff7e42ec0 <+32>: 78 fb e3 7f mr r3,r31 0x00007ffff7e42ec4 <+36>: 14 6a c9 7f add r30,r9,r13 0x00007ffff7e42ec8 <+40>: 02 00 00 44 sc 0x00007ffff7e42ecc <+44>: 26 00 00 7c mfcr r0 0x00007ffff7e42ed0 <+48>: 00 10 09 74 andis. r9,r0,4096 ... Fix this by treating system calls the same as branches in skip_prologue: by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8 instead. Tested on ppc64le-linux, on a power 8 machine. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527 --- gdb/rs6000-tdep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 826f0266ed8..9ac5db57898 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2137,6 +2137,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, /* Never skip branches. */ break; + /* Test based on opcode and mask values of + powerpc_opcodes[svc..svcla] in opcodes/ppc-opc.c. */ + if ((op & 0xffff0000) == 0x44000000) + /* Never skip system calls. */ + break; + if (num_skip_non_prologue_insns++ > max_skip_non_prologue_insns) /* Do not scan too many insns, scanning insns is expensive with remote targets. */ ++++++ gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch ++++++ [gdb/testsuite] Add gdb.arch/ppc64-break-on-_exit.exp Add a regression test-case for commit a50bdb99afe "[gdb/tdep, rs6000] Don't skip system call in skip_prologue": - set a breakpoint on a local copy of glibc's _exit, and - verify that it triggers. The test-case uses an assembly file by default, but also has the possibility to use a C source file instead. Tested on ppc64le-linux. Verified that the test-case fails without aforementioned commit, and passes with the commit. Both with assembly and C source. --- gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c | 27 +++++ gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c | 112 +++++++++++++++++++++ gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp | 56 +++++++++++ gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s | 108 ++++++++++++++++++++ 4 files changed, 303 insertions(+) diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c new file mode 100644 index 00000000000..77253140e36 --- /dev/null +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c @@ -0,0 +1,27 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <unistd.h> + +__thread int __libc_errno; + +int +main () +{ + _exit (22); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c new file mode 100644 index 00000000000..8638a7a6b70 --- /dev/null +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c @@ -0,0 +1,112 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This file was generated from glibc's 2.31 _exit.c, by doing a glibc build + on ppc64le-linux, copying the command line, adding -g0 -save-temps and + recuding the _exit.i file. */ + +void _exit (int status); + +extern __thread int __libc_errno; + +void +_exit (int status) +{ + while (1) + { + ({ + long int sc_err __attribute__ ((unused)); + long int sc_ret + = ({ + register long int r0 __asm__ ("r0"); + register long int r3 __asm__ ("r3"); + register long int r4 __asm__ ("r4"); + register long int r5 __asm__ ("r5"); + register long int r6 __asm__ ("r6"); + register long int r7 __asm__ ("r7"); + register long int r8 __asm__ ("r8"); + long int arg1 = (long int) (status); + + r0 = 234; + + extern void __illegally_sized_syscall_arg1 (void); + if (__builtin_classify_type (status) != 5 && sizeof (status) > 8) + __illegally_sized_syscall_arg1 (); + + r3 = arg1; + __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:" + : "=&r" (r0), "=&r" (r3), "=&r" (r4), + "=&r" (r5), "=&r" (r6), "=&r" (r7), + "=&r" (r8) : "0" (r0), "1" (r3) + : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory"); + sc_err = r0; + + r3; + }); + + if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0))) + { + (__libc_errno = ((sc_ret))); + sc_ret = -1L; + } + + sc_ret; + }); + + ({ + long int sc_err __attribute__ ((unused)); + long int sc_ret + = ({ + register long int r0 __asm__ ("r0"); + register long int r3 __asm__ ("r3"); + register long int r4 __asm__ ("r4"); + register long int r5 __asm__ ("r5"); + register long int r6 __asm__ ("r6"); + register long int r7 __asm__ ("r7"); + register long int r8 __asm__ ("r8"); + long int arg1 = (long int) (status); + + r0 = 1; + + extern void __illegally_sized_syscall_arg1 (void); + if (__builtin_classify_type (status) != 5 && sizeof (status) > 8) + __illegally_sized_syscall_arg1 (); + + r3 = arg1; + __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:" + : "=&r" (r0), "=&r" (r3), "=&r" (r4), + "=&r" (r5), "=&r" (r6), "=&r" (r7), + "=&r" (r8) : "0" (r0), "1" (r3) + : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory"); + sc_err = r0; + + r3; + }); + + if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0))) + { + (__libc_errno = ((sc_ret))); + sc_ret = -1L; + } + + sc_ret; + }); + + + asm (".long 0"); + } +} diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp new file mode 100644 index 00000000000..b2fef8e8b76 --- /dev/null +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp @@ -0,0 +1,56 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Set a breakpoint on a local copy of glibc's _exit, and verify that it +# triggers. The function does a syscall immediately after the prologue, and +# if the breakpoint is set past the syscall due to faulty prologue skipping, +# the breakpoint will not trigger. +# +# In particular, we're trying to excercise the instruction analysis +# functionality of prologue skipping. If non-minimal symbols are +# read, then that functionality might not be used because f.i. +# line-info is used instead. So, we use nodebug. + +if {![istarget "powerpc*"] || ![is_lp64_target]} { + unsupported "Not powerpc64" + return +} + +set flags { nodebug } +if { 1 } { + standard_testfile .s -main.c +} else { + standard_testfile .c -main.c + lappend flags optimize=-O2 + lappend flags additional_flags=-fno-stack-protector + lappend flags additional_flags=-mlong-double-128 + lappend flags additional_flags=-fpic + lappend flags additional_flags=-ftls-model=initial-exec +} + +if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $srcfile2] $flags] } { + return -1 +} + +if ![runto_main] then { + return 0 +} + +gdb_breakpoint "_exit" + +# If the skip_prologue analysis of _exit is too eager, we may not hit the +# breakpoint. +gdb_continue_to_breakpoint "_exit" "_exit \\(\\).*" diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s new file mode 100644 index 00000000000..37a9ace2aff --- /dev/null +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s @@ -0,0 +1,108 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This file was generated from ppc64-break-on-_exit.c. */ + + .file "ppc64-break-on-_exit.c" + .abiversion 2 + .section ".text" + .align 2 + .p2align 4,,15 + .globl _exit + .type _exit, @function +_exit: +.LCF0: +0: addis 2,12,.TOC.-.LCF0@ha + addi 2,2,.TOC.-.LCF0@l + .localentry _exit,.-_exit + addis 9,2,__libc_errno@got@tprel@ha + std 31,-8(1) + mr 31,3 + std 30,-16(1) + li 0,234 + ld 9,__libc_errno@got@tprel@l(9) + mr 3,31 + add 30,9,__libc_errno@tls +#APP + # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + sc + mfcr 0 + 0: + # 0 "" 2 +#NO_APP + andis. 9,0,0x1000 + mr 9,3 + li 0,1 + mr 3,31 + bne 0,.L13 + .p2align 4,,15 +.L2: +#APP + # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + sc + mfcr 0 + 0: + # 0 "" 2 +#NO_APP + andis. 9,0,0x1000 + bne 0,.L14 +.L3: +#APP + # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + .long 0 + # 0 "" 2 +#NO_APP +.L15: + li 0,234 + mr 3,31 +#APP + # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + sc + mfcr 0 + 0: + # 0 "" 2 +#NO_APP + andis. 9,0,0x1000 + mr 9,3 + li 0,1 + mr 3,31 + beq 0,.L2 +.L13: + stw 9,0(30) +#APP + # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + sc + mfcr 0 + 0: + # 0 "" 2 +#NO_APP + andis. 9,0,0x1000 + beq 0,.L3 + .p2align 4,,15 +.L14: + stw 3,0(30) +#APP + # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 + .long 0 + # 0 "" 2 +#NO_APP + b .L15 + .long 0 + .byte 0,0,0,0,0,2,0,0 + .size _exit,.-_exit + .ident "GCC: (SUSE Linux) 7.5.0" + .section .note.GNU-stack,"",@progbits ++++++ gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch ++++++ [gdb/testsuite] Add gdb.opt/break-on-_exit.exp Add a test-case to excercise the problem scenario reported in PR28527 and fixed in commit a50bdb99afe "[gdb/tdep, rs6000] Don't skip system call in skip_prologue": - set a breakpoint on _exit, and - verify that it triggers. Note that this is not a regression test for that commit. Since the actual code in _exit may vary across os instances, we cannot guarantee that the problem will always trigger with this test-case. Rather, this test-case is a version of the original test-case (gdb.threads/process-dies-while-detaching.exp) that is minimal while still reproducing the problem reported in PR28527, in that same setting. The benefit of this test-case is that it exercise real-life code and may expose similar problems in other settings. Also, it provides a much easier test-case to investigate in case a similar problem occurs. Tested on x86_64-linux and ppc64le-linux. --- gdb/testsuite/gdb.opt/break-on-_exit.c | 26 +++++++++++++ gdb/testsuite/gdb.opt/break-on-_exit.exp | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.c b/gdb/testsuite/gdb.opt/break-on-_exit.c new file mode 100644 index 00000000000..d8da66193a8 --- /dev/null +++ b/gdb/testsuite/gdb.opt/break-on-_exit.c @@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <unistd.h> + +int +main (void) +{ + _exit (0); + + return 0; +} diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp new file mode 100644 index 00000000000..38476412862 --- /dev/null +++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp @@ -0,0 +1,66 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +# Set a breakpoint on libc's _exit, and verify that it triggers. The function +# tends to do a syscall immediately after the prologue, and if the breakpoint is +# set past the syscall due to faulty prologue skipping, the breakpoint will not +# trigger. +# +# In particular, we're trying to excercise the instruction analysis +# functionality of prologue skipping. If the non-minimal symbols are +# read for libc, then that functionality might not be used because f.i. +# line-info is used instead. Also, if the minimal symbols are not read +# for libc, then the breakpoint is set on the exec-local _exit@plt instead, +# and that functionality will also not be used. +# +# We may get the required setup in case of a libc with misssing separate +# debuginfo, but we want the same effect if that debuginfo is installed. +# +# So, we use -readnever to read minimal symbols, but not non-miminal symbols. +# +# Because the code at _exit may be and usually is optimized, the test is in +# the gdb.opt directory. + +standard_testfile + +# See if we have target board readnow.exp or similar. +if { [lsearch -exact $GDBFLAGS -readnow] != -1 \ + || [lsearch -exact $GDBFLAGS --readnow] != -1 } { + untested "--readnever not allowed in combination with --readnow" + return -1 +} + +save_vars { GDBFLAGS } { + append GDBFLAGS " -readnever" + + if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} { + return -1 + } +} + +if ![runto_main] then { + return 0 +} + +gdb_breakpoint "_exit" + +# Give some background information about the breakpoint(s) and corresponding +# the shared lib(s). +gdb_test "info breakpoints" +gdb_test "info shared" + +# If the skip_prologue analysis of _exit is too eager, we may not hit the +# breakpoint. +gdb_continue_to_breakpoint "_exit" "_exit \\(\\) .*" ++++++ gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch ++++++ gdb-testsuite-add-gdb.suse-zypper-hint.exp [gdb/testsuite] Add gdb.suse/zypper-hint.exp --- gdb/testsuite/gdb.suse/zypper-hint.c | 25 ++++++++++++++++ gdb/testsuite/gdb.suse/zypper-hint.exp | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/gdb/testsuite/gdb.suse/zypper-hint.c b/gdb/testsuite/gdb.suse/zypper-hint.c new file mode 100644 index 00000000000..e179788f04f --- /dev/null +++ b/gdb/testsuite/gdb.suse/zypper-hint.c @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +int +main (void) +{ + printf ("hello\n"); + return 0; +} diff --git a/gdb/testsuite/gdb.suse/zypper-hint.exp b/gdb/testsuite/gdb.suse/zypper-hint.exp new file mode 100644 index 00000000000..c2b9a1134bd --- /dev/null +++ b/gdb/testsuite/gdb.suse/zypper-hint.exp @@ -0,0 +1,55 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +standard_testfile .c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { + return -1 +} + +clean_restart ${binfile} + +gdb_test_no_output "set build-id-verbose 1" + +set test "zypper hint printed" +if { ![gdb_breakpoint main qualified] } { + unresolved $test + return -1 +} + +gdb_run_cmd + +set re_64 \ + "Missing separate debuginfos, use: zypper install glibc-debuginfo-" +set re_32 \ + "Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-" + +set hexno0x "\[0-9A-Fa-f\]+" +set re_nolibrpm \ + [multi_line \ + "Missing separate debuginfo for .*libc.so.*" \ + "Try: zypper install -C \"debuginfo\\(build-id\\)=$hexno0x\""] + +gdb_test_multiple "" $test { + -re -wrap ($re_64|$re_32).* { + pass "$gdb_test_name (librpm)" + } + -re -wrap $re_nolibrpm.* { + pass "$gdb_test_name (no librpm)" + } +} + +# To give some background information in case the previous test failed. +gdb_test "info shared" ++++++ gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch ++++++ [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp On OBS I ran into: ... (gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \ outputs/gdb.base/signals-state-child/gdb.txt^M diff: outputs/gdb.base/signals-state-child/standalone.txt: \ No such file or directory^M (gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical ... I managed to reproduce this by adding "sleep (5)" at the start of main in signals-state-child.c. Fix this by waiting on the result of the spawned command. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/signals-state-child.exp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp index 0984033811b..81589375f22 100644 --- a/gdb/testsuite/gdb.base/signals-state-child.exp +++ b/gdb/testsuite/gdb.base/signals-state-child.exp @@ -69,9 +69,11 @@ set res [remote_spawn target "$binfile-standalone"] if { $res < 0 || $res == "" } { untested "spawning $binfile-standalone failed" return 1 -} else { - pass "collect standalone signals state" } + +set wait_status [remote_wait target 60] +set have_standalone [expr [lindex $wait_status 0] == 0] +gdb_assert { $have_standalone } "collect standalone signals state" remote_close target # Now run the program through gdb, and dump its initial signal actions @@ -86,6 +88,12 @@ if { ! [ runto_main ] } then { gdb_continue_to_end "collect signals state under gdb" +set test "signals states are identical" +if { ! $have_standalone } { + untested $test + return -1 +} + if {!$purely_local} { # Copy file from target to host through build. remote_download host [remote_upload target gdb.txt] gdb.txt @@ -95,4 +103,4 @@ if {!$purely_local} { # Diff the .txt files. They should be identical. gdb_test "shell diff -s $standalone_txt $gdb_txt" \ "Files .* are identical.*" \ - "signals states are identical" + $test ++++++ gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch ++++++ [gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but which makes the regexp matching more difficult (see commit 1f28b70def1 "[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp"). Disable the inferior output using '#if DEBUG'. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/foll-vfork-exit.c | 14 ++++++++++++-- gdb/testsuite/gdb.base/foll-vfork.c | 9 ++++++++- gdb/testsuite/gdb.base/foll-vfork.exp | 17 +++++++++++------ gdb/testsuite/gdb.base/vforked-prog.c | 7 ++++++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c index 6c263cdc057..15e272afe82 100644 --- a/gdb/testsuite/gdb.base/foll-vfork-exit.c +++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c @@ -29,12 +29,22 @@ main () pid = vfork (); /* VFORK */ if (pid == 0) { - printf ("I'm the child!\n"); + const char *s = "I'm the child!"; +#if DEBUG + printf ("%s\n", s); +#else + const char *volatile v = s; +#endif _exit (0); } else { - printf ("I'm the proud parent of child #%d!\n", pid); + const char *s = "I'm the proud parent of child"; +#if DEBUG + printf ("%s #%d!\n", s, pid); +#else + const char *volatile v = s; +#endif } return 0; diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c index 2f6661d1a0b..b7e332e146b 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.c +++ b/gdb/testsuite/gdb.base/foll-vfork.c @@ -40,12 +40,19 @@ main (int argc, char ** argv) memcpy (prog + len - 10, "vforked-prog", 12); prog[len + 2] = 0; +#if DEBUG printf ("I'm the child!\n"); +#endif execlp (prog, prog, (char *) 0); perror ("exec failed"); _exit (1); } else { - printf ("I'm the proud parent of child #%d!\n", pid); + const char *s = "I'm the proud parent of child"; +#if DEBUG + printf ("%s #%d!\n", s, pid); +#else + const char *volatile v = s; +#endif } } diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index a781a5c2087..fc710167f7d 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -32,9 +32,14 @@ if [gdb_debug_enabled] { return 0 } +# Set DEBUG to 0 or 1 in sources. +set debug 0 + standard_testfile -set compile_options debug +set compile_options {} +lappend compile_options debug +lappend compile_options additional_flags=-DDEBUG=$debug if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} { untested "failed to compile main testcase" @@ -126,7 +131,7 @@ proc vfork_parent_follow_to_bp {} { gdb_test_no_output "set follow-fork parent" - set bp_location [gdb_get_line_number "printf (\"I'm the proud parent of child"] + set bp_location [gdb_get_line_number "I'm the proud parent of child"] gdb_test "break ${srcfile}:${bp_location}" ".*" "break, vfork to bp" set test "continue to bp" @@ -176,7 +181,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} { gdb_test_no_output "set follow-fork child" - set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] + set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] set test "continue to bp" gdb_test_multiple "continue" $test { @@ -278,7 +283,7 @@ proc tcatch_vfork_then_child_follow_exec {} { continue_to_vfork set linenum1 [gdb_get_line_number "pid = vfork ();"] - set linenum2 [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] + set linenum2 [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] set test "finish" gdb_test_multiple "finish" $test { @@ -356,7 +361,7 @@ proc vfork_relations_in_info_inferiors { variant } { if { $variant == "exec" } { global srcfile2 - set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] + set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] set test "continue to bp" gdb_test_multiple "continue" $test { -re ".*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { @@ -487,7 +492,7 @@ set testfile "foll-vfork-exit" set srcfile ${testfile}.c set binfile [standard_output_file ${testfile}] -if {[build_executable $testfile.exp $testfile $srcfile] == -1} { +if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} { untested "failed to build $testfile" return } diff --git a/gdb/testsuite/gdb.base/vforked-prog.c b/gdb/testsuite/gdb.base/vforked-prog.c index 936c6e6032d..999efa8ce0d 100644 --- a/gdb/testsuite/gdb.base/vforked-prog.c +++ b/gdb/testsuite/gdb.base/vforked-prog.c @@ -19,6 +19,11 @@ int main (void) { - printf("Hello from vforked-prog...\n"); + const char *s = "Hello from vforked-prog"; +#if DEBUG + printf ("%s...\n", s); +#else + const char *volatile v = s; +#endif return 0; } ++++++ gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch ++++++ gdb/testsuite: don't error when trying to unset last_spawn_tty_name In spawn_capture_tty_name (lib/gdb.exp) we either set or unset last_spawn_tty_name depending on whether spawn_out(slave,name) exists or not. One situation that might cause spawn_out(slave,name) to not exists is if the spawn function is called with the argument -leaveopen, which is how it is called when processes are created as part of a pipeline, the created process has no tty, instead its output is written to a file descriptor. If a pipeline is created consisting of multiple processes then there will be multiple sequential calls to spawn, all using -leaveopen. The first of these calls is fine, spawn_out(slave,name) is not set, and so in spawn_capture_tty_name we unset last_spawn_tty_name. However, on the second call to spawn, spawn_out(slave,name) is still not set and so in spawn_capture_tty_name we again try to unset last_spawn_tty_name, this now throws an error (as last_spawn_tty_name is already unset). Fix this issue by using -nocomplain with the call to unset in spawn_capture_tty_name. Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1 pass, and 1 unsupported test. After this commit I now see 16 passes from this test script. I have also improved the code that used to do this: if { [info exists spawn_out] } { set ::last_spawn_tty_name $spawn_out(slave,name) } else { ... } The problem here is that we check for the existence of spawn_out, and then unconditionally read spawn_out(slave,name). A situation could arise where some other element of spawn_out is set, e.g. spawn_out(foo), in which case we would enter the if block and try to read a non-existent variable. After this commit we now check specifically for spawn_out(slave,name). Finally, it is worth noting that before this issue was fixed runtest itself, or rather the expect process behind runtest, would segfault while exiting. I haven't looked at all into what the problem is here that caused expect to crash, as fixing the bug in GDB's testing scripts made the segfault go away. --- gdb/testsuite/lib/gdb.exp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7a8332dd573..8b62d73ca9a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2010,10 +2010,20 @@ proc gdb_file_cmd { arg } { proc spawn_capture_tty_name { args } { set result [uplevel builtin_spawn $args] upvar spawn_out spawn_out - if { [info exists spawn_out] } { + if { [info exists spawn_out(slave,name)] } { set ::last_spawn_tty_name $spawn_out(slave,name) } else { - unset ::last_spawn_tty_name + # If a process is spawned as part of a pipe line (e.g. passing + # -leaveopen to the spawn proc) then the spawned process is no + # assigned a tty and spawn_out(slave,name) will not be set. + # In that case we want to ensure that last_spawn_tty_name is + # not set. + # + # If the previous process spawned was also not assigned a tty + # (e.g. multiple processed chained in a pipeline) then + # last_spawn_tty_name will already be unset, so, if we don't + # use -nocomplain here we would otherwise get an error. + unset -nocomplain ::last_spawn_tty_name } return $result } ++++++ gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch ++++++ [gdb/testsuite] Fix assembly comments in gdb.dwarf2/clang-debug-names.exp.tcl On openSUSE Leap 15.2 aarch64 I ran into: ... clang-debug-names-debug.S:72: \ Error: junk at end of line, first unrecognized character is `#' ... due to: ... 71 .Ldebug_names_start: 72 .short 5 # Header: version ... Fix this by using the /* ... */ comment style instead: ... $ sed -i 's% #\([^"]*\)%/*\1 */%' clang-debug-names.exp.tcl ... Tested on aarch64-linux and x86_64-linux. --- gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl | 76 +++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl index 6c2858aef0a..4700024c788 100644 --- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl @@ -31,50 +31,50 @@ set debug_names \ [list \ " .4byte .Ldebug_names_end - .Ldebug_names_start" \ ".Ldebug_names_start:" \ - " .short 5 # Header: version" \ - " .short 0 # Header: padding" \ - " .long 1 # Header: compilation unit count" \ - " .long 0 # Header: local type unit count" \ - " .long 0 # Header: foreign type unit count" \ - " .long 2 # Header: bucket count" \ - " .long 2 # Header: name count" \ + " .short 5 /* Header: version */" \ + " .short 0 /* Header: padding */" \ + " .long 1 /* Header: compilation unit count */" \ + " .long 0 /* Header: local type unit count */" \ + " .long 0 /* Header: foreign type unit count */" \ + " .long 2 /* Header: bucket count */" \ + " .long 2 /* Header: name count */" \ " .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \ - " # Header: abbreviation table size" \ - " .long 8 # Header: augmentation string size" \ - " .ascii \"LLVM0700\" # Header: augmentation string" \ - " .long .Lcu1_begin # Compilation unit 0" \ - " .long 1 # Bucket 0" \ - " .long 0 # Bucket 1" \ - " .long 193495088 # Hash in Bucket 0" \ - " .long 2090499946 # Hash in Bucket 0" \ - " .long $int_str_label # String in Bucket 0: int" \ - " .long $main_str_label # String in Bucket 0: main" \ - " .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0" \ - " .long .Lnames0-.Lnames_entries0 # Offset in Bucket 0" \ + " /* Header: abbreviation table size */" \ + " .long 8 /* Header: augmentation string size */" \ + " .ascii \"LLVM0700\" /* Header: augmentation string */" \ + " .long .Lcu1_begin /* Compilation unit 0 */" \ + " .long 1 /* Bucket 0 */" \ + " .long 0 /* Bucket 1 */" \ + " .long 193495088 /* Hash in Bucket 0 */" \ + " .long 2090499946 /* Hash in Bucket 0 */" \ + " .long $int_str_label /* String in Bucket 0: int */" \ + " .long $main_str_label /* String in Bucket 0: main */" \ + " .long .Lnames1-.Lnames_entries0/* Offset in Bucket 0 */" \ + " .long .Lnames0-.Lnames_entries0/* Offset in Bucket 0 */" \ ".Lnames_abbrev_start0:" \ - " .byte 46 # Abbrev code" \ - " .byte 46 # DW_TAG_subprogram" \ - " .byte 3 # DW_IDX_die_offset" \ - " .byte 19 # DW_FORM_ref4" \ - " .byte 0 # End of abbrev" \ - " .byte 0 # End of abbrev" \ - " .byte 36 # Abbrev code" \ - " .byte 36 # DW_TAG_base_type" \ - " .byte 3 # DW_IDX_die_offset" \ - " .byte 19 # DW_FORM_ref4" \ - " .byte 0 # End of abbrev" \ - " .byte 0 # End of abbrev" \ - " .byte 0 # End of abbrev list" \ + " .byte 46 /* Abbrev code */" \ + " .byte 46 /* DW_TAG_subprogram */" \ + " .byte 3 /* DW_IDX_die_offset */" \ + " .byte 19 /* DW_FORM_ref4 */" \ + " .byte 0 /* End of abbrev */" \ + " .byte 0 /* End of abbrev */" \ + " .byte 36 /* Abbrev code */" \ + " .byte 36 /* DW_TAG_base_type */" \ + " .byte 3 /* DW_IDX_die_offset */" \ + " .byte 19 /* DW_FORM_ref4 */" \ + " .byte 0 /* End of abbrev */" \ + " .byte 0 /* End of abbrev */" \ + " .byte 0 /* End of abbrev list */" \ ".Lnames_abbrev_end0:" \ ".Lnames_entries0:" \ ".Lnames1:" \ - " .byte 36 # Abbreviation code" \ - " .long $int_die_label - .Lcu1_begin # DW_IDX_die_offset" \ - " .long 0 # End of list: int" \ + " .byte 36 /* Abbreviation code */" \ + " .long $int_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ + " .long 0 /* End of list: int */" \ ".Lnames0:" \ - " .byte 46 # Abbreviation code" \ - " .long $main_die_label - .Lcu1_begin # DW_IDX_die_offset" \ - " .long 0 # End of list: main" \ + " .byte 46 /* Abbreviation code */" \ + " .long $main_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ + " .long 0 /* End of list: main */" \ " .p2align 2" \ ".Ldebug_names_end:"] ++++++ gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch ++++++ [gdb/testsuite] Fix data alignment in gdb.arch/i386-{avx,sse}.exp When running test-case gdb.arch/i386-avx.exp with clang I ran into: ... (gdb) PASS: gdb.arch/i386-avx.exp: set first breakpoint in main continue^M Continuing.^M ^M Program received signal SIGSEGV, Segmentation fault.^M 0x000000000040052b in main (argc=1, argv=0x7fffffffd3c8) at i386-avx.c:54^M 54 asm ("vmovaps 0(%0), %%ymm0\n\t"^M (gdb) FAIL: gdb.arch/i386-avx.exp: continue to breakpoint: \ continue to first breakpoint in main ... The problem is that the vmovaps insn requires an 256-bit (or 32-byte aligned address), and it's only 16-byte aligned: ... (gdb) p /x $rax $1 = 0x601030 ... Fix this by copying to a sufficiently aligned address. Likewise in gdb.arch/i386-sse.exp. Tested on x86_64-linux, with both gcc and clang. --- gdb/testsuite/gdb.arch/i386-avx.c | 9 +- gdb/testsuite/gdb.arch/i386-sse.c | 10 ++- gdb/testsuite/lib/precise-aligned-alloc.c | 131 ++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c index 4e938399a24..255ff5ee6f5 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.c +++ b/gdb/testsuite/gdb.arch/i386-avx.c @@ -25,7 +25,7 @@ typedef struct { } v8sf_t; -v8sf_t data[] = +v8sf_t data_orig[] = { { { 0.0, 0.125, 0.25, 0.375, 0.50, 0.625, 0.75, 0.875 } }, { { 1.0, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875 } }, @@ -47,10 +47,15 @@ v8sf_t data[] = #endif }; +#include "../lib/precise-aligned-alloc.c" int main (int argc, char **argv) { + void *allocated_ptr; + v8sf_t *data + = precise_aligned_dup (32, sizeof (data_orig), &allocated_ptr, data_orig); + asm ("vmovaps 0(%0), %%ymm0\n\t" "vmovaps 32(%0), %%ymm1\n\t" "vmovaps 64(%0), %%ymm2\n\t" @@ -107,5 +112,7 @@ main (int argc, char **argv) puts ("Bye!"); /* second breakpoint here */ + free (allocated_ptr); + return 0; } diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c index a5941a4071e..c78a510c1a7 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.c +++ b/gdb/testsuite/gdb.arch/i386-sse.c @@ -25,7 +25,7 @@ typedef struct { } v4sf_t; -v4sf_t data[] = +v4sf_t data_orig[] = { { { 0.0, 0.25, 0.50, 0.75 } }, { { 1.0, 1.25, 1.50, 1.75 } }, @@ -62,9 +62,15 @@ have_sse (void) return 0; } +#include "../lib/precise-aligned-alloc.c" + int main (int argc, char **argv) { + void *allocated_ptr; + v4sf_t *data + = precise_aligned_dup (16, sizeof (data_orig), &allocated_ptr, data_orig); + if (have_sse ()) { asm ("movaps 0(%0), %%xmm0\n\t" @@ -124,5 +130,7 @@ main (int argc, char **argv) puts ("Bye!"); /* second breakpoint here */ } + free (allocated_ptr); + return 0; } diff --git a/gdb/testsuite/lib/precise-aligned-alloc.c b/gdb/testsuite/lib/precise-aligned-alloc.c new file mode 100644 index 00000000000..88a2e445b59 --- /dev/null +++ b/gdb/testsuite/lib/precise-aligned-alloc.c @@ -0,0 +1,131 @@ +/* This test file is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <stdlib.h> +#include <assert.h> +#include <string.h> +#include <stdint.h> + +/* Local version of C11's aligned_alloc, but with free_pointer PARAMETER since + possibly we cannot free the returned value. + We're not using aligned_alloc here, to allow pre-C11 usage. */ + +static void * +my_aligned_alloc (size_t alignment, size_t size, void **free_pointer) +{ + void *p; + void *p_orig; + void *p_end; + size_t mask; + +#if 0 + /* Use C11's aligned_alloc to do the allocation. */ + p = aligned_alloc (alignment, size); + assert (p != NULL); + p_orig = p; + p_end = p + size; +#else + /* Allocate extra to ensure alignment. */ + size_t alloc_size = size + alignment; + + /* Use malloc to do the allocation. */ + p = malloc (alloc_size); + assert (p != NULL); + p_orig = p; + p_end = p + alloc_size; + + /* Align p. */ + mask = (alignment - 1); + if (((uintptr_t)p & mask) == 0) + ; + else + { + p = (void*)((uintptr_t)p & ~mask); + p += alignment; + } +#endif + + /* Verify p is within bounds, and points to large enough area. */ + assert (p >= p_orig); + assert (p + size <= p_end); + + /* Verify required alignment. */ + mask = (alignment - 1); + assert (((uintptr_t)p & mask) == 0); + + if (free_pointer != NULL) + *free_pointer = p_orig; + + return p; +} + +/* Allocate SIZE memory with ALIGNMENT, and return it. If FREE_POINTER, + return in it the corresponding pointer to be passed to free. + + Do the alignment precisely, in other words, if an alignment of 4 is + requested, make sure the pointer is 4-byte aligned, but not 8-byte + aligned. In other words, make sure the pointer is not overaligned. + + The benefit of using precise alignment is that accidentally specifying + a too low alignment will not be compensated by accidental + overalignment. */ + +static void * +precise_aligned_alloc (size_t alignment, size_t size, void **free_pointer) +{ + /* Allocate extra to compenate for "p += alignment". */ + size_t alloc_size = size + alignment; + /* Align extra, to be able to do precise align. */ + void *p = my_aligned_alloc (alignment * 2, alloc_size, free_pointer); + assert (p != NULL); + void *p_orig = p; + void *p_end = p + alloc_size; + + p += alignment; + + /* Verify p is without bounds, and points to large enough area. */ + assert (p >= p_orig); + assert (p + size <= p_end); + + /* Verify required alignment. */ + size_t mask = (alignment - 1); + assert (((uintptr_t)p & mask) == 0); + + /* Verify required alignment is precise. */ + mask = ((2 * alignment) - 1); + assert (((uintptr_t)p & mask) != 0); + + if (free_pointer != NULL) + *free_pointer = p_orig; + + return p; +} + +/* Duplicate data SRC of size SIZE to a newly allocated, precisely aligned + location with alignment ALIGNMENT. */ + +static void * +precise_aligned_dup (size_t alignment, size_t size, void **free_pointer, + void *src) +{ + void *p = precise_aligned_alloc (alignment, size, free_pointer); + + memcpy (p, src, size); + + return p; +} ++++++ gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch ++++++ [gdb/testsuite] Fix FAIL in gdb.tui/basic.exp On openSUSE Leap 15.2 aarch64 I ran into: ... FAIL: gdb.tui/basic.exp: check main is where we expect on the screen ... while this is passing on x86_64. On x86_64-linux we have at the initial screen dump for "list -q main": ... 0 +-/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.tui/tui-layout.c--+ 1 | 15 You should have received a copy of the GNU General Public | 2 | 16 along with this program. If not, see <http://www.gnu.org/| 3 | 17 | 4 | 18 int | 5 | 19 main () | 6 | 20 { | 7 | 21 return 0; | 8 | 22 } | 9 | 23 | ... but on aarch64: ... 0 +-/home/tdevries/gdb/src/gdb/testsuite/gdb.tui/tui-layout.c--------------+ 1 | 16 along with this program. If not, see <http://www.gnu.org/| 2 | 17 | 3 | 18 int | 4 | 19 main () | 5 | 20 { | 6 | 21 return 0; | 7 | 22 } | 8 | 23 | 9 | 24 | ... The cause of the diffferent placement is that we have as line number for main on x86_64: ... $ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main" Line 20 of "tui-layout.c" starts at address 0x4004a7 <main> \ and ends at 0x4004ab <main+4>. ... and on aarch64 instead: ... $ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main" Line 21 of "tui-layout.c" starts at address 0x4005f4 <main> \ and ends at 0x4005f8 <main+4>. ... Fix this by using a new source file main-one-line.c, that implements the entire main function on a single line, in order to force the compiler to use that line number. Also try to do less hard-coding in the test-case. Tested on x86_64-linux and aarch64-linux. --- gdb/testsuite/gdb.tui/basic.exp | 46 ++++++++++++++++++++++++----------- gdb/testsuite/gdb.tui/main-one-line.c | 18 ++++++++++++++ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp index 25a11b2b285..afc770f0073 100644 --- a/gdb/testsuite/gdb.tui/basic.exp +++ b/gdb/testsuite/gdb.tui/basic.exp @@ -17,7 +17,11 @@ tuiterm_env -standard_testfile tui-layout.c +# Use main-one-line.c to get the line info at a predictable location without +# resorting to a dwarf assembly test-case. +standard_testfile main-one-line.c + +set main_line [gdb_get_line_number "int main"] if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { return -1 @@ -34,7 +38,8 @@ gdb_assert {![string match "No Source Available" $text]} \ "initial source listing" Term::command "list -q main" -Term::check_contents "list -q main" "21 *return 0" +set main_re "int main \\(\\) { return 0; }" +Term::check_contents "list -q main" "$main_line *$main_re" # Get the first source line. set line [Term::get_line 1] @@ -49,16 +54,28 @@ if {[Term::wait_for [string_to_regexp $line]] \ fail "scroll up" } -# Check the horizontal scrolling. First confirm that 'main ()' is -# where we expect it to be. This relies on the current way we -# position source code on the screen, which might change in the -# future. The important part of this test is detecting the left/right -# scrolling, not which line main is actually on. -set line_num 6 -set line [Term::get_line $line_num] -gdb_assert {[regexp -- "19\[\\t \]+main \\(\\)" $line]} \ +# Get the actual screen line that main is on. +set main_screen_line -1 +for { set i 1 } { $i <= $Term::_cols } { incr i } { + set line [Term::get_line $i] + if { [regexp -- "$main_line\[\\t \]+$main_re" $line] } { + set main_screen_line $i + break + } +} + +# Confirm that 'main ()' is where we expect it to be. This relies on the +# current way we position source code on the screen, which might change in +# the future. +gdb_assert { $main_screen_line == 7 } \ "check main is where we expect on the screen" -set regexp "19\[\\t \]+ain \\(\\)" +if { $main_screen_line == -1 } { + return 0 +} + +# Check the horizontal scrolling. +set shifted_main_re [string range $main_re 1 end] +set regexp "$main_line\[\\t \]+$shifted_main_re" # Send a right arrow. send_gdb "\033\[C" if {[Term::wait_for $regexp]} { @@ -66,11 +83,11 @@ if {[Term::wait_for $regexp]} { } else { fail "scroll right" } -set line [Term::get_line $line_num] +set line [Term::get_line $main_screen_line] # Send a down arrow. send_gdb "\033\[B" if {[Term::wait_for $regexp] \ - && [Term::get_line [expr {$line_num - 1}]] == $line} { + && [Term::get_line [expr {$main_screen_line - 1}]] == $line} { pass "scroll down" } else { fail "scroll down" @@ -84,7 +101,8 @@ Term::check_contents "asm window shows main" "$hex <main>" Term::check_box "asm box" 0 0 80 15 Term::command "layout split" -Term::check_contents "split layout contents" "21 *return 0.*$hex <main>" +Term::check_contents "split layout contents" \ + "$main_line *$main_re.*$hex <main>" Term::check_box "source box in split layout" 0 0 80 7 Term::check_box "asm box in split layout" 0 6 80 9 diff --git a/gdb/testsuite/gdb.tui/main-one-line.c b/gdb/testsuite/gdb.tui/main-one-line.c new file mode 100644 index 00000000000..fb88c667637 --- /dev/null +++ b/gdb/testsuite/gdb.tui/main-one-line.c @@ -0,0 +1,18 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int main () { return 0; } ++++++ gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch ++++++ [gdb/testsuite] Fix gdb.arch/i386-pkru.exp on linux When running test-case gdb.arch/i386-pkru.exp on a machine with "Memory Protection Keys for Userspace" support, we run into: ... (gdb) PASS: gdb.arch/i386-pkru.exp: probe PKRU support print $pkru^M $2 = 1431655764^M (gdb) FAIL: gdb.arch/i386-pkru.exp: pkru register ... The test-case expects the $pkru register to have the default value 0, matching the "init state" of 0 defined by the XSAVE hardware. Since linux kernel version v4.9 containing commit acd547b29880 ("x86/pkeys: Default to a restrictive init PKRU"), the register is set to 0x55555554 by default (which matches the printed decimal value above). Fix the FAIL by accepting this value for linux. Tested on x86_64-linux. --- gdb/testsuite/gdb.arch/i386-pkru.exp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp index 5732bba6e97..2ee8ee72fa3 100644 --- a/gdb/testsuite/gdb.arch/i386-pkru.exp +++ b/gdb/testsuite/gdb.arch/i386-pkru.exp @@ -20,6 +20,15 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { return } +set default_pkru_re 0x0 +if { [istarget *-*-linux*] } { + # Starting with v4.9, the linux kernel contains commit acd547b29880 + # ("x86/pkeys: Default to a restrictive init PKRU"), which sets the + # pkru register to 0x55555554 by default. + set default_pkru_re (0x0|0x55555554) +} + + set comp_flags "-I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ @@ -51,9 +60,7 @@ if { !$supports_pkru } { } # Test pkru register at startup -# set test_string "0" - -gdb_test "print \$pkru" "= 0" "pkru register" +gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" # Read values from pseudo registers. gdb_breakpoint [ gdb_get_line_number "break here 1" ] ++++++ gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch ++++++ [gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8 With gcc 7.5.0, I get: ... (gdb) guile (print (type-range (field-type (type-field (value-type \ (value-dereference f)) "items"))))^M = (0 0)^M (gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \ on flexible array member: $cmd ... but with gcc 4.8.5, I get instead: ... (gdb) guile (print (type-range (field-type (type-field (value-type \ (value-dereference f)) "items"))))^M = (0 -1)^M (gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \ on flexible array member: $cmd ... There's a difference in debug info. With gcc 4.8.5, we have: ... <2><224>: Abbrev Number: 15 (DW_TAG_member) <225> DW_AT_name : items <22b> DW_AT_type : <0x231> <1><231>: Abbrev Number: 4 (DW_TAG_array_type) <232> DW_AT_type : <0x105> <2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type) <23b> DW_AT_type : <0x11a> <23f> DW_AT_upper_bound : 0xffffffffffffffff ... and with gcc 7.5.0, we have instead: ... <2><89f>: Abbrev Number: 12 (DW_TAG_member) <8a0> DW_AT_name : items <8a6> DW_AT_type : <0x8ac> <1><8ac>: Abbrev Number: 17 (DW_TAG_array_type) <8ad> DW_AT_type : <0x29d> <2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type) <2><8b6>: Abbrev Number: 0 ... As mentioned in commit 858c8f2c1b9 "gdb/testsuite: adjust gdb.python/flexible-array-member.exp expected pattern": ... Ideally, GDB would present a consistent and documented value for an array member declared with size 0, regardless of how the debug info looks like. ... As in gdb.python/flexible-array-member.exp, change the test to accept the two values. Tested on x86_64-linux. --- gdb/testsuite/gdb.guile/scm-type.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp index ccde98ca224..e5eaab365cc 100644 --- a/gdb/testsuite/gdb.guile/scm-type.exp +++ b/gdb/testsuite/gdb.guile/scm-type.exp @@ -267,7 +267,7 @@ proc test_range {} { gdb_scm_test_silent_cmd "guile (define f (history-ref 0))" \ "get value (f) from history" gdb_test "guile (print (type-range (field-type (type-field (value-type (value-dereference f)) \"items\"))))" \ - "= \\(0 0\\)" + "= \\(0 (0|-1)\\)" gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 0))" \ "= 111" gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 1))" \ ++++++ gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch ++++++ [gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp On OBS I ran into a failure in test-case gdb.threads/thread-specific-bp.exp: ... (gdb) PASS: gdb.threads/thread-specific-bp.exp: non-stop: continue to end info breakpoint^M Num Type Disp Enb Address What^M 1 breakpoint keep y 0x0000555555555167 in main at $src:36^M breakpoint already hit 1 time^M 2 breakpoint keep y 0x0000555555555151 in start at $src:23^M breakpoint already hit 1 time^M 3 breakpoint keep y 0x0000555555555167 in main at $src:36 thread 2^M stop only in thread 2^M 4 breakpoint keep y 0x000055555555515c in end at $src:29^M breakpoint already hit 1 time^M (gdb) [Thread 0x7ffff7db1640 (LWP 19984) exited]^M Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M FAIL: gdb.threads/thread-specific-bp.exp: non-stop: \ thread-specific breakpoint was deleted (timeout) ... Fix this by waiting for the "[Thread 0x7ffff7db1640 (LWP 19984) exited]" message before issuing the "info breakpoint command". Tested on x86_64-linux. --- gdb/testsuite/gdb.threads/thread-specific-bp.exp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp index c59a65b3150..50f90edea55 100644 --- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp +++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp @@ -88,9 +88,24 @@ proc check_thread_specific_breakpoint {mode} { set cmd "continue" } set test "continue to end" - gdb_test_multiple "$cmd" $test { - -re "Breakpoint .* end .* at .*\r\n$gdb_prompt " { - pass $test + set thread_exited 0 + set prompt 0 + gdb_test_multiple "$cmd" $test -lbl { + -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" { + if { $prompt } { + pass $gdb_test_name + } else { + set thread_exited 1 + exp_continue + } + } + -re "\r\n$gdb_prompt " { + if { $thread_exited } { + pass $gdb_test_name + } else { + set prompt 1 + exp_continue + } } } ++++++ gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch ++++++ --- /var/tmp/diff_new_pack.wOBhte/_old 2021-12-02 02:12:34.355153398 +0100 +++ /var/tmp/diff_new_pack.wOBhte/_new 2021-12-02 02:12:34.355153398 +0100 @@ -1,3 +1,5 @@ +gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp + [gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp On OBS with openSUSE Leap 15.2 and target board unix/m32, I run into: @@ -23,11 +25,11 @@ Tested on x86_64-linux. --- - gdb/testsuite/gdb.threads/detach-step-over.exp | 24 ++++++++++++++++++++++-- - 1 file changed, 22 insertions(+), 2 deletions(-) + gdb/testsuite/gdb.threads/detach-step-over.exp | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp -index 27718551188..9c5f98efeef 100644 +index 27718551188..d6fba07b486 100644 --- a/gdb/testsuite/gdb.threads/detach-step-over.exp +++ b/gdb/testsuite/gdb.threads/detach-step-over.exp @@ -203,7 +203,8 @@ proc test {condition_eval target_non_stop non_stop displaced} { @@ -40,16 +42,18 @@ -re "\\(running\\)" { incr running_count exp_continue -@@ -225,9 +226,28 @@ proc test {condition_eval target_non_stop non_stop displaced} { +@@ -224,10 +225,29 @@ proc test {condition_eval target_non_stop non_stop displaced} { + } } } - -re "$gdb_prompt $" { +- -re "$gdb_prompt $" { - gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name ++ -re "$gdb_prompt " { } } + if { $interrupted == 0 } { + while { $running_count < $running_expected } { -+ sleep 1 ++ sleep 10 + set prev_running_count $running_count + set running_count 0 + gdb_test_multiple "info threads" "threads running" { ++++++ gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch ++++++ [gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp On OBS I ran into: ... (gdb) PASS: gdb.base/foll-vfork.exp: exit: \ vfork relations in info inferiors: continue to child exit info inferiors^M Num Description Connection Executable ^M 1 <null> foll-vfork-exit ^M * 2 <null> foll-vfork-exit ^M (gdb) I'm the proud parent of child #5044!^M FAIL: gdb.base/foll-vfork.exp: exit: vfork relations in info inferiors: \ vfork relation no longer appears in info inferiors (timeout) ... Fix this by removing the '$' anchor in the corresponding '$gdb_prompt $' regexps. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/foll-vfork.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index 577bd4d573b..a781a5c2087 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -374,13 +374,13 @@ proc vfork_relations_in_info_inferiors { variant } { set test "vfork relation no longer appears in info inferiors" gdb_test_multiple "info inferiors" $test { - -re "is vfork child of inferior 1.*$gdb_prompt $" { + -re "is vfork child of inferior 1.*$gdb_prompt " { fail $test } - -re "is vfork parent of inferior 2.*$gdb_prompt $" { + -re "is vfork parent of inferior 2.*$gdb_prompt " { fail $test } - -re "$gdb_prompt $" { + -re "$gdb_prompt " { pass $test } } ++++++ gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch ++++++ [gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie When running test-case gdb.base/step-indirect-call-thunk.exp with target board unix/-m32/-fPIE/-pie, I run into: ... (gdb) stepi^M 0x5655552e 22 { /* inc.1 */^M (gdb) stepi^M 0x56555530 22 { /* inc.1 */^M (gdb) stepi^M 0x565555f7 in __x86.get_pc_thunk.ax ()^M (gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk ... In contrast, with unix/-m32 we have instead: ... (gdb) stepi^M 0x08048407 22 { /* inc.1 */^M (gdb) stepi^M 23 return x + 1; /* inc.2 */^M (gdb) stepi^M 0x0804840c 23 return x + 1; /* inc.2 */^M (gdb) stepi^M 24 } /* inc.3 */^M (gdb) stepi^M 0x08048410 24 } /* inc.3 */^M (gdb) stepi^M 0x0804848f in __x86_return_thunk ()^M (gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk ... The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a PIC helper function for x86_64-linux. Fix this by insn-stepping through it. Likewise in a few other test-cases. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/step-indirect-call-thunk.exp | 5 ++++- gdb/testsuite/gdb.base/step-test.exp | 4 +++- gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp | 6 ++++-- gdb/testsuite/gdb.reverse/step-precsave.exp | 10 ++++++++++ gdb/testsuite/gdb.reverse/step-reverse.exp | 10 ++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp index d84a0232265..18f5bdcbe9a 100644 --- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp +++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp @@ -65,9 +65,12 @@ gdb_test "step" "inc\.2.*" "step through call thunk into inc" gdb_test "step" "inc\.3.*" "step inside inc" gdb_test "step" "thrice\.4.*" "step through return thunk back into thrice" +set alphanum_re "\[a-zA-Z0-9\]" +set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" + # We can use instruction stepping to step into thunks. stepi_until "thrice" "indirect_thunk" "stepi into call thunk" stepi_until "indirect_thunk" "inc." "stepi out of call thunk into inc" -stepi_until "inc" "return_thunk" "stepi into return thunk" +stepi_until "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" stepi_until "return_thunk" "thrice" \ "stepi out of return thunk back into thrice" diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp index 8664b3eda22..5f480e07edd 100644 --- a/gdb/testsuite/gdb.base/step-test.exp +++ b/gdb/testsuite/gdb.base/step-test.exp @@ -128,8 +128,10 @@ test_i "stepi into function" "stepi" \ # Continue to step until we reach the function's body. This makes it # more likely that we've actually completed the prologue, so "finish" # will work. +set alphanum_re "\[a-zA-Z0-9\]" +set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" test_i "stepi into function's first source line" "stepi" \ - ".*${decimal}.*int callee" \ + "(${decimal}.*int callee|$pic_thunk_re)" \ ".*${decimal}.*myglob.*; return 0;" # Have to be careful here, if the finish does not work, diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp index dad43d78e6b..1f43206074f 100644 --- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp +++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp @@ -86,7 +86,9 @@ gdb_test "reverse-next" "apply\.2.*" \ step_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" step_until "stepi" "indirect_thunk" "inc" \ "stepi out of call thunk into inc" -step_until "stepi" "inc" "return_thunk" "stepi into return thunk" +set alphanum_re "\[a-zA-Z0-9\]" +set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" +step_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" step_until "stepi" "return_thunk" "apply" \ "stepi out of return thunk back into apply" @@ -94,7 +96,7 @@ step_until "reverse-stepi" "apply" "return_thunk" \ "reverse-stepi into return thunk" step_until "reverse-stepi" "return_thunk" "inc" \ "reverse-stepi out of return thunk into inc" -step_until "reverse-stepi" "inc" "indirect_thunk" \ +step_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ "reverse-stepi into call thunk" step_until "reverse-stepi" "indirect_thunk" "apply" \ "reverse-stepi out of call thunk into apply" diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp index 43f6ab3a11a..e85cdabfb73 100644 --- a/gdb/testsuite/gdb.reverse/step-precsave.exp +++ b/gdb/testsuite/gdb.reverse/step-precsave.exp @@ -124,6 +124,8 @@ gdb_test_multiple "stepi" "$test_message" { # stepi into a function call +set alphanum_re "\[a-zA-Z0-9\]" +set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" set test_message "stepi into function call" gdb_test_multiple "stepi" "$test_message" { -re "ARRIVED IN CALLEE.*$gdb_prompt $" { @@ -143,6 +145,10 @@ gdb_test_multiple "stepi" "$test_message" { send_gdb "stepi\n" exp_continue } + -re "$pic_thunk_re.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } } # stepi thru return of a function call @@ -216,6 +222,10 @@ gdb_test_multiple "stepi" "$test_message" { send_gdb "stepi\n" exp_continue } + -re "$pic_thunk_re.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { send_gdb "stepi\n" exp_continue diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp index 335ccfbd399..32c18faaaa6 100644 --- a/gdb/testsuite/gdb.reverse/step-reverse.exp +++ b/gdb/testsuite/gdb.reverse/step-reverse.exp @@ -87,6 +87,8 @@ gdb_test_multiple "stepi" "$test_message" { # stepi into a function call +set alphanum_re "\[a-zA-Z0-9\]" +set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" set test_message "stepi into function call" gdb_test_multiple "stepi" "$test_message" { -re "ARRIVED IN CALLEE.*$gdb_prompt $" { @@ -106,6 +108,10 @@ gdb_test_multiple "stepi" "$test_message" { send_gdb "stepi\n" exp_continue } + -re "$pic_thunk_re.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } } # stepi thru return of a function call @@ -179,6 +185,10 @@ gdb_test_multiple "stepi" "$test_message" { send_gdb "stepi\n" exp_continue } + -re "$pic_thunk_re.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue + } -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { send_gdb "stepi\n" exp_continue ++++++ import-patches.sh ++++++ --- /var/tmp/diff_new_pack.wOBhte/_old 2021-12-02 02:12:34.447153118 +0100 +++ /var/tmp/diff_new_pack.wOBhte/_new 2021-12-02 02:12:34.447153118 +0100 @@ -3,6 +3,11 @@ # Invoke as: # $ ./import-patches.sh [ --dry-run ] <n> <dir>/00*.patch +usage () +{ + echo "./import-patches.sh [ --dry-run ] <n> <files>+" +} + dryrun=false case "$1" in -dryrun|-dry-run|--dryrun|--dry-run) @@ -14,6 +19,27 @@ n="$1" shift +case $n in + "") + echo "Missing <n> argument" + usage + exit 1 + ;; + [0-9][0-9]*) + ;; + *) + echo "Need numeric <n> argument" + usage + exit 1 + ;; +esac + +if [ "$n" = "" ]; then + echo "Missing <n> argument" + usage + exit 1 +fi + files="$*" rm -Rf tmp.patches @@ -40,6 +66,10 @@ # Copy. cp "$dir"/"$orig_f" tmp.patches/"$f" + # Filter out ChangeLog entries. + filterdiff -x "*/ChangeLog" tmp.patches/"$f" > tmp.patches/tmp."$f" + mv tmp.patches/tmp."$f" tmp.patches/"$f" + tmp="$tmp $f" done files="$tmp" ++++++ qa.sh ++++++ --- /var/tmp/diff_new_pack.wOBhte/_old 2021-12-02 02:12:34.475153033 +0100 +++ /var/tmp/diff_new_pack.wOBhte/_new 2021-12-02 02:12:34.479153020 +0100 @@ -1,23 +1,50 @@ #!/bin/bash -if [ $# -eq 0 ]; then - echo "usage: $0 <1-5> [dir]" +# Note: +# Occasionally we run into PR28561 - "[gdb/testsuite] Error due to not +# reading \r\n at end of mi prompt". +# https://sourceware.org/bugzilla/show_bug.cgi?id=28561 +# Not sure how to filter for that. + +# TODO: +# +# We run into FAILs like this: +# FAIL: gdb.base/options.exp: test-print: \ +# tab complete "thread apply all print " (clearing input line) (timeout) +# FAIL: gdb.base/options.exp: test-print: \ +# cmd complete "thread apply all print " +# in various test-cases. One instance is reported here ( +# https://sourceware.org/bugzilla/show_bug.cgi?id=27813 ). +# We could do a generic kfail for "(clearing input line) (timeout)", but that +# doesn't filter out the following FAIL. We need to update the testsuite to +# emit only one FAIL for this, or alternatively, add a possibility in this +# script to KFAIL one and all following FAILs in the same test-case. + +usage () +{ + echo "usage: $0 <1-5>" + echo " $0 <6> <dir>" echo "Verify remote results at:" echo " ./binaries-testsuite.distro.arch/gdb-testresults" echo "1: gdb.sum: Check for 'FAIL: .* internal error' (all configs)" echo "2: gdb.sum: Check for 'ERROR:' (all configs)" echo "3: gdb.log: Check for 'internal-error:' (all configs)" echo "4: gdb.sum: Check FAIL and ERROR (known clean configs)" + echo "5: gdb.sum: Check gdb.suse PASS (all configs)" echo "Verify local results at:" echo " \$dir" - echo "5: gdb.sum: Check FAIL and ERROR" + echo "6: gdb.sum: Check FAIL and ERROR" +} + +if [ $# -eq 0 ]; then + usage exit 1 fi n="$1" shift -if [ "$n" = "5" ]; then +if [ "$n" = "6" ]; then dir="$1" shift fi @@ -89,10 +116,25 @@ # https://sourceware.org/bugzilla/show_bug.cgi?id=25503 "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26915 - "FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=0: other threads ran - unlocked" - "FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=step: other threads ran - unlocked" + "FAIL: gdb.threads/schedlock.exp: schedlock=off: .*: other threads ran - unlocked" # https://sourceware.org/bugzilla/show_bug.cgi?id=28479 "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26273 + "FAIL: gdb.threads/gcore-stale-thread.exp: save a corefile" + "FAIL: gdb.threads/gcore-stale-thread.exp: exited thread is current due to non-stop" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28467 + # -pie, x86_64 -m32 or i586. + "FAIL: gdb.base/nodebug.exp: p/c \(int\) array_index\(\"abcdef\",2\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28617 + "FAIL: gdb.base/info-os.exp: get process groups \(timeout\)" + "FAIL: gdb.base/info-os.exp: get threads \(timeout\)" + "FAIL: gdb.base/info-os.exp: get file descriptors \(timeout\)" + "FAIL: gdb.base/info-os.exp: get internet-domain sockets \(timeout\)" + "FAIL: gdb.base/info-os.exp: get shared-memory regions \(timeout\)" + "FAIL: gdb.base/info-os.exp: get semaphores \(timeout\)" + "FAIL: gdb.base/info-os.exp: get message queues \(timeout\)" + "FAIL: gdb.base/info-os.exp: info os unknown_entry \(timeout\)" + "FAIL: gdb.base/info-os.exp: continue \(timeout\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 # https://sourceware.org/bugzilla/show_bug.cgi?id=28275 @@ -131,6 +173,8 @@ # https://sourceware.org/bugzilla/show_bug.cgi?id=27238 "FAIL: gdb.go/package.exp: setting breakpoint at package2.Foo" "FAIL: gdb.go/package.exp: going to first breakpoint \(the program exited\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28551 + "FAIL: gdb.go/package.exp: going to first breakpoint \\(GDB internal error\\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=28468 "FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over (yes|no): signal SIGUSR1" # https://sourceware.org/bugzilla/show_bug.cgi?id=28477 @@ -140,8 +184,8 @@ # https://sourceware.org/bugzilla/show_bug.cgi?id=26867 "FAIL: gdb.threads/signal-sigtrap.exp: sigtrap thread 1: signal SIGTRAP reaches handler" # https://sourceware.org/bugzilla/show_bug.cgi?id=28510 - FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: br main - FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: l + "FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: br main" + "FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: l" ) case $n in @@ -149,6 +193,8 @@ # 'FAIL: .* internal error' in gdb.sum. # Test fail due to internal error. # + # Todo: apply kfail_factory only on factory sum files. + kfail+=("${kfail_factory[@]}") kfail_re=$(join "|" "${kfail[@]}") grep "^FAIL:.*internal error" binaries-testsuite*/gdb-testresults/*.sum \ | grep -E -v "$kfail_re" @@ -159,8 +205,6 @@ # A dejagnu or tcl ERROR, may hide real problems. # kfail+=( - # https://sourceware.org/bugzilla/show_bug.cgi?id=28355 - "openSUSE_Factory_ARM.aarch64.*UNRESOLVED: gdb.server/.*.exp: (ensure inferior is running|set sysroot remote)" # https://sourceware.org/bugzilla/show_bug.cgi?id=28323 "SLE-12.x86_64.*gdb.ada/mi_dyn_arr.exp" ) @@ -183,6 +227,12 @@ "thread.c:[0-9]*: internal-error: .* inferior_thread\(\): Assertion \`current_thread_ \!= nullptr' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 "linux-nat.c:[0-9]*: internal-error: wait returned unexpected status" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28553 + "infrun.c:[0-9]*: internal-error: thread .* needs a step-over, but not in step-over queue" + # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 + "linux-nat.c:[0-9]*: internal-error: wait returned unexpected" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28604 + "x86-linux-dregs.c:[0-9]*: internal-error: void x86_linux_update_debug_registers\(lwp_info\*\): Assertion \`lwp_is_stopped \(lwp\)' failed." ) kfail_re=$(join "|" "${kfail[@]}") @@ -197,35 +247,33 @@ # Note: below we avoid gdb-x86_64-suse-linux-m32.sum (the pie variant). # That one hasn't been cleaned up. - # Known clean config: Leap 15.1 x86_64. - config=openSUSE_Leap_15.1.x86_64/gdb-testresults - sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" - "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") - # Known clean config: Leap 15.2 x86_64. config=openSUSE_Leap_15.2.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") # Known clean config: Leap 15.3 x86_64 config=openSUSE_Leap_15.3.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") # Known clean config: SLE 15 x86_64. config=SLE-15.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") # Known cleanish config: Factory x86_64. config=openSUSE_Factory.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") kfail+=("${kfail_factory[@]}") @@ -236,6 +284,19 @@ ;; 5) + librpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \ + | 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" + ;; + + 6) sums=() mapfile -t < <(echo_line "$dir"/*-m64.-fno-PIE.-no-pie.sum) @@ -244,6 +305,8 @@ sums+=("${MAPFILE[@]}") mapfile -t < <(echo_line "$dir"/*-m32.-fno-PIE.-no-pie.sum) sums+=("${MAPFILE[@]}") + mapfile -t < <(echo_line "$dir"/*-m32.sum) + sums+=("${MAPFILE[@]}") # Assume this is factory. kfail+=("${kfail_factory[@]}")