Determining programmatically what modules are loaded in another process? (OS X)

后端 未结 4 889
名媛妹妹
名媛妹妹 2020-12-30 12:34

What I\'m trying to do I feel is pretty straightforward, I\'m just not sure exactly how to do it.

Specifically I just want to get a list of modules (shared/dynamic l

4条回答
  •  没有蜡笔的小新
    2020-12-30 12:55

    I would suggest that you could go download the source for gdb as used by the Development Tools.

    But, well, I've read that source and I'm not sure that telling anyone to go read it is a productive suggestion.

    In any case, you will want to use the various mach APIs to do this. In particular, the APIs are found in /usr/include/mach/*.h. Specifically, you'll want to start with task_for_pid() and work your way down to the info you need.

    Note that task_for_pid() (and any other mechanism used to grub through another tasks innards) requires either admin access or membership in the development group on the machine.

提交回复
热议问题