gdb/
authorYao Qi <yao@codesourcery.com>
Wed, 27 Feb 2013 01:39:26 +0000 (01:39 +0000)
committerYao Qi <yao@codesourcery.com>
Wed, 27 Feb 2013 01:39:26 +0000 (01:39 +0000)
2013-02-27  Yao Qi  <yao@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

* tracepoint.c (tfile_trace_find): For tfind
     pc/tp/range/outside, look for the next trace frame instead of
     always starting from frame 0.

gdb/ChangeLog
gdb/tracepoint.c

index d8389f2107276e55526d67946da1a7d2ee1b7e7c..908af6b9e378bf74a2fd6fff0e676c23c5643b44 100644 (file)
@@ -1,3 +1,10 @@
+2013-02-27  Yao Qi  <yao@codesourcery.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * tracepoint.c (tfile_trace_find): For tfind
+       pc/tp/range/outside, look for the next trace frame instead of
+       always starting from frame 0.
+
 2013-02-26  Anthony Green  <green@moxielogic.com>
 
        * configure.tgt: Add support for moxie-*-rtems* target.
index ca104aa7b2164f75203fef7e7720ea043bb10ed5..9a80aa333a9a90c88b35c178f583c47f14613859 100644 (file)
@@ -4316,35 +4316,46 @@ tfile_trace_find (enum trace_find_type type, int num,
                                      ((gdb_byte *) &data_size, 4,
                                      gdbarch_byte_order (target_gdbarch ()));
       offset += 4;
-      switch (type)
+
+      if (type == tfind_number)
        {
-       case tfind_number:
+         /* Looking for a specific trace frame.  */
          if (tfnum == num)
            found = 1;
-         break;
-       case tfind_pc:
-         tfaddr = tfile_get_traceframe_address (tframe_offset);
-         if (tfaddr == addr1)
-           found = 1;
-         break;
-       case tfind_tp:
-         tp = get_tracepoint (num);
-         if (tp && tpnum == tp->number_on_target)
-           found = 1;
-         break;
-       case tfind_range:
-         tfaddr = tfile_get_traceframe_address (tframe_offset);
-         if (addr1 <= tfaddr && tfaddr <= addr2)
-           found = 1;
-         break;
-       case tfind_outside:
-         tfaddr = tfile_get_traceframe_address (tframe_offset);
-         if (!(addr1 <= tfaddr && tfaddr <= addr2))
-           found = 1;
-         break;
-       default:
-         internal_error (__FILE__, __LINE__, _("unknown tfind type"));
        }
+      else
+       {
+         /* Start from the _next_ trace frame.  */
+         if (tfnum > traceframe_number)
+           {
+             switch (type)
+               {
+               case tfind_pc:
+                 tfaddr = tfile_get_traceframe_address (tframe_offset);
+                 if (tfaddr == addr1)
+                   found = 1;
+                 break;
+               case tfind_tp:
+                 tp = get_tracepoint (num);
+                 if (tp && tpnum == tp->number_on_target)
+                   found = 1;
+                 break;
+               case tfind_range:
+                 tfaddr = tfile_get_traceframe_address (tframe_offset);
+                 if (addr1 <= tfaddr && tfaddr <= addr2)
+                   found = 1;
+                 break;
+               case tfind_outside:
+                 tfaddr = tfile_get_traceframe_address (tframe_offset);
+                 if (!(addr1 <= tfaddr && tfaddr <= addr2))
+                   found = 1;
+                 break;
+               default:
+                 internal_error (__FILE__, __LINE__, _("unknown tfind type"));
+               }
+           }
+       }
+
       if (found)
        {
          if (tpp)