]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-06-21 Michael Snyder <msnyder@specifix.com>
authorMichael Snyder <msnyder@vmware.com>
Sun, 22 Jun 2008 20:42:49 +0000 (20:42 +0000)
committerMichael Snyder <msnyder@vmware.com>
Sun, 22 Jun 2008 20:42:49 +0000 (20:42 +0000)
Fix stepping/breakpoint off-by-one issues.
* gdbfreeplay-back.c (freeplay_find_event): Fix off-by-one error
on last_cached_frame.
(freeplay_show_next_commands): Ditto.
(handle_special_case): Ditto, plus don't pass breakpoint_p == TRUE
to target_compose_T_packet if we're stopped at the end of the
event cache.

gdb/gdbserver/ChangeLog
gdb/gdbserver/gdbfreeplay-back.c

index 672171e0b41e1cea5b910d4554b30aefe824bf40..d04cb3caf93212f51221b3bf2a59bced5bc29cc0 100644 (file)
@@ -1,5 +1,13 @@
 2008-06-21  Michael Snyder  <msnyder@specifix.com>
 
+       Fix stepping/breakpoint off-by-one issues.
+       * gdbfreeplay-back.c (freeplay_find_event): Fix off-by-one error
+       on last_cached_frame.
+       (freeplay_show_next_commands): Ditto.
+       (handle_special_case): Ditto, plus don't pass breakpoint_p == TRUE
+       to target_compose_T_packet if we're stopped at the end of the
+       event cache.
+
        * gdbfreeplay-back.c (handle_special_case): Silence gcc warning.
        * gdbfreeplay-i386.c (target_compose_g_packet): Ditto.
 
index cf9d409c0aece0a4986722989f819982678bfc03..d3aa0f59895818d3f621bfcd8c5d6e39c424e8a3 100644 (file)
@@ -573,7 +573,7 @@ freeplay_find_event (FILE *infile,
 
   /* Here's a strange loop for you: goes forward or backward.  */
   for (i = start; 
-       i >= 0 && i < last_cached_frame;
+       i >= 0 && i <= last_cached_frame;
        direction == DIR_FORWARD ? i++ : i--)
     {
       signum = stopframe_signal (infile, i);
@@ -648,12 +648,12 @@ freeplay_show_next_commands (FILE *infile)
 {
   char *line;
 
-  if (cur_frame >= 0 && cur_frame < last_cached_frame)
+  if (cur_frame >= 0 && cur_frame <= last_cached_frame)
     {
       fseek (infile, stopframe[cur_frame].eventpos, SEEK_SET);
       while ((line = fgets (inbuf, sizeof (inbuf), infile)) != NULL)
        {
-         if (cur_frame + 1 < last_cached_frame &&
+         if (cur_frame + 1 <= last_cached_frame &&
              ftell (infile) >= stopframe[cur_frame + 1].eventpos)
            /* Done with current frame.  */
            break;
@@ -800,7 +800,7 @@ handle_special_case (FILE *infile, int fd, char *request)
        }
       else
        {
-         cur_frame = last_cached_frame - 1;
+         cur_frame = last_cached_frame;
        }
 
       /* Find the original event message for this stop event.  */
@@ -811,6 +811,8 @@ handle_special_case (FILE *infile, int fd, char *request)
       if ((p = strstr (inbuf, "$T")) != NULL)
        return add_checksum (target_compose_T_packet (p,
                                                      stopframe[cur_frame].pc,
+                                                     next_event_frame == -1 ?
+                                                     0 :
                                                      1 /* breakpoint_p */));
       /* If it's a "$S", just return it (FIXME?)  */
       else
@@ -849,6 +851,8 @@ handle_special_case (FILE *infile, int fd, char *request)
       if ((p = strstr (inbuf, "$T")) != NULL)
        return add_checksum (target_compose_T_packet (p,
                                                      stopframe[cur_frame].pc,
+                                                     next_event_frame == -1 ?
+                                                     0 :
                                                      1 /* breakpoint_p */));
       /* If it's a "$S", just return it (FIXME?)  */
       else