This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] gdb/source.c: Fix matching path substitute rule listing
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Brad Mouring <bmouring at ni dot com>
- Cc: gdb-patches at sourceware dot org, Brad Mouring <brad dot mouring at ni dot com>
- Date: Mon, 2 Jun 2014 08:14:26 -0700
- Subject: Re: [PATCH 2/2] gdb/source.c: Fix matching path substitute rule listing
- Authentication-results: sourceware.org; auth=none
- References: <20140528161531 dot GA4289 at adacore dot com> <1401316902-12320-1-git-send-email-brad dot mouring at ni dot com> <1401316902-12320-3-git-send-email-brad dot mouring at ni dot com>
Brad,
I would merge both patches into one, in this case, as I suspect
this will simplify submission for you. Make sure to always include
the ChangeLog entry in your revision log for every patch.
The introduction email (aka cover letter) explains very well what
you are trying to do, and I would use that as your revision log
for the merged patch.
> diff --git a/gdb/source.c b/gdb/source.c
> index c77a4f4..a32872f 100644
> --- a/gdb/source.c
> +++ b/gdb/source.c
> @@ -1875,6 +1875,7 @@ show_substitute_path_command (char *args, int from_tty)
> char **argv;
> char *from = NULL;
> struct cleanup *cleanup;
> + int rule_from_len;
>
> argv = gdb_buildargv (args);
> cleanup = make_cleanup_freeargv (argv);
> @@ -1897,7 +1898,11 @@ show_substitute_path_command (char *args, int from_tty)
>
> while (rule != NULL)
> {
> - if (from == NULL || FILENAME_CMP (rule->from, from) == 0)
> + rule_from_len = strlen(rule->from);
> + if (from == NULL ||
> + ((filename_ncmp (rule->from, from, rule_from_len) == 0) &&
> + (IS_DIR_SEPARATOR (from[rule_from_len]) ||
> + from[rule_from_len] == 0)))
Why not use substitute_path_rule_matches, here?
--
Joel