diff --git a/aarch64-make-gdbserver-register-set-selection-dynamic.patch b/aarch64-make-gdbserver-register-set-selection-dynamic.patch new file mode 100644 index 0000000..adb2528 --- /dev/null +++ b/aarch64-make-gdbserver-register-set-selection-dynamic.patch @@ -0,0 +1,314 @@ +[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 + + PR gdb/28355 + + * arch/aarch64.h (struct aarch64_features): New struct. + +gdbserver/ChangeLog: + +2021-11-03 Luis Machado + + 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/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" + ++/* Holds information on what architectural features are available. This is ++ used to select register sets. */ ++struct aarch64_features ++{ ++ bool sve = false; ++ bool pauth = false; ++ bool mte = false; ++}; ++ + /* 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 +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; + } + +-/* Return true if the regcache contains the number of SVE registers. */ +- +-static bool +-is_sve_tdesc (void) +-{ +- struct regcache *regcache = get_thread_regcache (current_thread, 0); +- +- return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.sve"); +-} +- + static void + aarch64_fill_gregset (struct regcache *regcache, void *buf) + { +@@ -680,40 +670,6 @@ aarch64_target::low_new_fork (process_info *parent, + *child->priv->arch_private = *parent->priv->arch_private; + } + +-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ +-#define AARCH64_HWCAP_PACA (1 << 30) +- +-/* Implementation of linux target ops method "low_arch_setup". */ +- +-void +-aarch64_target::low_arch_setup () +-{ +- unsigned int machine; +- int is_elf64; +- int tid; +- +- tid = lwpid_of (current_thread); +- +- is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); +- +- if (is_elf64) +- { +- uint64_t vq = aarch64_sve_get_vq (tid); +- unsigned long hwcap = linux_get_hwcap (8); +- unsigned long hwcap2 = linux_get_hwcap2 (8); +- bool pauth_p = hwcap & AARCH64_HWCAP_PACA; +- /* MTE is AArch64-only. */ +- bool mte_p = hwcap2 & HWCAP2_MTE; +- +- current_process ()->tdesc +- = aarch64_linux_read_description (vq, pauth_p, mte_p); +- } +- else +- current_process ()->tdesc = aarch32_linux_read_description (); +- +- aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); +-} +- + /* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */ + + static void +@@ -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); + } + ++/* Array containing all the possible register sets for AArch64/Linux. During ++ architecture setup, these will be checked against the HWCAP/HWCAP2 bits for ++ validity and enabled/disabled accordingly. ++ ++ 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. */ + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, +- sizeof (struct user_pt_regs), GENERAL_REGS, ++ 0, GENERAL_REGS, + aarch64_fill_gregset, aarch64_store_gregset }, ++ /* Floating Point (FPU) registers. */ + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, +- sizeof (struct user_fpsimd_state), FP_REGS, ++ 0, FP_REGS, + aarch64_fill_fpregset, aarch64_store_fpregset + }, ++ /* Scalable Vector Extension (SVE) registers. */ ++ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE, ++ 0, EXTENDED_REGS, ++ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache ++ }, ++ /* PAC registers. */ + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, +- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, +- NULL, aarch64_store_pauthregset }, ++ 0, OPTIONAL_REGS, ++ nullptr, aarch64_store_pauthregset }, ++ /* Tagged address control / MTE registers. */ + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, +- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset, +- aarch64_store_mteregset }, ++ 0, OPTIONAL_REGS, ++ aarch64_fill_mteregset, aarch64_store_mteregset }, + NULL_REGSET + }; + +@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info = + { + aarch64_regsets, /* regsets */ + 0, /* num_regsets */ +- NULL, /* disabled_regsets */ ++ nullptr, /* disabled_regsets */ + }; + + static struct regs_info regs_info_aarch64 = + { +- NULL, /* regset_bitmap */ +- NULL, /* usrregs */ ++ nullptr, /* regset_bitmap */ ++ nullptr, /* usrregs */ + &aarch64_regsets_info, + }; + +-static struct regset_info aarch64_sve_regsets[] = ++/* Given FEATURES, adjust the available register sets by setting their ++ sizes. A size of 0 means the register set is disabled and won't be ++ used. */ ++ ++static void ++aarch64_adjust_register_sets (const struct aarch64_features &features) + { +- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, +- sizeof (struct user_pt_regs), GENERAL_REGS, +- aarch64_fill_gregset, aarch64_store_gregset }, +- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE, +- SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS, +- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache +- }, +- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, +- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, +- NULL, aarch64_store_pauthregset }, +- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, +- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset, +- aarch64_store_mteregset }, +- NULL_REGSET +-}; ++ struct regset_info *regset; + +-static struct regsets_info aarch64_sve_regsets_info = +- { +- aarch64_sve_regsets, /* regsets. */ +- 0, /* num_regsets. */ +- NULL, /* disabled_regsets. */ +- }; ++ for (regset = aarch64_regsets; regset->size >= 0; regset++) ++ { ++ switch (regset->nt_type) ++ { ++ case NT_PRSTATUS: ++ /* General purpose registers are always present. */ ++ regset->size = sizeof (struct user_pt_regs); ++ break; ++ case NT_FPREGSET: ++ /* This is unavailable when SVE is present. */ ++ if (!features.sve) ++ regset->size = sizeof (struct user_fpsimd_state); ++ break; ++ case NT_ARM_SVE: ++ if (features.sve) ++ regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE); ++ break; ++ case NT_ARM_PAC_MASK: ++ if (features.pauth) ++ regset->size = AARCH64_PAUTH_REGS_SIZE; ++ break; ++ case NT_ARM_TAGGED_ADDR_CTRL: ++ if (features.mte) ++ regset->size = AARCH64_LINUX_SIZEOF_MTE; ++ break; ++ default: ++ gdb_assert_not_reached ("Unknown register set found."); ++ } ++ } ++} + +-static struct regs_info regs_info_aarch64_sve = +- { +- NULL, /* regset_bitmap. */ +- NULL, /* usrregs. */ +- &aarch64_sve_regsets_info, +- }; ++/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ ++#define AARCH64_HWCAP_PACA (1 << 30) ++ ++/* Implementation of linux target ops method "low_arch_setup". */ ++ ++void ++aarch64_target::low_arch_setup () ++{ ++ unsigned int machine; ++ int is_elf64; ++ int tid; ++ ++ tid = lwpid_of (current_thread); ++ ++ is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); ++ ++ if (is_elf64) ++ { ++ struct aarch64_features features; ++ ++ uint64_t vq = aarch64_sve_get_vq (tid); ++ features.sve = (vq > 0); ++ /* A-profile PAC is 64-bit only. */ ++ features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA; ++ /* A-profile MTE is 64-bit only. */ ++ features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE; ++ ++ current_process ()->tdesc ++ = aarch64_linux_read_description (vq, features.pauth, features.mte); ++ ++ /* Adjust the register sets we should use for this particular set of ++ features. */ ++ aarch64_adjust_register_sets (features); ++ } ++ else ++ current_process ()->tdesc = aarch32_linux_read_description (); ++ ++ aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); ++} + + /* Implementation of linux target ops method "get_regs_info". */ + +@@ -802,9 +821,7 @@ aarch64_target::get_regs_info () + if (!is_64bit_tdesc ()) + return ®s_info_aarch32; + +- if (is_sve_tdesc ()) +- return ®s_info_aarch64_sve; +- ++ /* AArch64 64-bit registers. */ + return ®s_info_aarch64; + } + +@@ -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); + } diff --git a/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch b/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch deleted file mode 100644 index bea6368..0000000 --- a/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch +++ /dev/null @@ -1,88 +0,0 @@ -[gdb/testsuite] Add checks to gdb.arch/i386-sse.exp - -In test-case gdb.arch/i386-sse.exp, add the steps marked with "(added)": -- verify data array (added) -- initialize regs from data array -- verify regs -- modify regs -- verify modified regs (added) -- write back regs to data array -- verify updated data array - -This in the hope to catch more information about failures in this test-case -reported in PR28504. - -Also use gdb_test_no_output instead of gdb_test for the "modify regs" step. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.arch/i386-sse.exp | 33 ++++++++++++++++++++++++++------- - 1 file changed, 26 insertions(+), 7 deletions(-) - -diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp -index fca90256505..57f62694e6e 100644 ---- a/gdb/testsuite/gdb.arch/i386-sse.exp -+++ b/gdb/testsuite/gdb.arch/i386-sse.exp -@@ -64,17 +64,26 @@ gdb_expect { - } - } - --gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -- "Breakpoint .* at .*i386-sse.c.*" \ -- "set first breakpoint in main" --gdb_continue_to_breakpoint "continue to first breakpoint in main" -- - if [is_amd64_regs_target] { - set nr_regs 16 - } else { - set nr_regs 8 - } - -+# Verify data array. -+for { set r 0 } { $r < $nr_regs } { incr r } { -+ gdb_test "print data\[$r\]" \ -+ ".. = \\{f = \\{$r, $r.25, $r.5, $r.75\\}\\}.*" \ -+ "check contents of data\[$r\]" -+} -+ -+# Initialize regs from data array. -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*i386-sse.c.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+# Verify regs. - for { set r 0 } { $r < $nr_regs } { incr r } { - gdb_test "print \$xmm$r.v4_float" \ - ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \ -@@ -84,17 +93,27 @@ for { set r 0 } { $r < $nr_regs } { incr r } { - "check int8 contents of %xmm$r" - } - -+# Modify regs. - for { set r 0 } { $r < $nr_regs } { incr r } { -- gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r" -+ gdb_test_no_output "set var \$xmm$r.v4_float\[0\] = $r + 10" "set %xmm$r" - } - -+# Verify modified regs. -+for { set r 0 } { $r < $nr_regs } { incr r } { -+ gdb_test "print \$xmm$r.v4_float" \ -+ ".. = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}.*" \ -+ "check contents of %xmm$r" -+} -+ -+# Write back regs to data array. - gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*i386-sse.c.*" \ - "set second breakpoint in main" - gdb_continue_to_breakpoint "continue to second breakpoint in main" - -+# Verify updated data array. - for { set r 0 } { $r < $nr_regs } { incr r } { - gdb_test "print data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ -- "check contents of data\[$r\]" -+ "check contents of updated data\[$r\]" - } diff --git a/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch b/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch new file mode 100644 index 0000000..d452fee --- /dev/null +++ b/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch @@ -0,0 +1,203 @@ +[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 | 89 +++++++++++++++++++++++++++++++ + 3 files changed, 106 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..67b6f2bc618 +--- /dev/null ++++ b/gdb/testsuite/lib/precise-aligned-alloc.c +@@ -0,0 +1,89 @@ ++/* 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 . ++*/ ++ ++#include ++#include ++#include ++#include ++ ++/* 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) ++{ ++ size_t used_alignment = 2 * alignment; ++ size_t used_size = size + used_alignment; ++ ++ void *p = malloc (used_size); ++ assert (p != NULL); ++ void *p_end = p + used_size; ++ ++ if (free_pointer != NULL) ++ *free_pointer = p; ++ ++ void *p_orig = p; ++ ++ /* Align to used_alignment. */ ++ size_t mask = (used_alignment - 1); ++ if (((uintptr_t)p & mask) == 0) ++ ; ++ else ++ { ++ p = (void*)((uintptr_t)p & ~mask); ++ p += used_alignment; ++ } ++ ++ 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. */ ++ mask = (alignment - 1); ++ assert (((uintptr_t)p & mask) == 0); ++ ++ /* Verify required alignment is precise. */ ++ mask = (used_alignment - 1); ++ assert (((uintptr_t)p & mask) != 0); ++ ++ 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; ++} diff --git a/gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch b/gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch new file mode 100644 index 0000000..473a0f4 diff --git a/gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch b/gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch similarity index 91% rename from gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch rename to gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch index d4f805e..f37d1f2 100644 --- a/gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch +++ b/gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch @@ -29,10 +29,10 @@ Tested on x86_64-linux. 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 331f9470c22..ceb2c25b066 100644 +index c59a65b3150..50f90edea55 100644 --- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp +++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp -@@ -87,9 +87,24 @@ proc check_thread_specific_breakpoint {mode} { +@@ -88,9 +88,24 @@ proc check_thread_specific_breakpoint {mode} { set cmd "continue" } set test "continue to end" @@ -42,7 +42,7 @@ index 331f9470c22..ceb2c25b066 100644 + set thread_exited 0 + set prompt 0 + gdb_test_multiple "$cmd" $test -lbl { -+ -re "\\\[Thread \[^\r\n\]* exited](?=\r\n)" { ++ -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" { + if { $prompt } { + pass $gdb_test_name + } else { @@ -50,7 +50,7 @@ index 331f9470c22..ceb2c25b066 100644 + exp_continue + } + } -+ -re -wrap "" { ++ -re "\r\n$gdb_prompt " { + if { $thread_exited } { + pass $gdb_test_name + } else { diff --git a/gdb.changes b/gdb.changes index c5e0c9a..0a7be89 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Sat Nov 6 09:25:28 UTC 2021 - Tom de Vries + +- 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 diff --git a/gdb.spec b/gdb.spec index 8380277..3c5e007 100644 --- a/gdb.spec +++ b/gdb.spec @@ -305,6 +305,7 @@ Patch1506: gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch 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. @@ -356,18 +357,19 @@ Patch2106: gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch 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 + BuildRequires: bison BuildRequires: flex @@ -742,6 +744,7 @@ find -name "*.info*"|xargs rm -f %patch1900 -p1 %patch1901 -p1 +%patch1902 -p1 %patch2000 -p1 %patch2001 -p1 @@ -776,12 +779,12 @@ find -name "*.info*"|xargs rm -f %patch2106 -p1 %patch2107 -p1 %patch2108 -p1 -%patch2109 -p1 %patch2110 -p1 %patch2111 -p1 %patch2112 -p1 -%patch2113 -p1 %patch2114 -p1 +%patch2115 -p1 +%patch2116 -p1 #unpack libipt %if 0%{have_libipt} diff --git a/import-patches.sh b/import-patches.sh index e275854..a7ffcaa 100644 --- a/import-patches.sh +++ b/import-patches.sh @@ -3,6 +3,11 @@ # Invoke as: # $ ./import-patches.sh [ --dry-run ] /00*.patch +usage () +{ + echo "./import-patches.sh [ --dry-run ] +" +} + dryrun=false case "$1" in -dryrun|-dry-run|--dryrun|--dry-run) @@ -14,6 +19,27 @@ esac n="$1" shift +case $n in + "") + echo "Missing argument" + usage + exit 1 + ;; + [0-9][0-9]*) + ;; + *) + echo "Need numeric argument" + usage + exit 1 + ;; +esac + +if [ "$n" = "" ]; then + echo "Missing argument" + usage + exit 1 +fi + files="$*" rm -Rf tmp.patches @@ -40,6 +66,10 @@ for f in $files; do # 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" diff --git a/qa.sh b/qa.sh index c6a35fd..212dfd1 100644 --- a/qa.sh +++ b/qa.sh @@ -1,7 +1,23 @@ #!/bin/bash -if [ $# -eq 0 ]; then - echo "usage: $0 <1-5> [dir]" +# 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> " echo "Verify remote results at:" echo " ./binaries-testsuite.distro.arch/gdb-testresults" echo "1: gdb.sum: Check for 'FAIL: .* internal error' (all configs)" @@ -12,6 +28,10 @@ if [ $# -eq 0 ]; then echo "Verify local results at:" echo " \$dir" echo "6: gdb.sum: Check FAIL and ERROR" +} + +if [ $# -eq 0 ]; then + usage exit 1 fi