Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: fix filename matching in skiplist_entry::do_skip_gfile_p
@ 2026-02-02 20:34 Guinevere Larsen
  2026-02-02 21:46 ` Andrew Burgess
  2026-02-03 14:27 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Guinevere Larsen @ 2026-02-02 20:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

GDB is incorrectly matching -gfile skip entries.  This is a regression
introduced by the following commit:

    commit 02646a4c561ec88491114b87950cbb827c7d614c
    Author: Fangrui Song <maskray@sourceware.org>
    Date:   Sun Dec 29 14:57:44 2024 -0800

    skip -gfile: call fnmatch without FNM_FILE_NAME

The author made the reasonable, but unfortunately incorrect, assumption
that glibc's fnmatch, and consequently gdb_filename_fnmatch, will return
the integer equivalent of a boolean (that is, 0 if the filenames do *not*
match, non-zero if they match), but that is incorrect.  This made it so
using `skip -gfile` would skip all functions except the ones that are
meant to be skipped.  This commit fixes that inverted logic.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33872
---
 gdb/skip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/skip.c b/gdb/skip.c
index 1255c7d2152..ba2f22058ec 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -548,7 +548,8 @@ skiplist_entry::do_skip_gfile_p (const symtab_and_line &function_sal) const
       /* Note: symtab_to_fullname caches its result, thus we don't have to.  */
       const char *fullname = symtab_to_fullname (function_sal.symtab);
 
-      result = gdb_filename_fnmatch (m_file.c_str (), fullname, FNM_NOESCAPE);
+      result = gdb_filename_fnmatch (m_file.c_str (), fullname, FNM_NOESCAPE)
+		== 0;
     }
 
   if (debug_skip)

base-commit: a6d46a04ea3e165c0ce2f11cd9d68bdcb81f4e4e
-- 
2.52.0


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

end of thread, other threads:[~2026-02-04 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-02 20:34 [PATCH] gdb: fix filename matching in skiplist_entry::do_skip_gfile_p Guinevere Larsen
2026-02-02 21:46 ` Andrew Burgess
2026-02-03 14:27 ` Tom Tromey
2026-02-03 18:55   ` Guinevere Larsen
2026-02-04 15:26     ` Tom Tromey
2026-02-04 16:13       ` Guinevere Larsen

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