gdb/
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index 4ca4ec2a1d572663164aaa9a1f79168e3a78dfc3..82ca0b8ec9785165fa01d0426d0ddc8b1d7ad365 100644 (file)
@@ -1701,6 +1701,7 @@ start_tracing (void)
   for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
     {
       struct tracepoint *t = (struct tracepoint *) b;
+      struct bp_location *loc;
 
       if ((b->type == bp_fast_tracepoint
           ? !may_insert_fast_tracepoints
@@ -1708,7 +1709,18 @@ start_tracing (void)
        continue;
 
       t->number_on_target = 0;
-      target_download_tracepoint (b);
+
+      for (loc = b->loc; loc; loc = loc->next)
+       {
+         /* Since tracepoint locations are never duplicated, `inserted'
+            flag should be zero.  */
+         gdb_assert (!loc->inserted);
+
+         target_download_tracepoint (loc);
+
+         loc->inserted = 1;
+       }
+
       t->number_on_target = b->number;
     }
   VEC_free (breakpoint_p, tp_vec);
@@ -3199,10 +3211,10 @@ cond_string_is_same (char *str1, char *str2)
 /* Look for an existing tracepoint that seems similar enough to the
    uploaded one.  Enablement isn't compared, because the user can
    toggle that freely, and may have done so in anticipation of the
-   next trace run.  */
+   next trace run.  Return the location of matched tracepoint.  */
 
-struct tracepoint *
-find_matching_tracepoint (struct uploaded_tp *utp)
+struct bp_location *
+find_matching_tracepoint_location (struct uploaded_tp *utp)
 {
   VEC(breakpoint_p) *tp_vec = all_tracepoints ();
   int ix;
@@ -3224,7 +3236,7 @@ find_matching_tracepoint (struct uploaded_tp *utp)
          for (loc = b->loc; loc; loc = loc->next)
            {
              if (loc->address == utp->addr)
-               return t;
+               return loc;
            }
        }
     }
@@ -3239,17 +3251,24 @@ void
 merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
 {
   struct uploaded_tp *utp;
-  struct tracepoint *t;
 
   /* Look for GDB tracepoints that match up with our uploaded versions.  */
   for (utp = *uploaded_tps; utp; utp = utp->next)
     {
-      t = find_matching_tracepoint (utp);
-      if (t)
-       printf_filtered (_("Assuming tracepoint %d is same "
-                          "as target's tracepoint %d at %s.\n"),
-                        t->base.number, utp->number,
-                        paddress (get_current_arch (), utp->addr));
+      struct bp_location *loc;
+      struct tracepoint *t;
+
+      loc = find_matching_tracepoint_location (utp);
+      if (loc)
+       {
+         /* Mark this location as already inserted.  */
+         loc->inserted = 1;
+         t = (struct tracepoint *) loc->owner;
+         printf_filtered (_("Assuming tracepoint %d is same "
+                            "as target's tracepoint %d at %s.\n"),
+                          loc->owner->number, utp->number,
+                          paddress (loc->gdbarch, utp->addr));
+       }
       else
        {
          t = create_tracepoint_from_upload (utp);
This page took 0.03055 seconds and 4 git commands to generate.