Thu May 21 13:14:25 1998 John Metzler <jmetzler@cygnus.com>
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index cd809ffe209b449eb2cbf3778dd7efa08ea5cf7a..2916944897373ee298f6caff920bd1123fd796c8 100644 (file)
@@ -701,6 +701,8 @@ trace_pass_command (args, from_tty)
     if (t1 == (struct tracepoint *) -1 || t1 == t2)
       {
        t2->pass_count = count;
+        if (modify_tracepoint_hook)
+          modify_tracepoint_hook (t2);
        if (from_tty)
          printf_filtered ("Setting tracepoint %d's passcount to %d\n", 
                           t2->number, count);
@@ -840,7 +842,7 @@ read_actions (t)
       if (linetype == BADLINE)
        continue;       /* already warned -- collect another line */
 
-      temp = xmalloc (sizeof (struct action_line));
+      temp = (struct action_line *) xmalloc (sizeof (struct action_line));
       temp->next = NULL;
       temp->action = line;
 
@@ -1084,9 +1086,14 @@ parse_and_eval_memrange (arg, addr, typecode, offset, size)
 
 /* compare memranges for qsort */
 static int
-memrange_cmp (a, b)
-     struct memrange *a, *b;
+memrange_cmp (voidpa, voidpb)
+     void *voidpa, *voidpb;
 {
+  struct memrange *a, *b;
+
+  a = (struct memrange *) voidpa;
+  b = (struct memrange *) voidpb;
+
   if (a->type < b->type) return -1;
   if (a->type > b->type) return  1;
   if (a->type == 0)
@@ -1167,7 +1174,7 @@ add_memrange (memranges, type, base, len)
   if (memranges->next_memrange >= memranges->listsize)
     {
       memranges->listsize *= 2;
-      memranges->list = xrealloc (memranges->list, 
+      memranges->list = (struct memrange *) xrealloc (memranges->list, 
                                  memranges->listsize);
     }
 
@@ -1500,8 +1507,8 @@ encode_actions (t, tdp_actions, step_count, stepping_actions)
   memrange_sortmerge (&tracepoint_list); 
   memrange_sortmerge (&stepping_list); 
 
-  *tdp_actions      = stringify_collection_list (&tracepoint_list, &tdp_buff);
-  *stepping_actions = stringify_collection_list (&stepping_list,   &step_buff);
+  *tdp_actions      = stringify_collection_list (&tracepoint_list, tdp_buff);
+  *stepping_actions = stringify_collection_list (&stepping_list,   step_buff);
 }
 
 static char target_buf[2048];
@@ -1574,6 +1581,7 @@ trace_start_command (args, from_tty)
       set_traceframe_num (-1); /* all old traceframes invalidated */
       set_tracepoint_num (-1);
       set_traceframe_context(-1);
+      trace_running_p = 1;
     }
   else
     printf_filtered ("Trace can only be run on remote targets.\n");
@@ -1591,11 +1599,14 @@ trace_stop_command (args, from_tty)
       remote_get_noisy_reply (target_buf);
       if (strcmp (target_buf, "OK"))
        error ("Bogus reply from target: %s", target_buf);
+      trace_running_p = 0;
     }
   else
     error ("Trace can only be run on remote targets.");
 }
 
+unsigned long trace_running_p;
+
 /* tstatus command */
 static void
 trace_status_command (args, from_tty)
@@ -1606,8 +1617,13 @@ trace_status_command (args, from_tty)
     {
       putpkt ("qTStatus");
       remote_get_noisy_reply (target_buf);
-      if (strcmp (target_buf, "OK"))
-       error ("Bogus reply from target: %s", target_buf);
+
+      if (target_buf[0] != 'T' ||
+          (target_buf[1] != '0' && target_buf[1] != '1'))
+        error ("Bogus reply from target: %s", target_buf);
+      /* exported for use by the GUI */
+      trace_running_p = (target_buf[1] == '1');
     }
   else
     error ("Trace can only be run on remote targets.");
@@ -2424,13 +2440,13 @@ _initialize_tracepoint ()
   if (tracepoint_list.list == NULL)
     {
       tracepoint_list.listsize = 128;
-      tracepoint_list.list = xmalloc 
+      tracepoint_list.list = (struct memrange *) xmalloc 
        (tracepoint_list.listsize * sizeof (struct memrange));
     }
   if (stepping_list.list == NULL)
     {
       stepping_list.listsize = 128;
-      stepping_list.list = xmalloc 
+      stepping_list.list = (struct memrange *) xmalloc 
        (stepping_list.listsize * sizeof (struct memrange));
     }
 
This page took 0.024411 seconds and 4 git commands to generate.