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.
/* 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);
{
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;
}
else
{
- cur_frame = last_cached_frame - 1;
+ cur_frame = last_cached_frame;
}
/* Find the original event message for this stop event. */
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
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