This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Fix matching path substitution rule listing, add tests
- From: "Brad Mouring" <bmouring at ni dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>
- Date: Wed, 28 May 2014 17:41:40 -0500
- Subject: Fix matching path substitution rule listing, add tests
- Authentication-results: sourceware.org; auth=none
- References: <20140528161531 dot GA4289 at adacore dot 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