You'll get EIO when trying to read from memory which the child process doesn't have mapped --- for example, anything around NULL. That's perfectly normal. (See the mem man page for more information.) So if you're following broken pointers in the child's address space, you need to be able to handle this.
If you're getting an IO error when you expect the child process' memory to actually exist, that's a bit weirder. There may be some odd interaction between /dev/X/mem
and ptrace when the child process is stopped. I would suggest investigating PTRACE_PEEKDATA
as an alternative way to read the child process' memory. It's much slower but potentially more reliable --- if /dev/X/mem
fails, try PTRACE_PEEKDATA
and see what it says. I'm assuming you have Java bindings for ptrace.