- 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

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=300
This commit is contained in:
Tom de Vries 2021-11-09 07:27:17 +00:00 committed by Git OBS Bridge
parent 08e183474c
commit 928d283fb2
4 changed files with 97 additions and 34 deletions

View File

@ -27,10 +27,10 @@ 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(-)
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
@ -108,10 +108,10 @@ index a5941a4071e..c78a510c1a7 100644
}
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
index 00000000000..88a2e445b59
--- /dev/null
+++ b/gdb/testsuite/lib/precise-aligned-alloc.c
@@ -0,0 +1,89 @@
@@ -0,0 +1,131 @@
+/* This test file is part of GDB, the GNU debugger.
+
+ Copyright 2021 Free Software Foundation, Inc.
@ -135,6 +135,59 @@ index 00000000000..67b6f2bc618
+#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.
+
@ -149,27 +202,13 @@ index 00000000000..67b6f2bc618
+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);
+ /* 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_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;
+ }
+ void *p_end = p + alloc_size;
+
+ p += alignment;
+
@ -178,13 +217,16 @@ index 00000000000..67b6f2bc618
+ assert (p + size <= p_end);
+
+ /* Verify required alignment. */
+ mask = (alignment - 1);
+ size_t mask = (alignment - 1);
+ assert (((uintptr_t)p & mask) == 0);
+
+ /* Verify required alignment is precise. */
+ mask = (used_alignment - 1);
+ mask = ((2 * alignment) - 1);
+ assert (((uintptr_t)p & mask) != 0);
+
+ if (free_pointer != NULL)
+ *free_pointer = p_orig;
+
+ return p;
+}
+

View File

@ -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 @@ Fix this by counting the running threads in a loop.
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,11 +42,13 @@ index 27718551188..9c5f98efeef 100644
-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 } {

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Nov 8 14:53:20 UTC 2021 - Tom de Vries <tdevries@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 <tdevries@suse.com>

11
qa.sh
View File

@ -1,5 +1,11 @@
#!/bin/bash
# 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:
@ -110,10 +116,11 @@ kfail=(
# 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"
# https://sourceware.org/bugzilla/show_bug.cgi?id=26284
# https://sourceware.org/bugzilla/show_bug.cgi?id=28275