There was an error while loading. Please reload this page.
1 parent 06b6899 commit b499348Copy full SHA for b499348
2 files changed
setup.py
@@ -25,7 +25,7 @@ def run(self):
25
libraries = []
26
extra_compile_args = ['-DVMPROF_WINDOWS=1']
27
elif sys.platform == 'darwin':
28
- libraries = []
+ libraries = ['unwind']
29
extra_compile_args = ['-Wno-unused']
30
extra_compile_args += ['-DVMPROF_APPLE=1']
31
extra_compile_args += ['-DVMPROF_UNIX=1']
src/vmp_stack.c
@@ -204,16 +204,25 @@ int vmp_walk_and_record_stack(PY_STACK_FRAME_T *frame, void ** result,
204
unw_cursor_t cursor;
205
unw_context_t uc;
206
unw_proc_info_t pip;
207
+ int ret;
208
209
if (vmp_native_enabled() == 0) {
210
return vmp_walk_and_record_python_stack_only(frame, result, max_depth, 0, pc);
211
}
212
- unw_getcontext(&uc);
213
- int ret = unw_init_local(&cursor, &uc);
+ ret = unw_getcontext(&uc);
214
if (ret < 0) {
215
// could not initialize lib unwind cursor and context
216
- return 0;
+ printf(stderr, "WARNING: unw_getcontext did not retreive context, switching to python profiling mode \n");
217
+ vmp_native_disable();
218
+ return vmp_walk_and_record_python_stack_only(frame, result, max_depth, 0, pc);
219
+ }
220
+ ret = unw_init_local(&cursor, &uc);
221
+ if (ret < 0) {
222
+ // could not initialize lib unwind cursor and context
223
+ printf(stderr, "WARNING: unw_init_local did not succeed, switching to python profiling mode \n");
224
225
226
227
228
if (signal < 0) {
0 commit comments