merge from gcc
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index a1feb18fc2eb9f1fa6c355ed490a9fb2d476d759..6351377d26ef210013d1e928562d2957a63cc774 100644 (file)
@@ -1,5 +1,5 @@
 /* Tracing functionality for remote targets in custom GDB protocol
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -32,7 +32,9 @@
 #include "tracepoint.h"
 #include "remote.h"
 #include "linespec.h"
+#include "regcache.h"
 #include "completer.h"
+#include "gdb-events.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -355,7 +357,7 @@ set_raw_tracepoint (struct symtab_and_line sal)
   t->language = current_language->la_language;
   t->input_radix = input_radix;
   t->line_number = sal.line;
-  t->enabled = enabled;
+  t->enabled_p = 1;
   t->next = 0;
   t->step_count = 0;
   t->pass_count = 0;
@@ -422,10 +424,6 @@ trace_command (char *arg, int from_tty)
        t->addr_string = savestring (addr_start, addr_end - addr_start);
 
       trace_mention (t);
-
-      /* Let the UI know of any additions */
-      if (create_tracepoint_hook)
-       create_tracepoint_hook (t);
     }
 
   if (sals.nelts > 1)
@@ -478,19 +476,38 @@ tracepoints_info (char *tpnum_exp, int from_tty)
        {
          printf_filtered ("Num Enb ");
          if (addressprint)
-           printf_filtered ("Address    ");
+           {
+             if (TARGET_ADDR_BIT <= 32)
+               printf_filtered ("Address    ");
+             else
+               printf_filtered ("Address            ");
+           }
          printf_filtered ("PassC StepC What\n");
        }
       strcpy (wrap_indent, "                           ");
       if (addressprint)
-       strcat (wrap_indent, "           ");
+       {
+         if (TARGET_ADDR_BIT <= 32)
+           strcat (wrap_indent, "           ");
+         else
+           strcat (wrap_indent, "                   ");
+       }
 
       printf_filtered ("%-3d %-3s ", t->number,
-                      t->enabled == enabled ? "y" : "n");
+                      t->enabled_p ? "y" : "n");
       if (addressprint)
-       printf_filtered ("%s ",
-                        local_hex_string_custom ((unsigned long) t->address,
-                                                 "08l"));
+       {
+         char *tmp;
+
+         if (TARGET_ADDR_BIT <= 32)
+           tmp = longest_local_hex_string_custom (t->address
+                                                  & (CORE_ADDR) 0xffffffff, 
+                                                  "08l");
+         else
+           tmp = longest_local_hex_string_custom (t->address, "016l");
+
+         printf_filtered ("%s ", tmp);
+       }
       printf_filtered ("%-5d %-5ld ", t->pass_count, t->step_count);
 
       if (t->source_file)
@@ -552,14 +569,12 @@ tracepoint_operation (struct tracepoint *t, int from_tty,
   switch (opcode)
     {
     case enable_op:
-      t->enabled = enabled;
-      if (modify_tracepoint_hook)
-       modify_tracepoint_hook (t);
+      t->enabled_p = 1;
+      tracepoint_modify_event (t->number);
       break;
     case disable_op:
-      t->enabled = disabled;
-      if (modify_tracepoint_hook)
-       modify_tracepoint_hook (t);
+      t->enabled_p = 0;
+      tracepoint_modify_event (t->number);
       break;
     case delete_op:
       if (tracepoint_chain == t)
@@ -568,14 +583,11 @@ tracepoint_operation (struct tracepoint *t, int from_tty,
       ALL_TRACEPOINTS (t2)
        if (t2->next == t)
        {
+         tracepoint_delete_event (t2->number);
          t2->next = t->next;
          break;
        }
 
-      /* Let the UI know of any deletions */
-      if (delete_tracepoint_hook)
-       delete_tracepoint_hook (t);
-
       if (t->addr_string)
        xfree (t->addr_string);
       if (t->source_file)
@@ -721,8 +733,7 @@ trace_pass_command (char *args, int from_tty)
            if (t1 == (struct tracepoint *) -1 || t1 == t2)
              {
                t2->pass_count = count;
-               if (modify_tracepoint_hook)
-                 modify_tracepoint_hook (t2);
+               tracepoint_modify_event (t2->number);
                if (from_tty)
                  printf_filtered ("Setting tracepoint %d's passcount to %d\n",
                                   t2->number, count);
@@ -1477,7 +1488,8 @@ encode_actions (struct tracepoint *t, char ***tdp_actions,
   struct collection_list *collect;
   struct cmd_list_element *cmd;
   struct agent_expr *aexpr;
-  long frame_reg, frame_offset;
+  int frame_reg;
+  LONGEST frame_offset;
 
 
   clear_collection_list (&tracepoint_list);
@@ -1542,7 +1554,8 @@ encode_actions (struct tracepoint *t, char ***tdp_actions,
                  struct cleanup *old_chain1 = NULL;
                  struct agent_reqs areqs;
 
-                 exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1);
+                 exp = parse_exp_1 (&action_exp, 
+                                    block_for_pc (t->address), 1);
                  old_chain = make_cleanup (free_current_contents, &exp);
 
                  switch (exp->elts[0].opcode)
@@ -1723,7 +1736,7 @@ trace_start_command (char *args, int from_tty)
 
        sprintf_vma (tmp, t->address);
        sprintf (buf, "QTDP:%x:%s:%c:%lx:%x", t->number, tmp, /* address */
-                t->enabled == enabled ? 'E' : 'D',
+                t->enabled_p ? 'E' : 'D',
                 t->step_count, t->pass_count);
 
        if (t->actions)
@@ -2774,12 +2787,13 @@ Arguments are tracepoint numbers, separated by spaces.\n\
 No argument means enable all tracepoints.",
           &enablelist);
 
-  add_com ("trace", class_trace, trace_command,
-          "Set a tracepoint at a specified line or function or address.\n\
+  c = add_com ("trace", class_trace, trace_command,
+              "Set a tracepoint at a specified line or function or address.\n\
 Argument may be a line number, function name, or '*' plus an address.\n\
 For a line number or function, trace at the start of its code.\n\
 If an address is specified, trace at that exact address.\n\n\
 Do \"help tracepoints\" for info on other tracepoint commands.");
+  c->completer = location_completer;
 
   add_com_alias ("tp", "trace", class_alias, 0);
   add_com_alias ("tr", "trace", class_alias, 1);
This page took 0.031269 seconds and 4 git commands to generate.