Search code examples
iosmacosptrace

What are ‘I Space’ and ‘D Space’ on osx and the difference between them


In sys/ptrace.h, i saw something like:

@define PT_READ_I  1 /* read world in child's I space*/
@define PT_READ_D  2 /* read world in child's D space*/
@define PT_READ_U  3 /* read world in child's user structure*/

What are ‘I Space’ and ‘D Space’ and 'user structure'?


Solution

  • Quoting the man page:

    Traditionally, ptrace() has allowed for machines with distinct address spaces for instruction and data, which is why there are two requests: conceptually, PT_READ_I reads from the instruction space and PT_READ_D reads from the data space. In the current NetBSD implementation, these two requests are completely identical.

    Now about PT_READ_U:

    This space contains the registers and other information about the process; its layout corresponds to the user structure in the system.