From 5c14ffc194bcf6dc514a24cdee4aa71487827ba1 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 9 May 2013 15:08:44 +0200 Subject: [PATCH] Fix needless expansion of non-gdbindex symtabs (Doug Evans). --- gdb-psymtab-expand.patch | 62 ++++++++++++++++++++++++++++++++++++++++ gdb.spec | 9 +++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 gdb-psymtab-expand.patch diff --git a/gdb-psymtab-expand.patch b/gdb-psymtab-expand.patch new file mode 100644 index 0000000..9792e48 --- /dev/null +++ b/gdb-psymtab-expand.patch @@ -0,0 +1,62 @@ +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 + + * 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; + } + + diff --git a/gdb.spec b/gdb.spec index 5a57ff6..89c2d83 100644 --- a/gdb.spec +++ b/gdb.spec @@ -36,7 +36,7 @@ Version: 7.6 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 27%{?dist} +Release: 28%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain Group: Development/Debuggers @@ -569,6 +569,9 @@ Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch # Fix gcore for vDSO (on ppc64). Patch834: gdb-vdso-gcore.patch +# Fix needless expansion of non-gdbindex symtabs (Doug Evans). +Patch835: gdb-psymtab-expand.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -891,6 +894,7 @@ find -name "*.info*"|xargs rm -f %patch818 -p1 %patch832 -p1 %patch834 -p1 +%patch835 -p1 %patch393 -p1 %if 0%{!?el5:1} || 0%{?scl:1} @@ -1394,6 +1398,9 @@ fi %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch" %changelog +* Thu May 9 2013 Jan Kratochvil - 7.6-28.fc19 +- Fix needless expansion of non-gdbindex symtabs (Doug Evans). + * Mon May 6 2013 Jan Kratochvil - 7.6-27.fc19 - [testsuite] [RHEL-5] Fix gdb-orphanripper.c runtime error.