gdb/gdb-psymtab-expand.patch

63 lines
1.8 KiB
Diff

http://sourceware.org/ml/gdb-patches/2013-05/msg00300.html
Subject: [RFA] Fix file name matching in expand_symtabs_matching_via_partial
[blech, apologies for the resend, typo in address]
Hi.
I noticed this while playing with my new "mt expand-symtabs" command
and watching "mt set per on" output.
The test here is wrong.
ref: http://sourceware.org/ml/gdb-patches/2013-02/msg00063.html
The test
(basenames_may_differ
|| (*file_matcher) (lbasename (ps->filename), data, 1))
fails and the code falls through assuming the file name matched.
Regression tested on amd64-linux.
Ok to check in?
Ok for 7.6 branch too?
2013-05-08 Doug Evans <dje@google.com>
* psymtab.c (expand_symtabs_matching_via_partial): Fix file name
matching test.
Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.74
diff -u -p -r1.74 psymtab.c
--- ./gdb/psymtab.c 6 May 2013 19:15:17 -0000 1.74
+++ ./gdb/psymtab.c 8 May 2013 19:18:51 -0000
@@ -1400,15 +1405,21 @@ expand_symtabs_matching_via_partial
if (file_matcher)
{
+ int match;
+
if (ps->anonymous)
continue;
- /* Before we invoke realpath, which can get expensive when many
- files are involved, do a quick comparison of the basenames. */
- if (!(*file_matcher) (ps->filename, data, 0)
- && (basenames_may_differ
+ match = (*file_matcher) (ps->filename, data, 0);
+ if (! match)
+ {
+ /* Before we invoke realpath, which can get expensive when many
+ files are involved, do a quick comparison of the basenames. */
+ if (basenames_may_differ
|| (*file_matcher) (lbasename (ps->filename), data, 1))
- && !(*file_matcher) (psymtab_to_fullname (ps), data, 0))
+ match = (*file_matcher) (psymtab_to_fullname (ps), data, 0);
+ }
+ if (! match)
continue;
}