Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Brad Mouring" <bmouring@ni.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: Fix matching path substitution rule listing, add tests
Date: Wed, 28 May 2014 22:42:00 -0000	[thread overview]
Message-ID: <1401316902-12320-1-git-send-email-brad.mouring@ni.com> (raw)
In-Reply-To: <20140528161531.GA4289@adacore.com>

Let's try this one again.

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. 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 in this submission is a couple of new tests to verify this
behavior in the test suite.

Cheers and thanks for your attention.

ChangeLog entry for gdb/ChangeLog:

2014-05-28  Brad Mouring <brad.mouring@ni.com>

	* source.c (show_substitute_path_command): Fix display of matching
	substitution rules
	* subst.exp: Add tests to verify changes in source.c


  reply	other threads:[~2014-05-28 22:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 21:02 [PATCH] gdb/source.c: Fix source path substitution Brad Mouring
2014-05-23 23:50 ` Joel Brobecker
2014-05-24  0:00   ` Joel Brobecker
2014-05-27 13:17     ` Brad Mouring
2014-05-27 18:10       ` Joel Brobecker
2014-05-28 16:01         ` Brad Mouring
2014-05-28 16:15           ` Joel Brobecker
2014-05-28 22:42             ` Brad Mouring [this message]
2014-05-28 22:42               ` [PATCH 1/2] testsuite/subst: Add tests for printing matches Brad Mouring
2014-05-28 22:42               ` [PATCH 2/2] gdb/source.c: Fix matching path substitute rule listing Brad Mouring
2014-06-02 15:14                 ` Joel Brobecker
2014-06-02 18:28                   ` [PATCH] " Brad Mouring
2014-06-02 20:27                     ` Brad Mouring
2014-06-02 20:45                       ` Joel Brobecker
2014-06-02 20:55                         ` Brad Mouring
2014-06-03 14:25                           ` Joel Brobecker

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=1401316902-12320-1-git-send-email-brad.mouring@ni.com \
    --to=bmouring@ni.com \
    --cc=brobecker@adacore.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