Linux: is there a way to use ptrace without stopping/pausing the process (SIGSTOP)?

后端 未结 2 1381
有刺的猬
有刺的猬 2021-01-21 09:01

I\'m trying to port a program from Windows to Linux.
I encountered a problem when I found out that there isn\'t a \"real\" ReadProcessMemory counterpart on Linu

2条回答
  •  醉话见心
    2021-01-21 09:39

    Davide,

    Have you had a look at the /proc filesystem? It contains memory map files that can be used to peek at the full process space. You can also write in the space to set a breakpoint. There is a wealth of other information in /proc as well.

    The PTRACE_CONT command can be used to continue a process. Generally, the target will be paused with a PTRACE_ATTACH when the debugger attaches.

    The man page says PTRACE_SIEZE should not pause the process. What flavor and version of Linux are you using? PTRACE_SIEZE has been around for quite awhile so I'm not sure why you are having trouble there.

    I note the addr value is set to 0x12345. Is this a valid address in the target space? Or was that just an example? How is the stack address of interest (&value) communicated between the two processes?

    I'm not too sure about the return codes. Generally a 0 means all is well, the errno may just be a hangover value from the last error.

    --Matt

提交回复
热议问题