Re: [PATCH 1/7] PR gdb/15224 "set history filename" to by immediately converted to absolute path

mbilal
2013-05-22T12:04:34Z

On 05/15/2013 03:43 PM, mbilal wrote:
> Hi,
> Please find attached updated patch.
>
> On Wednesday, May 08, 2013 8:47 PM Pedro wrote:
>
> >Missing space before NULL. That's a lot of casting. We can just refer
> >to history_filename directly. It'd be very good to have a comment
> here with the
> >rationale for this -- there's one in init_history we can reuse. So:
>
> Fixed
>
> On Wednesday, May 08, 2013 10:25 PM Pedro wrote:
> >In addition to my previous comments, I realized that this will do the
> >wrong thing with "set history filename ~/foo". Best use tilde_expand
> >and gdb_realpath
>
> 'set history filename ~/foo' is working because following code is doing
> same as you described . I have also attached test case for this.
>
> if (arg != NULL)
> {
> /* Clear trailing whitespace of filename. */
> char *ptr = arg + strlen (arg) - 1;
>
> while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
> ptr--;
> *(ptr + 1) = '\0';
>
> val = tilde_expand (arg);
> }
> else
> val = xstrdup ("");
>
> if (*(char **) c->var == NULL
> || strcmp (*(char **) c->var, val) != 0)
> {
> xfree (*(char **) c->var);
> *(char **) c->var = val;
>
> option_changed = 1;
>
>
>
>
> 2013-05-15 Muhammad Bilal <mbilal@codesourcery.com>
>
> PR gdb/15224
> * top.c (set_history_filename): New function.
>
>
>
> 2013-05-15 Muhammad Bilal <mbilal@codesourcery.com>
>
> PR gdb/15224
> * gdb.base/setshow.exp: Test 'set history filename' relative
> path.
>
>
>
>
>
> Thanks,
> -Bilal
>
>
>
ping?