aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2008-06-26 00:23:57 +0000
committerMichael Snyder <msnyder@vmware.com>2008-06-26 00:23:57 +0000
commitcf71a65754ed8db4a67eda9be063d779fa6c9cf7 (patch)
tree502689b8dffd8e71f232aa8b66e56d4961093ed6
parentadfb1a08ec7cfaf7d992b3f9410598698641f016 (diff)
downloadgdb-msnyder-reverse-20080609-branch.zip
gdb-msnyder-reverse-20080609-branch.tar.gz
gdb-msnyder-reverse-20080609-branch.tar.bz2
2008-06-25 Michael Snyder <msnyder@specifix.com>msnyder-reverse-20080609-branch
* gdbfreeplay-back.c (frame_find_request): Rewrite loop to avoid fencepost error on last frame.
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/gdbfreeplay-back.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 70b3306..259a081 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-25 Michael Snyder <msnyder@specifix.com>
+
+ * gdbfreeplay-back.c (frame_find_request): Rewrite loop to
+ avoid fencepost error on last frame.
+
2008-06-23 Michael Snyder <msnyder@specifix.com>
* gdbfreeplay.h: Replace all address values with unsigned long long.
diff --git a/gdb/gdbserver/gdbfreeplay-back.c b/gdb/gdbserver/gdbfreeplay-back.c
index bcfe49b..7d7cf41 100644
--- a/gdb/gdbserver/gdbfreeplay-back.c
+++ b/gdb/gdbserver/gdbfreeplay-back.c
@@ -326,11 +326,12 @@ frame_find_request (FILE *logfile, char *request)
curpos = stopframe[cur_frame].eventpos;
fseek (logfile, curpos, SEEK_SET);
/* Now search for a matching request. */
- while (curpos < stopframe[cur_frame + 1].eventpos)
+ while ((line = fgets (inbuf, sizeof (inbuf), logfile)) != NULL)
{
- line = fgets (inbuf, sizeof (inbuf), logfile);
- /* End of input? */
- if (line == NULL)
+ /* End of current frame?
+ If we're the last frame, just read till the end of file. */
+ if (cur_frame < last_cached_frame &&
+ curpos >= stopframe[cur_frame + 1].eventpos)
break;
curpos = ftell (logfile);
if (strstr (line, request) != NULL)