From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>,
Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH] Fix buf inside tracepoint tfile memory read
Date: Fri, 15 Jun 2012 10:29:00 -0000 [thread overview]
Message-ID: <CANFwon1KjWcSroY0WrVKq31xipn_ZauYMdZsEee09xMkk-gR_Q@mail.gmail.com> (raw)
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;
}
next reply other threads:[~2012-06-15 10:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 10:29 Hui Zhu [this message]
2012-06-15 15:07 ` Pedro Alves
2012-06-16 15:33 ` Hui Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANFwon1KjWcSroY0WrVKq31xipn_ZauYMdZsEee09xMkk-gR_Q@mail.gmail.com \
--to=teawater@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox