This is the mail archive of the
mailing list for the GDB project.
Re: icache-dcache coherence on ARM
Thanks for hinting that GDB may also use procfs. I replaced ptrace() with
procfs to write code to the inferior and my code is now always working as
I appreciate your helps!
On Mon, May 6, 2019 at 4:37 PM John Baldwin <email@example.com> wrote:
> On 5/6/19 2:17 PM, Xiaozhu Meng wrote:
> > Hi John,
> > Thanks for your reply!
> > I asked this question because our project on Linux actually encountered
> > this problem where we use ptrace to write new code into the inferior and
> > then continue the inferior. The continued inferior sometimes works as
> > expected, but sometimes crashes due to SIGILLs on seemingly legitimate
> > instructions.
> > So, I am very interested in seeing how GDB deals with this problem on
> > Linux.
> I do not see any explicit cache management in linux-nat.c or
> so my best guess is that GDB is relying on the kernel to manage this on
> Linux as well. I do see that TARGET_OBJECT_MEMORY on Linux can sometimes
> use /proc/<pid>/mem instead of ptrace(). I'm not very familiar with the
> Linux kernel, but one thing to check might be that both ptrace and procfs
> are doing the i-cache invalidation.
> John Baldwin