public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp
@ 2022-11-16 11:22 Tom de Vries
  2022-11-26 13:31 ` Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2022-11-16 11:22 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.base/bt-on-fatal-signal.exp on powerpc64le-linux I
noticed:
...
FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: scan for backtrace (timeout)
...

The timeout is 10 seconds, but generating the core file takes more than a
minute, probably due to slow NFS.

I managed to reproduce this behaviour independently of gdb, by compiling
"int main (void) { __builtin_abort (); }" and running it, which took 1.5
seconds for a core file 50 times smaller than the one for gdb.

Fix this by preventing the core file from being generated, using a wrapper
around gdb that does "ulimit -c 0".

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.base/bt-on-fatal-signal.exp |  5 ++++-
 gdb/testsuite/lib/gdb.exp                     | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
index 8f9d857106d..1af88d50c4c 100644
--- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
+++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
@@ -62,7 +62,10 @@ foreach test_data {{SEGV "Segmentation fault"} \
     with_test_prefix ${sig} {
 
 	# Restart GDB.
-	clean_restart $binfile
+	save_vars { GDB } {
+	    set GDB [gdb_no_core]
+	    clean_restart $binfile
+	}
 
 	# Capture the pid of GDB.
 	set testpid [spawn_id_get_pid $gdb_spawn_id]
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 042d7ade59f..8b09d548839 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6304,6 +6304,17 @@ proc cached_file { filename txt {executable 0}} {
     return $filename
 }
 
+# Return a wrapper around gdb that prevents generating a core file.
+
+proc gdb_no_core { } {
+    set script \
+	[list \
+	     "ulimit -c 0" \
+	     [join [list exec $::GDB {"$@"}]]]
+    set script [join $script "\n"]
+    return [cached_file gdb-no-core.sh $script 1]
+}
+
 # Set 'testfile', 'srcfile', and 'binfile'.
 #
 # ARGS is a list of source file specifications.

base-commit: 6e5d0bc52fbbfcac6f35f2d014e27afd4506d687
-- 
2.35.3


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

* Re: [PATCH] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp
  2022-11-16 11:22 [PATCH] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp Tom de Vries
@ 2022-11-26 13:31 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-11-26 13:31 UTC (permalink / raw)
  To: gdb-patches

On 11/16/22 12:22, Tom de Vries via Gdb-patches wrote:
> When running test-case gdb.base/bt-on-fatal-signal.exp on powerpc64le-linux I
> noticed:
> ...
> FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: scan for backtrace (timeout)
> ...
> 
> The timeout is 10 seconds, but generating the core file takes more than a
> minute, probably due to slow NFS.
> 
> I managed to reproduce this behaviour independently of gdb, by compiling
> "int main (void) { __builtin_abort (); }" and running it, which took 1.5
> seconds for a core file 50 times smaller than the one for gdb.
> 
> Fix this by preventing the core file from being generated, using a wrapper
> around gdb that does "ulimit -c 0".
> 
> Tested on x86_64-linux.


Committed.

Thanks,
- Tom

> ---
>   gdb/testsuite/gdb.base/bt-on-fatal-signal.exp |  5 ++++-
>   gdb/testsuite/lib/gdb.exp                     | 11 +++++++++++
>   2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
> index 8f9d857106d..1af88d50c4c 100644
> --- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
> +++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
> @@ -62,7 +62,10 @@ foreach test_data {{SEGV "Segmentation fault"} \
>       with_test_prefix ${sig} {
>   
>   	# Restart GDB.
> -	clean_restart $binfile
> +	save_vars { GDB } {
> +	    set GDB [gdb_no_core]
> +	    clean_restart $binfile
> +	}
>   
>   	# Capture the pid of GDB.
>   	set testpid [spawn_id_get_pid $gdb_spawn_id]
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 042d7ade59f..8b09d548839 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -6304,6 +6304,17 @@ proc cached_file { filename txt {executable 0}} {
>       return $filename
>   }
>   
> +# Return a wrapper around gdb that prevents generating a core file.
> +
> +proc gdb_no_core { } {
> +    set script \
> +	[list \
> +	     "ulimit -c 0" \
> +	     [join [list exec $::GDB {"$@"}]]]
> +    set script [join $script "\n"]
> +    return [cached_file gdb-no-core.sh $script 1]
> +}
> +
>   # Set 'testfile', 'srcfile', and 'binfile'.
>   #
>   # ARGS is a list of source file specifications.
> 
> base-commit: 6e5d0bc52fbbfcac6f35f2d014e27afd4506d687

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

end of thread, other threads:[~2022-11-26 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 11:22 [PATCH] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp Tom de Vries
2022-11-26 13:31 ` 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).