[pypy-dev] How to ptrace pypy stack

Armin Rigo armin.rigo at gmail.com
Sat Jul 21 14:07:16 EDT 2018


Hi,

On 21 July 2018 at 17:00, tao he <hetaofirst at gmail.com> wrote:
> Yes, I have just read  the code of  https://eng.uber.com/pyflame/ .  And I
> try to do it with pypy, but  not work. So I have to ask for help.

This is more complicated to do in PyPy than in CPython.  PyPy has got
a JIT, and the JIT does not actually create the frame objects that are
found not to be needed.  This has been done, however, in "vmprof".

"vmprof" is similar to what you're trying to do, as far as I can tell,
but it is using an in-process timer instead of using "ptrace".  It
seems to me like it is simpler anyway: I don't understand why you
would use ptrace at all, honestly.  ptrace can be useful for profiling
a random external process, but if the goal is the profile exactly the
CPython (or PyPy) interpreter, then you may as well add code directly
inside instead of messing around with ptrace introspecting debugging
symbols to recontruct the state.


A bientôt,

Armin.


More information about the pypy-dev mailing list