This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix buf inside tracepoint tfile memory read
- From: Hui Zhu <teawater at gmail dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Fri, 15 Jun 2012 18:28:32 +0800
- Subject: [PATCH] Fix buf inside tracepoint tfile memory read
Hi,
When I try tfile with KGTP, got some error that tfine didn't give the
right value of memory.
So I checked the code and found that:
if (maddr <= offset && offset < (maddr + mlen))
{
amt = (maddr + mlen) - offset;
if (amt > len)
amt = len;
tfile_read (readbuf, amt);
return amt;
}
This part code is for memroy read form tfile. But if the offset is
not same with maddr, it will not read from the right part. Because
this code always read from the 0 offset of this part of memory.
So I add some code to handle this issue, and it is fixed.
Please help me review it.
Joel, I remember GDB will release a new version after 3 weeks. I
suggest this issue be fixed before this release.
Thanks,
Hui
2012-06-15 Hui Zhu <hui_zhu@mentor.com>
* tracepoint.c (tfile_xfer_partial): Add a lseek.
---
tracepoint.c | 2 ++
1 file changed, 2 insertions(+)
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -4545,6 +4545,8 @@ tfile_xfer_partial (struct target_ops *o
if (amt > len)
amt = len;
+ if (maddr != offset)
+ lseek (trace_fd, offset - maddr, SEEK_CUR);
tfile_read (readbuf, amt);
return amt;
}