public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: Restore libc_has_debug_info's less strict behaviour
@ 2024-04-30  1:53 Thiago Jung Bauermann
  2024-05-22 16:49 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Jung Bauermann @ 2024-04-30  1:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Bernd Edlinger

The code that was factored out from gdb.base/relativedebug.exp assumed that
libc has debug info and only determined that it doesn't if it saw a specific
message from GDB to that effect.  In the process of factoring it into a
require predicate, I made it stricter by trying to make a specific
determination of whether or not debug info is available.

Pedro noticed that "It'll disable the testcase on systems that link with
their libc statically (even if has debug info), or systems that name their
libc something else."  Which is something I hadn't considered.

This patch returns libc_has_debug_info to the original behaviour.

Also, remove a verbose message that is redundant with the $message
variable.
---
 gdb/testsuite/lib/gdb.exp | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d092258a9e50..c55ade065844 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3699,8 +3699,9 @@ proc support_displaced_stepping {} {
     return 0
 }
 
-# Return 1 if GDB can find the libc debug info, or 0 and a reason string if it
-# can't.  This procedure is meant to be called by the require procedure.
+# Return 0 and a reason string if GDB can determine that libc doesn't have
+# debug info, and 1 otherwise.  This procedure is meant to be called by the
+# require procedure.
 gdb_caching_proc libc_has_debug_info {} {
     global srcdir subdir gdb_prompt inferior_exited_re
 
@@ -3726,22 +3727,20 @@ gdb_caching_proc libc_has_debug_info {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load "$obj"
     runto_main
-    set test "info sharedlibrary libc.so"
+    set libc_has_debug_info 1
+    set message "unable to get information on libc.so"
+    set test "info sharedlibrary"
     gdb_test_multiple $test $test {
 	-re ".*\(\\*\)\[^\r\n\]*/libc\.so.*$gdb_prompt $" {
 	    # Matched the "(*)" in the "Syms Read" columns which means:
 	    # "(*): Shared library is missing debugging information."
-	    verbose -log "$me: libc doesn't have debug info"
 	    set libc_has_debug_info 0
 	    set message "libc doesn't have debug info"
 	}
-	-re ".*Yes\[ \t\]+\[^\r\n\]*/libc\.so.*$gdb_prompt $" {
-	    verbose -log "$me: libc has debug info"
-	    set libc_has_debug_info 1
-	}
-	default {
-	    set libc_has_debug_info 0
-	    set message "libc not found in the inferior"
+	-re ".*$gdb_prompt $" {
+	    # The default pattern for the GDB prompt in gdb_test_multiple
+	    # causes a FAIL if it matches, but in our case we should just
+	    # assume that there is libc debug info.
 	}
     }
     gdb_exit

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

* Re: [PATCH] gdb/testsuite: Restore libc_has_debug_info's less strict behaviour
  2024-04-30  1:53 [PATCH] gdb/testsuite: Restore libc_has_debug_info's less strict behaviour Thiago Jung Bauermann
@ 2024-05-22 16:49 ` Tom Tromey
  2024-05-23  3:59   ` Thiago Jung Bauermann
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-05-22 16:49 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches, Bernd Edlinger

>>>>> "Thiago" == Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:

Thiago> The code that was factored out from gdb.base/relativedebug.exp assumed that
Thiago> libc has debug info and only determined that it doesn't if it saw a specific
Thiago> message from GDB to that effect.  In the process of factoring it into a
Thiago> require predicate, I made it stricter by trying to make a specific
Thiago> determination of whether or not debug info is available.

Thiago> Pedro noticed that "It'll disable the testcase on systems that link with
Thiago> their libc statically (even if has debug info), or systems that name their
Thiago> libc something else."  Which is something I hadn't considered.

Thiago> This patch returns libc_has_debug_info to the original behaviour.

Thiago> Also, remove a verbose message that is redundant with the $message
Thiago> variable.

Thank you.  I think this is ok, but can you also add the Bug trailer?

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31700
Approved-By: Tom Tromey <tom@tromey.com>

Tom

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

* Re: [PATCH] gdb/testsuite: Restore libc_has_debug_info's less strict behaviour
  2024-05-22 16:49 ` Tom Tromey
@ 2024-05-23  3:59   ` Thiago Jung Bauermann
  0 siblings, 0 replies; 3+ messages in thread
From: Thiago Jung Bauermann @ 2024-05-23  3:59 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, Bernd Edlinger

Hello Tom,

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Thiago" == Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:
>
> Thiago> The code that was factored out from gdb.base/relativedebug.exp assumed that
> Thiago> libc has debug info and only determined that it doesn't if it saw a specific
> Thiago> message from GDB to that effect.  In the process of factoring it into a
> Thiago> require predicate, I made it stricter by trying to make a specific
> Thiago> determination of whether or not debug info is available.
>
> Thiago> Pedro noticed that "It'll disable the testcase on systems that link with
> Thiago> their libc statically (even if has debug info), or systems that name their
> Thiago> libc something else."  Which is something I hadn't considered.
>
> Thiago> This patch returns libc_has_debug_info to the original behaviour.
>
> Thiago> Also, remove a verbose message that is redundant with the $message
> Thiago> variable.
>
> Thank you.  I think this is ok, but can you also add the Bug trailer?
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31700
> Approved-By: Tom Tromey <tom@tromey.com>

Thank you for the review! I added the trailers and pushed as commit
100318bcfda2.

-- 
Thiago

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

end of thread, other threads:[~2024-05-23  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30  1:53 [PATCH] gdb/testsuite: Restore libc_has_debug_info's less strict behaviour Thiago Jung Bauermann
2024-05-22 16:49 ` Tom Tromey
2024-05-23  3:59   ` Thiago Jung Bauermann

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