开发者

How to set watchpoints via procfs in Linux?

开发者 https://www.devze.com 2023-01-05 10:45 出处:网络
I\'m trying to build a debugger-like program under Linux (Ubuntu) and I\'ve run into some problems. From what I\'ve heard, the /proc vfs provides mechanisms to

I'm trying to build a debugger-like program under Linux (Ubuntu) and I've run into some problems. From what I've heard, the /proc vfs provides mechanisms to create watchpoints, but I can't seem to find out how.

Some man pages pointed me to “cont开发者_如何学Pythonrol file”s, supposedly located at /proc/<pid>/ctl, but I can't find this file anywhere. (Perhaps this file is only for Solaris? Or maybe it's Ubuntu's fault?)


Under Linux, as far as I know, a debugger will have to call ptrace to attach to the process being debugged, and possibly to influence its behavior.

Looking at the source of GDB is likely to be helpful.

There is information in /proc/<pid> that is of interest to debuggers. For example, you can read the process's memory via /proc/<pid>/mem. You can also use ptrace for this, and you need to use ptrace to write.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号