Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix test-case gdb.threads/attach-stopped.exp on manjaro linux
@ 2024-03-14 10:13 Tom de Vries
  2024-03-28  7:27 ` Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-03-14 10:13 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.threads/attach-stopped.exp on aarch64-linux, using
the manjaro linux distro, I get:
...
 (gdb) thread apply all bt^M
 ^M
 Thread 2 (Thread 0xffff8d8af120 (LWP 278116) "attach-stopped"):^M
 #0  0x0000ffff8d964864 in clock_nanosleep () from /usr/lib/libc.so.6^M
 #1  0x0000ffff8d969cac in nanosleep () from /usr/lib/libc.so.6^M
 #2  0x0000ffff8d969b68 in sleep () from /usr/lib/libc.so.6^M
 #3  0x0000aaaade370828 in func (arg=0x0) at attach-stopped.c:29^M
 #4  0x0000ffff8d930aec in ?? () from /usr/lib/libc.so.6^M
 #5  0x0000ffff8d99a5dc in ?? () from /usr/lib/libc.so.6^M
 ^M
 Thread 1 (Thread 0xffff8db62020 (LWP 278111) "attach-stopped"):^M
 #0  0x0000ffff8d92d2d8 in ?? () from /usr/lib/libc.so.6^M
 #1  0x0000ffff8d9324b8 in ?? () from /usr/lib/libc.so.6^M
 #2  0x0000aaaade37086c in main () at attach-stopped.c:45^M
 (gdb) FAIL: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped bt
...

The problem is that the test-case expects to see start_thread:
...
	gdb_test "thread apply all bt" ".*sleep.*start_thread.*" \
	    "$threadtype: attach2 to stopped bt"
...
but lack of symbols makes that impossible.

Fix this by allowing " in ?? () from " as well.

Tested on aarch64-linux.

PR testsuite/31451
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31451
---
 gdb/testsuite/gdb.threads/attach-stopped.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 4be0e220b17..78e194c992f 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -54,10 +54,12 @@ proc corefunc { threadtype } {
     }
 
     # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
+    set test "$threadtype: attach2 to stopped bt"
     if {[string equal $threadtype threaded]} {
-	gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach2 to stopped bt"
+	gdb_test "thread apply all bt" \
+	    ".*sleep.*(start_thread| in \\?\\? \\(\\) from ).*" $test
     } else {
-	gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach2 to stopped bt"
+	gdb_test "bt" ".*sleep.*main.*" $test
     }
 
     gdb_exit

base-commit: 3a4c6f1aa958739705ee69526fdeed7c69d7243c
-- 
2.35.3


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

* Re: [PATCH] [gdb/testsuite] Fix test-case gdb.threads/attach-stopped.exp on manjaro linux
  2024-03-14 10:13 [PATCH] [gdb/testsuite] Fix test-case gdb.threads/attach-stopped.exp on manjaro linux Tom de Vries
@ 2024-03-28  7:27 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2024-03-28  7:27 UTC (permalink / raw)
  To: gdb-patches

On 3/14/24 11:13, Tom de Vries wrote:
> When running test-case gdb.threads/attach-stopped.exp on aarch64-linux, using
> the manjaro linux distro, I get:
> ...
>   (gdb) thread apply all bt^M
>   ^M
>   Thread 2 (Thread 0xffff8d8af120 (LWP 278116) "attach-stopped"):^M
>   #0  0x0000ffff8d964864 in clock_nanosleep () from /usr/lib/libc.so.6^M
>   #1  0x0000ffff8d969cac in nanosleep () from /usr/lib/libc.so.6^M
>   #2  0x0000ffff8d969b68 in sleep () from /usr/lib/libc.so.6^M
>   #3  0x0000aaaade370828 in func (arg=0x0) at attach-stopped.c:29^M
>   #4  0x0000ffff8d930aec in ?? () from /usr/lib/libc.so.6^M
>   #5  0x0000ffff8d99a5dc in ?? () from /usr/lib/libc.so.6^M
>   ^M
>   Thread 1 (Thread 0xffff8db62020 (LWP 278111) "attach-stopped"):^M
>   #0  0x0000ffff8d92d2d8 in ?? () from /usr/lib/libc.so.6^M
>   #1  0x0000ffff8d9324b8 in ?? () from /usr/lib/libc.so.6^M
>   #2  0x0000aaaade37086c in main () at attach-stopped.c:45^M
>   (gdb) FAIL: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped bt
> ...
> 
> The problem is that the test-case expects to see start_thread:
> ...
> 	gdb_test "thread apply all bt" ".*sleep.*start_thread.*" \
> 	    "$threadtype: attach2 to stopped bt"
> ...
> but lack of symbols makes that impossible.
> 
> Fix this by allowing " in ?? () from " as well.
> 
> Tested on aarch64-linux.
> 

Pushed.

Thanks,
- Tom

> PR testsuite/31451
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31451
> ---
>   gdb/testsuite/gdb.threads/attach-stopped.exp | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
> index 4be0e220b17..78e194c992f 100644
> --- a/gdb/testsuite/gdb.threads/attach-stopped.exp
> +++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
> @@ -54,10 +54,12 @@ proc corefunc { threadtype } {
>       }
>   
>       # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
> +    set test "$threadtype: attach2 to stopped bt"
>       if {[string equal $threadtype threaded]} {
> -	gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach2 to stopped bt"
> +	gdb_test "thread apply all bt" \
> +	    ".*sleep.*(start_thread| in \\?\\? \\(\\) from ).*" $test
>       } else {
> -	gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach2 to stopped bt"
> +	gdb_test "bt" ".*sleep.*main.*" $test
>       }
>   
>       gdb_exit
> 
> base-commit: 3a4c6f1aa958739705ee69526fdeed7c69d7243c


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

end of thread, other threads:[~2024-03-28  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 10:13 [PATCH] [gdb/testsuite] Fix test-case gdb.threads/attach-stopped.exp on manjaro linux Tom de Vries
2024-03-28  7:27 ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox