public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: make gdb.base/list-nodebug.exp pass without libc symbols
@ 2024-01-30  9:30 Guinevere Larsen
  2024-01-30 16:34 ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Guinevere Larsen @ 2024-01-30  9:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

Simon noticed that the test gdb.base/list-nodebug.exp would fail if the
system doesn't have debug symbols for the standard library, and filed it
as PR gdb/31290. The issue is that, if GDB finds no symbols at all for,
it takes a different exit than if it finds some symbols, but nothing for
the current location.

This patch changes the test to accept any message, since the important
thing we're testing at this point is if GDB would crash, not what the
message is.
---
Email only:

I tried to condense the errors instead of changing the testcase, but I
couldn't find a good way to check if there were no symbols. My best
idea was to check if the symtab that was found has a linetable, and exit
error out if no linetable is present. However, I worry that a user may
want, for example, to list a specific function and I couldn't convince
myself that the linetable was required for that, so I decided to go this
safe route instead.

If the linetable is required, or it is at least reasonable ot require it
for listing a file, I can send the other patch instead.
---
 gdb/testsuite/gdb.base/list-nodebug.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/list-nodebug.exp b/gdb/testsuite/gdb.base/list-nodebug.exp
index 08de05423af..df2761f89e4 100644
--- a/gdb/testsuite/gdb.base/list-nodebug.exp
+++ b/gdb/testsuite/gdb.base/list-nodebug.exp
@@ -30,8 +30,8 @@ if {![runto_main]} {
 
 # Check that GDB doesn't crash when we use list . on an inferior with
 # no debug information
-gdb_test "list ." "No debug.*" "first 'list .'"
+gdb_test "list ." ".*" "first 'list .'"
 # This should be called twice because the first list invocation since
 # printing a frame may take a different codepath, which wouldn't
 # trigger the crash.
-gdb_test "list ." "No debug.*" "second 'list .'"
+gdb_test "list ." ".*" "second 'list .'"
-- 
2.43.0


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

end of thread, other threads:[~2024-02-02 11:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30  9:30 [PATCH] gdb/testsuite: make gdb.base/list-nodebug.exp pass without libc symbols Guinevere Larsen
2024-01-30 16:34 ` Simon Marchi
2024-01-30 16:48   ` Guinevere Larsen
2024-01-30 19:51     ` Simon Marchi
2024-01-31 14:49       ` Guinevere Larsen
2024-01-31 21:18         ` Simon Marchi
2024-02-02 11:05           ` Guinevere Larsen

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