Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue finding interpreter with Python 3.7 and 32bit Linux #101

Closed
benfred opened this issue Mar 17, 2019 · 1 comment
Closed

Issue finding interpreter with Python 3.7 and 32bit Linux #101

benfred opened this issue Mar 17, 2019 · 1 comment

Comments

@benfred
Copy link
Owner

benfred commented Mar 17, 2019

With python 3.7, we've hardcoded the offset of interp_head relative to the _PyRuntime symbol https://github.com/benfred/py-spy/blob/master/src/python_spy.rs#L249 .

This is only valid for 64bit operating systems (the previous entry in the PyRuntimeState struct is a PyThreadState pointer), meaning that on 32bit linux we are always defaulting to scanning the BSS section for the interpreter state.

Instead of hardcoding this offset, we should include PyRuntimeState in the generated python bindings like we do for every other cpython struct.

@benfred
Copy link
Owner Author

benfred commented Mar 17, 2019

This caused warnings like

 INFO 2019-03-17T22:23:38Z: py_spy::python_spy: got symbol _PyRuntime (0x00000000008006c0) from python binary
 WARN 2019-03-17T22:23:38Z: py_spy::python_spy: Interpreter address from _PyRuntime symbol is invalid 0000000000000001
 INFO 2019-03-17T22:23:38Z: py_spy::python_spy: Failed to get interp_head from symbols, scanning BSS section from main binary
 INFO 2019-03-17T22:23:38Z: py_spy::python_spy: Found interpreter at 0x00000000021c1718

With the fix in #102 the logs look like:

 INFO 2019-03-17T22:25:53Z: py_spy::python_spy: got symbol _PyRuntime (0x00000000007966c0) from python binary
 INFO 2019-03-17T22:25:53Z: py_spy::python_spy: Found interpreter at 0x0000000000e15718

@benfred benfred closed this as completed Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant