public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: Fix rtld-step-nodebugsym.exp
@ 2022-11-09 23:29 Lancelot SIX
  2022-11-10  2:01 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Lancelot SIX @ 2022-11-09 23:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix, Lancelot SIX

The test case introduced in bafcc335266 (Fix stepping in rtld without
debug symbol) fails on some systems as reported by PR/29768.  This can
be seen if the system does not have debug info for the libc:

  (gdb) step^M
  Single stepping until exit from function main,^M
  which has no line number information.^M
  hello world[Inferior 1 (process 48203) exited normally]^M
  (gdb) PASS: gdb.base/rtld-step-nodebugsym.exp: step
  continue^M
  The program is not being run.^M
  (gdb) FAIL: gdb.base/rtld-step-nodebugsym.exp: continue until exit (the program is no longer running)

Without glibc debug info, GDB steps until the program finishes, and
then "gdb_continue_to_end" fails.

As this test was designed to check that GDB does not crash in the "step"
command, the continue does not carry real meaning to the test.

Replace it by "print 0" so we still check that after the step command
GDB is still alive, which is what we care about.

Tested on Ubuntu-22.04 x86_64, with and without libc6-dbg.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29768
---
 gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
index 1c8fa478cb8..80ff1572c1a 100644
--- a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
+++ b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
@@ -29,4 +29,6 @@ if { ![runto_main] } {
 
 gdb_test "step" "Single stepping until exit from function.*"
 
-gdb_continue_to_end "" continue 1
+# GDB used to crash while doing the step command.  Check that this bug is
+# fixed and that GDB is still alive at this point.
+gdb_test "print 0" "= 0"

base-commit: bafcc335266708d5fd62159df90d139d00666ca8
-- 
2.34.1


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

* Re: [PATCH] gdb/testsuite: Fix rtld-step-nodebugsym.exp
  2022-11-09 23:29 [PATCH] gdb/testsuite: Fix rtld-step-nodebugsym.exp Lancelot SIX
@ 2022-11-10  2:01 ` Simon Marchi
  2022-11-10  9:37   ` Lancelot SIX
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-11-10  2:01 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches; +Cc: lsix



On 11/9/22 18:29, Lancelot SIX via Gdb-patches wrote:
> The test case introduced in bafcc335266 (Fix stepping in rtld without
> debug symbol) fails on some systems as reported by PR/29768.  This can
> be seen if the system does not have debug info for the libc:
> 
>   (gdb) step^M
>   Single stepping until exit from function main,^M
>   which has no line number information.^M
>   hello world[Inferior 1 (process 48203) exited normally]^M
>   (gdb) PASS: gdb.base/rtld-step-nodebugsym.exp: step
>   continue^M
>   The program is not being run.^M
>   (gdb) FAIL: gdb.base/rtld-step-nodebugsym.exp: continue until exit (the program is no longer running)
> 
> Without glibc debug info, GDB steps until the program finishes, and
> then "gdb_continue_to_end" fails.
> 
> As this test was designed to check that GDB does not crash in the "step"
> command, the continue does not carry real meaning to the test.
> 
> Replace it by "print 0" so we still check that after the step command
> GDB is still alive, which is what we care about.
> 
> Tested on Ubuntu-22.04 x86_64, with and without libc6-dbg.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29768
> ---
>  gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
> index 1c8fa478cb8..80ff1572c1a 100644
> --- a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
> +++ b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
> @@ -29,4 +29,6 @@ if { ![runto_main] } {
>  
>  gdb_test "step" "Single stepping until exit from function.*"
>  
> -gdb_continue_to_end "" continue 1
> +# GDB used to crash while doing the step command.  Check that this bug is
> +# fixed and that GDB is still alive at this point.
> +gdb_test "print 0" "= 0"

In theory, the gdb_test for step expects to see a (gdb) prompt at the
end, and I suppose that GDB would crash before printing that prompt.  So
the test would catch the problem even without that "print 0".  But I
don't mind the extra safety:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

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

* Re: [PATCH] gdb/testsuite: Fix rtld-step-nodebugsym.exp
  2022-11-10  2:01 ` Simon Marchi
@ 2022-11-10  9:37   ` Lancelot SIX
  0 siblings, 0 replies; 3+ messages in thread
From: Lancelot SIX @ 2022-11-10  9:37 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches; +Cc: lsix


> 
> In theory, the gdb_test for step expects to see a (gdb) prompt at the
> end, and I suppose that GDB would crash before printing that prompt.  So
> the test would catch the problem even without that "print 0".  But I
> don't mind the extra safety:

Hi,

Thanks for spotting the issue and for the review.

If GDB crashes, we always have an unresolved test case reported in the 
testsuite summary.  However, with this extra "p 0", the output during 
the test run is slightly more verbose as runtest complains it cannot 
issue the command, which I find slightly easier to spot.

I'll push this fix shortly.

Best,
Lancelot

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

end of thread, other threads:[~2022-11-10  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 23:29 [PATCH] gdb/testsuite: Fix rtld-step-nodebugsym.exp Lancelot SIX
2022-11-10  2:01 ` Simon Marchi
2022-11-10  9:37   ` Lancelot SIX

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