public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes to gdb.threads/threadcrash.exp
@ 2024-02-01 15:58 Guinevere Larsen
  2024-02-01 15:58 ` [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets Guinevere Larsen
  2024-02-01 15:58 ` [PATCH 2/2] gdb/testsuite: reduce gdb.threads/threadcrash.exp reliance on libc symbols Guinevere Larsen
  0 siblings, 2 replies; 4+ messages in thread
From: Guinevere Larsen @ 2024-02-01 15:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

The test was recently pushed to master but it had a couple of small
issues. This is a quick series to fix the 2 major issues that were
brought up to my attention. 

Guinevere Larsen (2):
  gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets
  gdb/testsuite: reduce gdb.threads/threadcrash.exp reliance on libc
    symbols

 gdb/testsuite/gdb.threads/threadcrash.exp | 32 +++++++++++------------
 1 file changed, 15 insertions(+), 17 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets
  2024-02-01 15:58 [PATCH 0/2] Fixes to gdb.threads/threadcrash.exp Guinevere Larsen
@ 2024-02-01 15:58 ` Guinevere Larsen
  2024-02-02 12:04   ` Tom de Vries
  2024-02-01 15:58 ` [PATCH 2/2] gdb/testsuite: reduce gdb.threads/threadcrash.exp reliance on libc symbols Guinevere Larsen
  1 sibling, 1 reply; 4+ messages in thread
From: Guinevere Larsen @ 2024-02-01 15:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

There are 2 issues with the test gdb.threads/threadcrash.exp on arm
targets, both relating to issues in how the targets handles gcores. The
first is that the test fails to cout the number of threads in the
inferior and the second is that GDB can't properly backtrace from a
gcore.

The first error is fixed on this commit by getting the convenience
variable _inferior_thread_count as opposed to calculating it based on
the output of "info threads"

For the second, this test just emits a single xfail referring back to PR
corefiles/31294, which tracks the issues with gcores in 32-bit arm
targets.

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

diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index d3e3494cbea..362c4c5879d 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -27,12 +27,9 @@
 proc test_thread_count {} {
     set thread_count 0
 
-    gdb_test_multiple "info threads" "getting thread count" -lbl {
-	-re "\(Thread\|LWP\)" {
-	    incr thread_count
-	    exp_continue
-	}
-	-re "$::gdb_prompt " {
+    gdb_test_multiple "print \$_inferior_thread_count" "getting thread count" {
+	-re ".* = (\[0-9]+).*" {
+	    set thread_count $expect_out(1,string)
 	    gdb_assert {$thread_count == 7}
 	}
     }
@@ -230,4 +227,8 @@ test_live_inferior
 
 test_corefile
 
-test_gcore
+if { [is_aarch32_target] } {
+    xfail "gcore tests fail on 32-bit arm, see PR corefiles/31294"
+} else {
+    test_gcore
+}
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] gdb/testsuite: reduce gdb.threads/threadcrash.exp reliance on libc symbols
  2024-02-01 15:58 [PATCH 0/2] Fixes to gdb.threads/threadcrash.exp Guinevere Larsen
  2024-02-01 15:58 ` [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets Guinevere Larsen
@ 2024-02-01 15:58 ` Guinevere Larsen
  1 sibling, 0 replies; 4+ messages in thread
From: Guinevere Larsen @ 2024-02-01 15:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

The test gdb.threads/threadcrash.exp demanded GDB to fully unwind and
print the names of all functions. However, some of the functions are
from the libc library, and so the test implicitly demanded libc symbols
to be available, and would fail otherwise, as was raised in PR
gdb/31293.

This commit changes it so we only explicitly check for functions that
are provided by threadcrash.c to fix that

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31293
---
 gdb/testsuite/gdb.threads/threadcrash.exp | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index 362c4c5879d..337135f812a 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -57,26 +57,23 @@ proc thread_apply_all {} {
 		exp_continue
 	    }
 	    -re "\[^\n\]*syscall_task .location=SIGNAL_ALT_STACK\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \
+		lappend test_list [multi_line ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \
 					      ".*signal_handler.*" \
 					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
+					      ".*" \
 					      ".*thread_function.*"]
 		exp_continue
 	    }
 	    -re "\[^\n\]*syscall_task .location=SIGNAL_HANDLER\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=SIGNAL_HANDLER.*" \
+		lappend test_list [multi_line ".*do_syscall_task .location=SIGNAL_HANDLER.*" \
 					      ".*signal_handler.*" \
 					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
+					      ".*" \
 					      ".*thread_function.*"]
 		exp_continue
 	    }
 	    -re "\[^\n\]*syscall_task .location=NORMAL\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=NORMAL.*" \
+		lappend test_list [multi_line ".*do_syscall_task .location=NORMAL.*" \
 					      ".*thread_function.*"]
 		exp_continue
 	    }
@@ -84,7 +81,7 @@ proc thread_apply_all {} {
 		lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \
 					      ".*signal_handler.*" \
 					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
+					      ".*" \
 					      ".*thread_function.*"]
 		exp_continue
 	    }
@@ -92,7 +89,7 @@ proc thread_apply_all {} {
 		lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_HANDLER.*" \
 					      ".*signal_handler.*" \
 					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
+					      ".*" \
 					      ".*thread_function.*"]
 		exp_continue
 	    }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets
  2024-02-01 15:58 ` [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets Guinevere Larsen
@ 2024-02-02 12:04   ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2024-02-02 12:04 UTC (permalink / raw)
  To: Guinevere Larsen, gdb-patches

On 2/1/24 16:58, Guinevere Larsen wrote:
> There are 2 issues with the test gdb.threads/threadcrash.exp on arm
> targets, both relating to issues in how the targets handles gcores. The
> first is that the test fails to cout the number of threads in the
> inferior and the second is that GDB can't properly backtrace from a
> gcore.
> 
> The first error is fixed on this commit by getting the convenience
> variable _inferior_thread_count as opposed to calculating it based on
> the output of "info threads"
> 
> For the second, this test just emits a single xfail referring back to PR
> corefiles/31294, which tracks the issues with gcores in 32-bit arm
> targets.
> 

Hi Guinevere,

the fact that the PR has the corefiles component suggests that there's a 
problem with gdb, which means a kfail should be used. An xfail is used 
to indicate problems in the environment (meaning external to gdb), like 
a known problem in the linux kernel, or incorrect debug info generated 
by the compiler, etc.

Thanks,
- Tom

> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31294
> ---
>   gdb/testsuite/gdb.threads/threadcrash.exp | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
> index d3e3494cbea..362c4c5879d 100644
> --- a/gdb/testsuite/gdb.threads/threadcrash.exp
> +++ b/gdb/testsuite/gdb.threads/threadcrash.exp
> @@ -27,12 +27,9 @@
>   proc test_thread_count {} {
>       set thread_count 0
>   
> -    gdb_test_multiple "info threads" "getting thread count" -lbl {
> -	-re "\(Thread\|LWP\)" {
> -	    incr thread_count
> -	    exp_continue
> -	}
> -	-re "$::gdb_prompt " {
> +    gdb_test_multiple "print \$_inferior_thread_count" "getting thread count" {
> +	-re ".* = (\[0-9]+).*" {
> +	    set thread_count $expect_out(1,string)
>   	    gdb_assert {$thread_count == 7}
>   	}
>       }
> @@ -230,4 +227,8 @@ test_live_inferior
>   
>   test_corefile
>   
> -test_gcore
> +if { [is_aarch32_target] } {
> +    xfail "gcore tests fail on 32-bit arm, see PR corefiles/31294"
> +} else {
> +    test_gcore
> +}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-02 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 15:58 [PATCH 0/2] Fixes to gdb.threads/threadcrash.exp Guinevere Larsen
2024-02-01 15:58 ` [PATCH 1/2] gdb/testsuite: fix gdb.threads/threadcrash.exp on 32-bit arm targets Guinevere Larsen
2024-02-02 12:04   ` Tom de Vries
2024-02-01 15:58 ` [PATCH 2/2] gdb/testsuite: reduce gdb.threads/threadcrash.exp reliance on libc symbols Guinevere Larsen

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).