This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [MI tracepoints 6/9] trace variable commands


On Sunday 14 March 2010 08:58:36, Vladimir Prus wrote:
> +  name = argv[0];
> +  if (name[0] != '$')
> +    error (_("Name of trace variable should start with '$'"));
> +  ++name;
> +
> +  expr = parse_expression (argv[0]);
> +  back_to = make_cleanup (xfree, expr);
> +
> +  if (expr->nelts == 3 && expr->elts[0].opcode == OP_INTERNALVAR)
> +    {
> +      struct internalvar *intvar = expr->elts[1].internalvar;
> +      if (intvar)
> +       name = internalvar_name (intvar);
> +    }
> +
> +  if (!name || *name == '\0')
> +    error (_("Invalid name of trace variable"));

Waitaminute.  Is there a merge error here?

Repeating the snippet:

> +  name = argv[0];
> +  if (name[0] != '$')
> +    error (_("Name of trace variable should start with '$'"));
> +  ++name;
> +

I think this whole bit above shouldn't be here.

> +  expr = parse_expression (argv[0]);
> +  back_to = make_cleanup (xfree, expr);
> +
> +  if (expr->nelts == 3 && expr->elts[0].opcode == OP_INTERNALVAR)
> +    {
> +      struct internalvar *intvar = expr->elts[1].internalvar;
> +      if (intvar)
> +       name = internalvar_name (intvar);  <<<<<<<< (1)
> +    }
> +
> +  if (!name || *name == '\0')
> +    error (_("Invalid name of trace variable"));

Otherwise, it looks like you can get here with an invalid name, if
the expression did parse sucessfully, but (1) wasn't reached at all.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]