Skip to content

Commit beb98c0

Browse files
committed
extend readme (dev section), arm is now able to compile vmprof (tested on armv7l raspberry pi)
1 parent 7372997 commit beb98c0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Setting up development can be done using the following commands:
2727
$ source vmprof3/bin/activate
2828
$ python setup.py develop
2929

30+
You need to install python development packages. In case of e.g. Debian or Ubuntu the package you need is `python3-dev` and `libunwind-dev`.
3031
Now it is time to write a test and implement your feature. If you want
3132
your changes to affect vmprof.com, head over to
3233
https://github.com/vmprof/vmprof-server and follow the setup instructions.

setup.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from distutils.command.build_py import build_py
33
import os, sys
44
import subprocess
5+
import platform
56

67
IS_PYPY = '__pypy__' in sys.builtin_module_names
78

@@ -39,10 +40,15 @@ def run(self):
3940
extra_compile_args = ['-Wno-unused']
4041
extra_compile_args += ['-DVMPROF_LINUX=1']
4142
extra_compile_args += ['-DVMPROF_UNIX=1']
42-
if sys.maxsize == 2**63-1:
43-
libraries.append('unwind-x86_64')
43+
if platform.machine().startswith("arm"):
44+
libraries.append('unwind-arm')
45+
elif platform.machine().startswith("x86"):
46+
if sys.maxsize == 2**63-1:
47+
libraries.append('unwind-x86_64')
48+
else:
49+
libraries.append('unwind-x86')
4450
else:
45-
libraries.append('unwind-x86')
51+
raise NotImplementedError
4652
extra_source_files += [
4753
'src/vmprof_mt.c',
4854
'src/vmprof_unix.c',

src/_vmprof.c

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ PY_EVAL_RETURN_T * vmprof_eval(PY_STACK_FRAME_T *f, int throwflag)
3636
register PY_STACK_FRAME_T * callee_saved asm("rbx");
3737
#elif defined(X86_32)
3838
register PY_STACK_FRAME_T * callee_saved asm("edi");
39+
#elif defined(__arm__)
40+
register PY_STACK_FRAME_T * callee_saved asm("r4");
3941
#else
4042
# error "platform not supported"
4143
#endif
@@ -45,6 +47,8 @@ PY_EVAL_RETURN_T * vmprof_eval(PY_STACK_FRAME_T *f, int throwflag)
4547
"movq %1, %0\t\n"
4648
#elif defined(X86_32)
4749
"mov %1, %0\t\n"
50+
#elif defined(__arm__)
51+
"mov %1, %0\t\n"
4852
#else
4953
# error "platform not supported"
5054
#endif

0 commit comments

Comments
 (0)