[gdb/testsuite] Allow thread exited message in gdb.threads/infcall-from-bp-cond-simple.exp

Message ID 20250320154013.16613-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Allow thread exited message in gdb.threads/infcall-from-bp-cond-simple.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries March 20, 2025, 3:40 p.m. UTC
  With a gdb 15.2 based package and test-case
gdb.threads/infcall-from-bp-cond-simple.exp, I ran into:
...
Thread 2 "infcall-from-bp" hit Breakpoint 3, function_with_breakpoint () at \
  infcall-from-bp-cond-simple.c:51
51        return 1;     /* Nested breakpoint.  */
Error in testing condition for breakpoint 2:
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(function_with_breakpoint) will be abandoned.
When the function is done executing, GDB will silently stop.
[Thread 0x7ffff73fe6c0 (LWP 951822) exited]
(gdb) FAIL: $exp: target_async=on: target_non_stop=on: \
  run_bp_cond_hits_breakpoint: continue
...

The test fails because it doesn't expect the "[Thread ... exited]" message.

I have tried to reproduce this test failure, both using 15.2 and current
trunk, but haven't managed.

Regardless, I think the message is harmless, so allow it to occur, both in
run_bp_cond_segfaults and run_bp_cond_hits_breakpoint.

Tested on x86_64-linux.

PR testsuite/32785
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32785
---
 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


base-commit: d8a250dc5c0f5b34384c69dda79b2099106c72af
  

Comments

Tom de Vries April 9, 2025, 10:11 a.m. UTC | #1
On 3/20/25 16:40, Tom de Vries wrote:
> With a gdb 15.2 based package and test-case
> gdb.threads/infcall-from-bp-cond-simple.exp, I ran into:
> ...
> Thread 2 "infcall-from-bp" hit Breakpoint 3, function_with_breakpoint () at \
>    infcall-from-bp-cond-simple.c:51
> 51        return 1;     /* Nested breakpoint.  */
> Error in testing condition for breakpoint 2:
> The program being debugged stopped while in a function called from GDB.
> Evaluation of the expression containing the function
> (function_with_breakpoint) will be abandoned.
> When the function is done executing, GDB will silently stop.
> [Thread 0x7ffff73fe6c0 (LWP 951822) exited]
> (gdb) FAIL: $exp: target_async=on: target_non_stop=on: \
>    run_bp_cond_hits_breakpoint: continue
> ...
> 
> The test fails because it doesn't expect the "[Thread ... exited]" message.
> 
> I have tried to reproduce this test failure, both using 15.2 and current
> trunk, but haven't managed.
> 
> Regardless, I think the message is harmless, so allow it to occur, both in
> run_bp_cond_segfaults and run_bp_cond_hits_breakpoint.
> 

I've pushed this.

Thanks,
- Tom

> Tested on x86_64-linux.
> 
> PR testsuite/32785
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32785
> ---
>   gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
> index feec37bd298..aa12a906e7a 100644
> --- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
> +++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
> @@ -141,6 +141,8 @@ proc_with_prefix run_kill_and_restart_test { target_async target_non_stop } {
>       gdb_start_cmd
>   }
>   
> +set re_thread_exited {\[Thread [^\r\n]+ exited\]}
> +
>   # Create a conditional breakpoint which includes a call to a function that
>   # segfaults.  Run GDB and check what happens when the inferior segfaults
>   # during the inferior call.
> @@ -176,7 +178,8 @@ proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } {
>   	     "To change this behavior use \"set unwind-on-signal on\"\\." \
>   	     "Evaluation of the expression containing the function" \
>   	     "\\(function_that_segfaults\\) will be abandoned\\." \
> -	     "When the function is done executing, GDB will silently stop\\."]
> +	     "When the function is done executing, GDB will silently stop\\.(" \
> +	     "$::re_thread_exited)?"]
>   }
>   
>   # Create a conditional breakpoint which includes a call to a function that
> @@ -210,7 +213,8 @@ proc_with_prefix run_bp_cond_hits_breakpoint { target_async target_non_stop } {
>   	     "The program being debugged stopped while in a function called from GDB\\." \
>   	     "Evaluation of the expression containing the function" \
>   	     "\\(function_with_breakpoint\\) will be abandoned\\." \
> -	     "When the function is done executing, GDB will silently stop\\."]
> +	     "When the function is done executing, GDB will silently stop\\.(" \
> +	     "$::re_thread_exited)?"]
>   }
>   
>   foreach_with_prefix target_async { "on" "off" } {
> 
> base-commit: d8a250dc5c0f5b34384c69dda79b2099106c72af
  

Patch

diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
index feec37bd298..aa12a906e7a 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
@@ -141,6 +141,8 @@  proc_with_prefix run_kill_and_restart_test { target_async target_non_stop } {
     gdb_start_cmd
 }
 
+set re_thread_exited {\[Thread [^\r\n]+ exited\]}
+
 # Create a conditional breakpoint which includes a call to a function that
 # segfaults.  Run GDB and check what happens when the inferior segfaults
 # during the inferior call.
@@ -176,7 +178,8 @@  proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } {
 	     "To change this behavior use \"set unwind-on-signal on\"\\." \
 	     "Evaluation of the expression containing the function" \
 	     "\\(function_that_segfaults\\) will be abandoned\\." \
-	     "When the function is done executing, GDB will silently stop\\."]
+	     "When the function is done executing, GDB will silently stop\\.(" \
+	     "$::re_thread_exited)?"]
 }
 
 # Create a conditional breakpoint which includes a call to a function that
@@ -210,7 +213,8 @@  proc_with_prefix run_bp_cond_hits_breakpoint { target_async target_non_stop } {
 	     "The program being debugged stopped while in a function called from GDB\\." \
 	     "Evaluation of the expression containing the function" \
 	     "\\(function_with_breakpoint\\) will be abandoned\\." \
-	     "When the function is done executing, GDB will silently stop\\."]
+	     "When the function is done executing, GDB will silently stop\\.(" \
+	     "$::re_thread_exited)?"]
 }
 
 foreach_with_prefix target_async { "on" "off" } {