diff options
author | Hafiz Abid Qadeer <abidh@codesourcery.com> | 2013-02-14 10:19:39 +0000 |
---|---|---|
committer | Hafiz Abid Qadeer <abidh@codesourcery.com> | 2013-02-14 10:19:39 +0000 |
commit | 1773c82c922d001ce8756eb9d7843c7a4abf4fd2 (patch) | |
tree | 928a8882b0323ad7e2ea6162e08e869d7b88afc5 /gdb/mi | |
parent | 53778a978f6a16eddc0532b0f6990c586612ce2c (diff) | |
download | gdb-1773c82c922d001ce8756eb9d7843c7a4abf4fd2.zip gdb-1773c82c922d001ce8756eb9d7843c7a4abf4fd2.tar.gz gdb-1773c82c922d001ce8756eb9d7843c7a4abf4fd2.tar.bz2 |
2013-02-14 Pedro Alves <pedro@codesourcery.com>
Hafiz Abid Qadeer <abidh@codesourcery.com>
gdb/
* tracepoint.h (validate_trace_state_variable_name): Declare.
* tracepoint.c (validate_trace_state_variable_name): New.
(trace_variable_command): Parse the trace state variable's name
without using parse_expression. Do several validations.
* mi/mi-main.c (mi_cmd_trace_define_variable): Don't parse the
trace state variable's name with parse_expression. Validate it.
gdb/testsuite/
* gdb.trace/tsv.exp: Adjust tests, and add a few more.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-main.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 28de126..37294e0 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2357,7 +2357,6 @@ void mi_cmd_trace_define_variable (char *command, char **argv, int argc) { struct expression *expr; - struct cleanup *back_to; LONGEST initval = 0; struct trace_state_variable *tsv; char *name = 0; @@ -2365,19 +2364,11 @@ mi_cmd_trace_define_variable (char *command, char **argv, int argc) if (argc != 1 && argc != 2) error (_("Usage: -trace-define-variable VARIABLE [VALUE]")); - 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); - } + name = argv[0]; + if (*name++ != '$') + error (_("Name of trace variable should start with '$'")); - if (!name || *name == '\0') - error (_("Invalid name of trace variable")); + validate_trace_state_variable_name (name); tsv = find_trace_state_variable (name); if (!tsv) @@ -2387,8 +2378,6 @@ mi_cmd_trace_define_variable (char *command, char **argv, int argc) initval = value_as_long (parse_and_eval (argv[1])); tsv->initial_value = initval; - - do_cleanups (back_to); } void |