How to trace a program execution with ptrace?

匆匆过客 提交于 2019-12-11 23:43:31

问题


I've been trying to use the system call "ptrace" (using the PTRACE_SINGLESTEP macro) to trace the execution of a simple application.

While recording the execution of the program I would like to skip the useless part of the reading to only follow from the 'main' of my application. Because whenever I launch my tracer I get around 100k execution steps.

Cordialy


回答1:


You may want to insert a breakpoint at main entry, wait for a SIGTRAP to arrive, restore the instruction under the breakpoint, and single-step from there.



来源:https://stackoverflow.com/questions/6125836/how-to-trace-a-program-execution-with-ptrace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!