![]() To run a program, you can call the execl() system. After that, we will run the tracked program in the child process, and run the tracking process code in the parent process.Īs mentioned earlier, the tracked program needs to be run in a subprocess. The above code creates a child process by calling fork(), but does nothing. We create a new file, strace.c, and the input code is as follows: Usually, you can use the fork() system call to create a new process, so naturally we also use the fork() system call. Since the first method uses the tracer to start the tracked program, two processes need to be started. In this paper, we mainly introduce the first method. The ptrace() system call also provides two kinds of "request" to implement the above two ways: One is to start the process through the strace command, and the other is to specify the process to be tracked through - p.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |