From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16940 invoked by alias); 3 Jun 2014 14:25:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16911 invoked by uid 89); 3 Jun 2014 14:25:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 03 Jun 2014 14:25:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A808511618B; Tue, 3 Jun 2014 10:25:15 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jYo8BpwsNO9z; Tue, 3 Jun 2014 10:25:15 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 740AA11617D; Tue, 3 Jun 2014 10:25:15 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id B942D40E72; Tue, 3 Jun 2014 07:25:16 -0700 (PDT) Date: Tue, 03 Jun 2014 14:25:00 -0000 From: Joel Brobecker To: Brad Mouring Cc: gdb-patches@sourceware.org, Brad Mouring Subject: Re: [PATCH] gdb/source.c: Fix matching path substitute rule listing Message-ID: <20140603142516.GO4289@adacore.com> References: <20140602204518.GL4289@adacore.com> <1401742510-26527-1-git-send-email-brad.mouring@ni.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RASg3xLB4tUQ4RcS" Content-Disposition: inline In-Reply-To: <1401742510-26527-1-git-send-email-brad.mouring@ni.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-06/txt/msg00085.txt.bz2 --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1414 > This was tested on x86_64 Linux 3.0.0-21 > > gdb/ChangeLog: > > * source.c (show_substitute_path_command): Fix display of matching > substitution rules > > gdb/testsuite/ChangeLog: > > * subst.exp: Add tests to verify partial path matching output Thank you. This is mostly OK. I made the following little fixes: - In the ChangeLog, the sentences should all end with a period. - In the second ChangeLog, the patch to the file being changed should be relative to the directory where the ChangeLog is (missing "gdb.ada/" in this case). - For the platform on which this was tested, I couldn't tell what the 3.0.0-21 was about (kernel version?), but that part is usually not significant and often omitted, so I just removed it. I've also moved that information after the ChangeLog entries as we traditionally place it there, but that's just because I was already making minor edits. There are otherwise no requirement for the placement of that information. I've pushed the attached commit under the "tiny patch" rule. There are only so much code we'll be able to accept from you under that rule, so if you think you might have other contributions coming, you'll need to have a copyright assignment on file with the FSF (it's a bit of a lengthy process, even if they seem to have improved in the past). Thanks again for the patch (and your patience!). -- Joel --RASg3xLB4tUQ4RcS Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-gdb-source.c-Fix-matching-path-substitute-rule-listi.patch" Content-length: 4500 >From 1e2ccb612d2b61014bb7e9fef3eb58e4947b9d2b Mon Sep 17 00:00:00 2001 From: Brad Mouring Date: Mon, 2 Jun 2014 15:55:10 -0500 Subject: [PATCH] gdb/source.c: Fix matching path substitute rule listing The check for the source (or "from") directory snippet in listing matching path substitution rules currently will not match anything other than a direct match of the "from" field in a substitution rule, resulting in the incorrect behavior below: ... (gdb) set substitute-path /a/path /another/path (gdb) show substitute-path List of all source path substitution rules: `/a/path' -> `/another/path'. (gdb) show substitute-path /a/path/to/a/file.ext Source path substitution rule matching `/a/path/to/a/file.ext': (gdb) show substitute-path /a/path Source path substitution rule matching `/a/path': `/a/path' -> `/another/path'. ... This change effects the following behavior by (sanely) checking with the length of the "from" portion of a rule and ensuring that the next character of the path considered for substitution is a path delimiter (or NULL). With this change, the following behavior is garnered: ... (gdb) set substitute-path /a/path /another/path (gdb) show substitute-path List of all source path substitution rules: `/a/path' -> `/another/path'. (gdb) show substitute-path /a/path/to/a/file.ext Source path substitution rule matching `/a/path/to/a/file.ext': `/a/path' -> `/another/path'. (gdb) show substitute-path /a/pathological/case/that/should/fail.err Source path substitution rule matching `/a/pathological/case/that/should/fail.err': (gdb) Also included is a couple of tests added to subst.exp to verify this behavior in the test suite. gdb/ChangeLog: * source.c (show_substitute_path_command): Fix display of matching substitution rules. gdb/testsuite/ChangeLog: * gdb.ada/subst.exp: Add tests to verify partial path matching output. This was tested on x86_64 Linux. --- gdb/ChangeLog | 6 ++++++ gdb/source.c | 2 +- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/subst.exp | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bda46b5..698c15c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-06-03 Brad Mouring (tiny patch) + + Pushed by Joel Brobecker + * source.c (show_substitute_path_command): Fix display of matching + substitution rules. + 2014-06-03 Gary Benson * gnu-v2-abi.c (gnuv2_value_rtti_type): Use gdb_demangle. diff --git a/gdb/source.c b/gdb/source.c index c985a1b..14b1f71 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1890,7 +1890,7 @@ show_substitute_path_command (char *args, int from_tty) while (rule != NULL) { - if (from == NULL || FILENAME_CMP (rule->from, from) == 0) + if (from == NULL || substitute_path_rule_matches (rule, from) != 0) printf_filtered (" `%s' -> `%s'.\n", rule->from, rule->to); rule = rule->next; } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8217403..40518b6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-03 Brad Mouring (tiny patch) + + * gdb.base/subst.exp: Add tests to verify partial path matching + output. + 2014-06-03 Pedro Alves * gdb.base/sss-bp-on-user-bp-2.exp: Skip if testing with a remote diff --git a/gdb/testsuite/gdb.base/subst.exp b/gdb/testsuite/gdb.base/subst.exp index e132809..e99735b 100644 --- a/gdb/testsuite/gdb.base/subst.exp +++ b/gdb/testsuite/gdb.base/subst.exp @@ -95,6 +95,14 @@ gdb_test "show substitute-path depuis" \ "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \ "show substitute-path depuis, after all paths added" +gdb_test "show substitute-path from/path" \ + "Source path substitution rule matching `from/path':\r\n +`from' -> `to'." \ + "show substitute-path from/path, after all paths added" + +gdb_test "show substitute-path from_a_bad_path" \ + "Source path substitution rule matching `from_a_bad_path':" \ + "show substitute-path from_a_bad_path, after all paths added" + gdb_test "show substitute-path garbage" \ "Source path substitution rule matching `garbage':" \ "show substitute-path garbage, after all paths added" -- 1.9.1 --RASg3xLB4tUQ4RcS--