This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: icache-dcache coherence on ARM
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 arm-linux-nat.c,
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