aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Mouring <bmouring@ni.com>2014-06-02 15:55:10 -0500
committerJoel Brobecker <brobecker@adacore.com>2014-06-03 07:17:06 -0700
commit1e2ccb612d2b61014bb7e9fef3eb58e4947b9d2b (patch)
tree4a997dd7f3d394dc1980351c2a9c6abad0dc353b
parentc6ec5ab23a17b972c7c78ac66f3685b57db74946 (diff)
downloadgdb-1e2ccb612d2b61014bb7e9fef3eb58e4947b9d2b.zip
gdb-1e2ccb612d2b61014bb7e9fef3eb58e4947b9d2b.tar.gz
gdb-1e2ccb612d2b61014bb7e9fef3eb58e4947b9d2b.tar.bz2
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.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/source.c2
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/subst.exp8
4 files changed, 20 insertions, 1 deletions
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 <bmouring@ni.com> (tiny patch)
+
+ Pushed by Joel Brobecker <brobecker@adacore.com>
+ * source.c (show_substitute_path_command): Fix display of matching
+ substitution rules.
+
2014-06-03 Gary Benson <gbenson@redhat.com>
* 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 <bmouring@ni.com> (tiny patch)
+
+ * gdb.base/subst.exp: Add tests to verify partial path matching
+ output.
+
2014-06-03 Pedro Alves <palves@redhat.com>
* 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"