Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix gdb.base/infcall-failure.exp on freebsd
@ 2025-06-24 21:14 Tom de Vries
  2025-06-24 21:57 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2025-06-24 21:14 UTC (permalink / raw)
  To: gdb-patches

On x86_64-freebsd with test-case gdb.base/infcall-failure.exp I get:
...
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
0x0000000000400522 in func_segfault () at infcall-failure.c:24
24	  return *p;	/* Segfault here.  */
Error in testing condition for breakpoint 2:
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwind-on-signal on".
Evaluation of the expression containing the function
(func_segfault) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb) FAIL: $exp: target_async=on: target_non_stop=on: \
  run_cond_hits_segfault_test: continue
...

The problem is that the regexp in the test-case doesn't expect the
"Address not mapped to object." bit.

Fix this by updating the regexp.

Tested on x86_64-freebsd and x86_64-linux.
---
 gdb/testsuite/gdb.base/infcall-failure.exp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/infcall-failure.exp b/gdb/testsuite/gdb.base/infcall-failure.exp
index 66bccd186ae..e7aeac1ff1c 100644
--- a/gdb/testsuite/gdb.base/infcall-failure.exp
+++ b/gdb/testsuite/gdb.base/infcall-failure.exp
@@ -131,7 +131,13 @@ proc_with_prefix run_cond_hits_segfault_test { async_p non_stop_p } {
 	[multi_line \
 	     "Continuing\\." \
 	     "" \
-	     "Program received signal SIGSEGV, Segmentation fault\\." \
+	     [string cat \
+		  [string_to_regexp \
+		       "Program received signal SIGSEGV, Segmentation fault."] \
+		  "("] \
+	     [string cat \
+		  [string_to_regexp "Address not mapped to object."] \
+		  ")?"] \
 	     "${::hex} in func_segfault \\(\\) at \[^\r\n\]+:${::segv_line}" \
 	     "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \
 	     "Error in testing condition for breakpoint ${bp_1_num}:" \
@@ -161,7 +167,13 @@ proc_with_prefix run_call_hits_segfault_test { async_p non_stop_p } {
     gdb_test "call func_segfault ()" \
 	[multi_line \
 	     "" \
-	     "Program received signal SIGSEGV, Segmentation fault\\." \
+	     [string cat \
+		  [string_to_regexp \
+		       "Program received signal SIGSEGV, Segmentation fault."] \
+		  "("] \
+	     [string cat \
+		  [string_to_regexp "Address not mapped to object."] \
+		  ")?"] \
 	     "${::hex} in func_segfault \\(\\) at \[^\r\n\]+:${::segv_line}" \
 	     "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \
 	     "The program being debugged was signaled while in a function called from GDB\\." \

base-commit: 3b5b306522f748f2e384e58cf5dc046346f84dcb
-- 
2.43.0


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

* Re: [PATCH] [gdb/testsuite] Fix gdb.base/infcall-failure.exp on freebsd
  2025-06-24 21:14 [PATCH] [gdb/testsuite] Fix gdb.base/infcall-failure.exp on freebsd Tom de Vries
@ 2025-06-24 21:57 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2025-06-24 21:57 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

On Tue, 24 Jun 2025 23:14:01 +0200
Tom de Vries <tdevries@suse.de> wrote:

> On x86_64-freebsd with test-case gdb.base/infcall-failure.exp I get:
> ...
> (gdb) continue
> Continuing.
> 
> Program received signal SIGSEGV, Segmentation fault.
> Address not mapped to object.
> 0x0000000000400522 in func_segfault () at infcall-failure.c:24
> 24	  return *p;	/* Segfault here.  */
> Error in testing condition for breakpoint 2:
> The program being debugged was signaled while in a function called from
> GDB. GDB remains in the frame where the signal was received.
> To change this behavior use "set unwind-on-signal on".
> Evaluation of the expression containing the function
> (func_segfault) will be abandoned.
> When the function is done executing, GDB will silently stop.
> (gdb) FAIL: $exp: target_async=on: target_non_stop=on: \
>   run_cond_hits_segfault_test: continue
> ...
> 
> The problem is that the regexp in the test-case doesn't expect the
> "Address not mapped to object." bit.
> 
> Fix this by updating the regexp.
> 
> Tested on x86_64-freebsd and x86_64-linux.

LGTM.

Approved-by: Kevin Buettner <kevinb@redhat.com>


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

end of thread, other threads:[~2025-06-24 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-24 21:14 [PATCH] [gdb/testsuite] Fix gdb.base/infcall-failure.exp on freebsd Tom de Vries
2025-06-24 21:57 ` Kevin Buettner

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