public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v4 6/6] gdb/testsuite: Add kfail in gdb.threads/threadcrash.exp on 32-bit arm targets
Date: Fri,  8 Mar 2024 10:33:42 +0100	[thread overview]
Message-ID: <20240308093342.26745-7-tdevries@suse.de> (raw)
In-Reply-To: <20240308093342.26745-1-tdevries@suse.de>

There is an issue with the test gdb.threads/threadcrash.exp on arm
targets, relating to how the targets handles gcores.  The issue is that GDB
can't properly backtrace from a gcore.

Add a kfail referring back to PR corefiles/31294, which tracks the issues with
gcores in 32-bit arm targets.

I cannot reproduce the problem, so this is a best effort based on the logs in
the PR.

Tested on arm-linux and x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31294
---
 gdb/testsuite/gdb.threads/threadcrash.exp | 27 +++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index c72ce73fd6d..7839f5c358e 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -94,14 +94,14 @@ proc thread_apply_all {} {
 	}
     }
 
-    gdb_assert {$unwind_fail == false}
-
     if { $have_sleep == -1 } {
 	set have_sleep 0
     }
     if { $have_pthread_kill == -1 } {
 	set have_pthread_kill 0
     }
+
+    return [expr !$unwind_fail]
 }
 
 # Perform all the tests we're interested in.  They are:
@@ -109,16 +109,25 @@ proc thread_apply_all {} {
 # * Creating the list of backtraces for all threads seen
 # * testing if GDB recreated the full backtrace we expect for all threads
 
-proc do_full_test {} {
+proc do_full_test { phase } {
     global have_sleep
     global have_pthread_kill
     global test_list
     set thread_count [get_valueof "" "\$_inferior_thread_count" 0]
     gdb_assert {$thread_count == 7}
 
-    thread_apply_all
-
-    gdb_assert {$thread_count == [llength $test_list]}
+    set test thread_apply_all
+    set res [$test]
+    if { $res && $thread_count == [llength $test_list] } {
+	pass $test
+    } else {
+	set have_kfail [expr [string equal $phase gcore] && [is_aarch32_target]]
+	if { $have_kfail } {
+	    kfail $test
+	} else {
+	    fail $test
+	}
+    }
 
     if { $have_sleep } {
 	set sleep ".*sleep.*"
@@ -209,7 +218,7 @@ proc_with_prefix test_live_inferior {} {
     gdb_breakpoint "breakpt"
     gdb_continue_to_breakpoint "running to breakpoint" ".*"
 
-    do_full_test
+    do_full_test live_inferior
 }
 
 # Do all preparation steps for running the corefile tests, then
@@ -229,7 +238,7 @@ proc_with_prefix test_corefile {} {
 	     "A program is being debugged already\\\.  Kill it\\\? \\\(y or n\\\) " \
 	     "y"
 
-    do_full_test
+    do_full_test corefile
 }
 
 # Do all preparation steps for running the gcore tests, then
@@ -267,7 +276,7 @@ proc_with_prefix test_gcore {} {
 	     "A program is being debugged already\\\.  Kill it\\\? \\\(y or n\\\) " \
 	     "y"
 
-    do_full_test
+    do_full_test gcore
 }
 
 standard_testfile
-- 
2.35.3


  parent reply	other threads:[~2024-03-08 10:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  9:33 [PATCH v4 0/6] Fixes to gdb.threads/threadcrash.exp Tom de Vries
2024-03-08  9:33 ` [PATCH v4 1/6] gdb/testsuite: Reduce indentation in gdb.threads/threadcrash.exp Tom de Vries
2024-03-13 17:12   ` Tom Tromey
2024-03-08  9:33 ` [PATCH v4 2/6] gdb/testsuite: Fix gdb.threads/threadcrash.exp with check-readmore Tom de Vries
2024-03-13 17:17   ` Tom Tromey
2024-03-08  9:33 ` [PATCH v4 3/6] gdb/testsuite: Use _inferior_thread_count in gdb.threads/threadcrash.exp Tom de Vries
2024-03-08  9:33 ` [PATCH v4 4/6] gdb/testsuite: Simplify gdb.threads/threadcrash.exp Tom de Vries
2024-03-08  9:33 ` [PATCH v4 5/6] gdb/testsuite: Reduce gdb.threads/threadcrash.exp reliance on libc symbols Tom de Vries
2024-03-08  9:33 ` Tom de Vries [this message]
2024-03-08 10:24   ` [PATCH v4 6/6] gdb/testsuite: Add kfail in gdb.threads/threadcrash.exp on 32-bit arm targets Tom de Vries
2024-03-08 23:57     ` Thiago Jung Bauermann
2024-03-11 10:15       ` Tom de Vries
2024-03-11 18:10         ` Thiago Jung Bauermann
2024-03-11 23:03           ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308093342.26745-7-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).