This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI tracepoints 6/9] trace variable commands
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Vladimir Prus <vladimir at codesourcery dot com>
- Date: Mon, 15 Mar 2010 18:00:38 +0000
- Subject: Re: [MI tracepoints 6/9] trace variable commands
- References: <201003141158.36113.vladimir@codesourcery.com>
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