Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH] gdb: fix filename matching in skiplist_entry::do_skip_gfile_p
Date: Mon,  2 Feb 2026 17:34:04 -0300	[thread overview]
Message-ID: <20260202203404.708144-1-guinevere@redhat.com> (raw)

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


             reply	other threads:[~2026-02-02 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 20:34 Guinevere Larsen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260202203404.708144-1-guinevere@redhat.com \
    --to=guinevere@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox