- len = strlen (traceframe_sal.symtab->filename);
- file_range = create_range_type (file_range,
- builtin_type_int32, 0, len - 1);
- file_string = create_array_type (file_string,
- builtin_type_true_char, file_range);
- file_val = allocate_value (file_string);
- deprecated_set_value_type (file_val, file_string);
- memcpy (value_contents_raw (file_val),
- traceframe_sal.symtab->filename,
- len);
- deprecated_set_value_modifiable (file_val, 0);
- set_internalvar (lookup_internalvar ("trace_file"), file_val);
+ tsv->initial_value = initval;
+ printf_filtered (_("Trace state variable $%s now has initial value %s.\n"),
+ tsv->name, plongest (tsv->initial_value));
+ return;
+ }
+
+ /* Create a new variable. */
+ tsv = create_trace_state_variable (internalvar_name (intvar));
+ tsv->initial_value = initval;
+
+ printf_filtered (_("Trace state variable $%s created, with initial value %s.\n"),
+ tsv->name, plongest (tsv->initial_value));
+
+ do_cleanups (old_chain);
+}
+
+void
+delete_trace_variable_command (char *args, int from_tty)
+{
+ int i, ix;
+ char **argv;
+ struct cleanup *back_to;
+ struct trace_state_variable *tsv;
+
+ if (args == NULL)
+ {
+ if (query (_("Delete all trace state variables? ")))
+ VEC_free (tsv_s, tvariables);
+ dont_repeat ();
+ return;
+ }
+
+ argv = gdb_buildargv (args);
+ back_to = make_cleanup_freeargv (argv);
+
+ for (i = 0; argv[i] != NULL; i++)
+ {
+ if (*argv[i] == '$')
+ delete_trace_state_variable (argv[i] + 1);
+ else
+ warning (_("Name \"%s\" not prefixed with '$', ignoring"), argv[i]);
+ }
+
+ do_cleanups (back_to);
+
+ dont_repeat ();
+}
+
+/* List all the trace state variables. */
+
+static void
+tvariables_info (char *args, int from_tty)
+{
+ struct trace_state_variable *tsv;
+ int ix;
+ char *reply;
+ ULONGEST tval;
+
+ if (target_is_remote ())
+ {
+ char buf[20];
+
+ for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
+ {
+ /* We don't know anything about the value until we get a
+ valid packet. */
+ tsv->value_known = 0;
+ sprintf (buf, "qTV:%x", tsv->number);
+ putpkt (buf);
+ reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (reply && *reply)
+ {
+ if (*reply == 'V')
+ {
+ unpack_varlen_hex (reply + 1, &tval);
+ tsv->value = (LONGEST) tval;
+ tsv->value_known = 1;
+ }
+ /* FIXME say anything about oddball replies? */
+ }
+ }
+ }
+
+ if (VEC_length (tsv_s, tvariables) == 0)
+ {
+ printf_filtered (_("No trace state variables.\n"));
+ return;
+ }
+
+ printf_filtered (_("Name\t\t Initial\tCurrent\n"));
+
+ for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
+ {
+ printf_filtered ("$%s", tsv->name);
+ print_spaces_filtered (17 - strlen (tsv->name), gdb_stdout);
+ printf_filtered ("%s ", plongest (tsv->initial_value));
+ print_spaces_filtered (11 - strlen (plongest (tsv->initial_value)), gdb_stdout);
+ if (tsv->value_known)
+ printf_filtered (" %s", plongest (tsv->value));
+ else if (trace_running_p || traceframe_number >= 0)
+ /* The value is/was defined, but we don't have it. */
+ printf_filtered (_(" <unknown>"));
+ else
+ /* It is not meaningful to ask about the value. */
+ printf_filtered (_(" <undefined>"));
+ printf_filtered ("\n");