Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Fix pyflame for code compiled with ld -z separate-code #170

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

randomstuff
Copy link

@randomstuff randomstuff commented Feb 27, 2019

This generates VAS layouts like this:

555555554000-5555555a8000 r--p 00000000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
5555555a8000-55555573d000 r-xp 00054000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
55555573d000-5555557ce000 r--p 001e9000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
5555557cf000-555555835000 rw-p 0027a000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
555555835000-555555865000 rw-p 00000000 00:00 0                          [heap]
7ffff7fd0000-7ffff7fd3000 r--p 00000000 00:00 0                          [vvar]
7ffff7fd3000-7ffff7fd5000 r-xp 00000000 00:00 0                          [vdso]
7ffff7fd5000-7ffff7fd6000 r--p 00000000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7fd6000-7ffff7ff4000 r-xp 00001000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ff4000-7ffff7ffc000 r--p 0001f000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ffc000-7ffff7ffe000 rw-p 00026000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]

This is enabled by default on Linux/x86 since 2.29
(f6aec96dce1ddbd8961a3aa8a2925db2021719bb).

@CLAassistant
Copy link

CLAassistant commented Feb 27, 2019

CLA assistant check
All committers have signed the CLA.

@randomstuff
Copy link
Author

This fixes pyflame on 3.6 (including 3.6.6+) for me. It won't work for 3.7 because there is no _PyThreadState_Current symbol anymore.

#  define _PyThreadState_Current _PyRuntime.gilstate.tstate_current 

I'll try to have a look at that later on.

@randomstuff
Copy link
Author

This should fix #165 / #157.

@randomstuff randomstuff force-pushed the fix_separate_code branch 2 times, most recently from 2ea2894 to 26bd8b1 Compare February 27, 2019 23:05
@randomstuff randomstuff changed the title Fix pyflame for code compiles with ld -z separate-code Fix pyflame for code compiled with ld -z separate-code Feb 28, 2019
separate-code generates VAS layouts like this:

555555554000-5555555a8000 r--p 00000000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
5555555a8000-55555573d000 r-xp 00054000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
55555573d000-5555557ce000 r--p 001e9000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
5555557cf000-555555835000 rw-p 0027a000 08:02 919707                     /opt/python-3.6.8/bin/python3.6
555555835000-555555865000 rw-p 00000000 00:00 0                          [heap]
7ffff7fd0000-7ffff7fd3000 r--p 00000000 00:00 0                          [vvar]
7ffff7fd3000-7ffff7fd5000 r-xp 00000000 00:00 0                          [vdso]
7ffff7fd5000-7ffff7fd6000 r--p 00000000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7fd6000-7ffff7ff4000 r-xp 00001000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ff4000-7ffff7ffc000 r--p 0001f000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ffc000-7ffff7ffe000 rw-p 00026000 08:02 265255                     /lib/x86_64-linux-gnu/ld-2.28.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]

This is enabled by default on Linux/x86 since 2.29
(f6aec96dce1ddbd8961a3aa8a2925db2021719bb).
@gaetano-guerriero
Copy link

gaetano-guerriero commented Mar 8, 2019

This makes pyflame usable again for me with python 2.7.16 (debian buster), will this be merged ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants