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.
This commit is contained in:
parent
c6ec5ab23a
commit
1e2ccb612d
4 changed files with 20 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue