* [PATCH] Fix buf inside tracepoint tfile memory read
@ 2012-06-15 10:29 Hui Zhu
2012-06-15 15:07 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Hui Zhu @ 2012-06-15 10:29 UTC (permalink / raw)
To: gdb-patches ml, Joel Brobecker
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;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-16 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 10:29 [PATCH] Fix buf inside tracepoint tfile memory read Hui Zhu
2012-06-15 15:07 ` Pedro Alves
2012-06-16 15:33 ` Hui Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox