daily update
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index 1e0feecf7c0c3835d33319fd2ff36ee7384143ed..3aff49b2d4aef1c1d6d7bb6f45768f841de94e64 100644 (file)
@@ -46,6 +46,7 @@
 #include "gdbthread.h"
 #include "stack.h"
 #include "gdbcore.h"
+#include "remote.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -382,10 +383,9 @@ trace_variable_command (char *args, int from_tty)
 void
 delete_trace_variable_command (char *args, int from_tty)
 {
-  int i, ix;
+  int ix;
   char **argv;
   struct cleanup *back_to;
-  struct trace_state_variable *tsv;
 
   if (args == NULL)
     {
@@ -398,12 +398,12 @@ delete_trace_variable_command (char *args, int from_tty)
   argv = gdb_buildargv (args);
   back_to = make_cleanup_freeargv (argv);
 
-  for (i = 0; argv[i] != NULL; i++)
+  for (ix = 0; argv[ix] != NULL; ix++)
     {
-      if (*argv[i] == '$')
-       delete_trace_state_variable (argv[i] + 1);
+      if (*argv[ix] == '$')
+       delete_trace_state_variable (argv[ix] + 1);
       else
-       warning (_("Name \"%s\" not prefixed with '$', ignoring"), argv[i]);
+       warning (_("Name \"%s\" not prefixed with '$', ignoring"), argv[ix]);
     }
 
   do_cleanups (back_to);
@@ -446,7 +446,7 @@ tvariables_info_1 (void)
 
       back_to2 = make_cleanup_ui_out_tuple_begin_end (uiout, "variable");
 
-      name = concat ("$", tsv->name, NULL);
+      name = concat ("$", tsv->name, (char *) NULL);
       make_cleanup (xfree, name);
       ui_out_field_string (uiout, "name", name);
       ui_out_field_string (uiout, "initial", plongest (tsv->initial_value));
@@ -1226,7 +1226,6 @@ encode_actions_1 (struct command_line *action,
 {
   char *action_exp;
   struct expression *exp = NULL;
-  struct command_line *actions;
   int i;
   struct value *tempval;
   struct cmd_list_element *cmd;
@@ -1370,7 +1369,6 @@ encode_actions_1 (struct command_line *action,
                action_exp++;
 
                {
-                 unsigned long addr, len;
                  struct cleanup *old_chain = NULL;
                  struct cleanup *old_chain1 = NULL;
 
@@ -1401,8 +1399,8 @@ encode_actions_1 (struct command_line *action,
             here.  */
          gdb_assert (stepping_list);
 
-         encode_actions_1 (action->body_list[0], t, tloc, frame_reg, frame_offset,
-                           stepping_list, NULL);
+         encode_actions_1 (action->body_list[0], t, tloc, frame_reg,
+                           frame_offset, stepping_list, NULL);
        }
       else
        error (_("Invalid tracepoint command '%s'"), action->line);
@@ -1477,7 +1475,7 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
     {
       collect->aexpr_list =
        xrealloc (collect->aexpr_list,
-               2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
+                 2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
       collect->aexpr_listsize *= 2;
     }
   collect->aexpr_list[collect->next_aexpr_elt] = aexpr;
@@ -1488,12 +1486,11 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
 void
 start_tracing (void)
 {
-  char buf[2048];
   VEC(breakpoint_p) *tp_vec = NULL;
   int ix;
   struct breakpoint *t;
   struct trace_state_variable *tsv;
-  int any_enabled = 0;
+  int any_enabled = 0, num_to_download = 0;
   
   tp_vec = all_tracepoints ();
 
@@ -1507,10 +1504,15 @@ start_tracing (void)
   for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
     {
       if (t->enable_state == bp_enabled)
-       {
-         any_enabled = 1;
-         break;
-       }
+       any_enabled = 1;
+
+      if ((t->type == bp_fast_tracepoint
+          ? may_insert_fast_tracepoints
+          : may_insert_tracepoints))
+       ++num_to_download;
+      else
+       warning (_("May not insert %stracepoints, skipping tracepoint %d"),
+                (t->type == bp_fast_tracepoint ? "fast " : ""), t->number);
     }
 
   /* No point in tracing with only disabled tracepoints.  */
@@ -1520,10 +1522,21 @@ start_tracing (void)
       error (_("No tracepoints enabled, not starting trace"));
     }
 
+  if (num_to_download <= 0)
+    {
+      VEC_free (breakpoint_p, tp_vec);
+      error (_("No tracepoints that may be downloaded, not starting trace"));
+    }
+
   target_trace_init ();
 
   for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
     {
+      if ((t->type == bp_fast_tracepoint
+          ? !may_insert_fast_tracepoints
+          : !may_insert_tracepoints))
+       continue;
+
       t->number_on_target = 0;
       target_download_tracepoint (t);
       t->number_on_target = t->number;
@@ -1715,7 +1728,6 @@ trace_status_mi (int on_stop)
 {
   struct trace_status *ts = current_trace_status ();
   int status;
-  char *string_status;
 
   status = target_get_trace_status (ts);
 
@@ -1850,7 +1862,6 @@ tfind_1 (enum trace_find_type type, int num,
 {
   int target_frameno = -1, target_tracept = -1;
   struct frame_id old_frame_id = null_frame_id;
-  char *reply;
   struct breakpoint *tp;
 
   /* Only try to get the current stack frame if we have a chance of
@@ -2049,7 +2060,6 @@ static void
 trace_find_pc_command (char *args, int from_tty)
 {
   CORE_ADDR pc;
-  char tmp[40];
 
   if (current_trace_status ()->running && !current_trace_status ()->from_file)
     error ("May not look at trace frames while trace is running.");
@@ -2107,7 +2117,6 @@ trace_find_line_command (char *args, int from_tty)
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
   struct cleanup *old_chain;
-  char   startpc_str[40], endpc_str[40];
 
   if (current_trace_status ()->running && !current_trace_status ()->from_file)
     error ("May not look at trace frames while trace is running.");
@@ -2171,7 +2180,6 @@ static void
 trace_find_range_command (char *args, int from_tty)
 {
   static CORE_ADDR start, stop;
-  char start_str[40], stop_str[40];
   char *tmp;
 
   if (current_trace_status ()->running && !current_trace_status ()->from_file)
@@ -2205,7 +2213,6 @@ static void
 trace_find_outside_command (char *args, int from_tty)
 {
   CORE_ADDR start, stop;
-  char start_str[40], stop_str[40];
   char *tmp;
 
   if (current_trace_status ()->running && !current_trace_status ()->from_file)
@@ -2632,6 +2639,7 @@ trace_save (const char *filename, int target_does_save)
   if (ts->stop_reason == tracepoint_error)
     {
       char *buf = (char *) alloca (strlen (ts->error_desc) * 2 + 1);
+
       bin2hex ((gdb_byte *) ts->error_desc, buf, 0);
       fprintf (fp, ":%s", buf);
     }
@@ -3171,7 +3179,7 @@ tfile_open (char *filename, int from_tty)
   filename = tilde_expand (filename);
   if (!IS_ABSOLUTE_PATH(filename))
     {
-      temp = concat (current_directory, "/", filename, (char *)NULL);
+      temp = concat (current_directory, "/", filename, (char *) NULL);
       xfree (filename);
       filename = temp;
     }
@@ -3316,8 +3324,6 @@ tfile_interp_line (char *line,
 /* Parse the part of trace status syntax that is shared between
    the remote protocol and the trace file reader.  */
 
-extern char *unpack_varlen_hex (char *buff, ULONGEST *result);
-
 void
 parse_trace_status (char *line, struct trace_status *ts)
 {
@@ -3438,9 +3444,9 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
   char *p;
   char piece;
   ULONGEST num, addr, step, pass, orig_size, xlen, start;
-  int enabled, i, end;
+  int enabled, end;
   enum bptype type;
-  char *cond, *srctype, *src, *buf;
+  char *cond, *srctype, *buf;
   struct uploaded_tp *utp = NULL;
 
   p = line;
@@ -3727,7 +3733,7 @@ tfile_fetch_registers (struct target_ops *ops,
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   char block_type;
-  int i, pos, offset, regn, regsize, gotten, pc_regno;
+  int pos, offset, regn, regsize, gotten, pc_regno;
   unsigned short mlen;
   char *regs;
 
This page took 0.027331 seconds and 4 git commands to generate.