Author: Richard Plangger <planri...@gmail.com> Branch: vmprof-native Changeset: r90707:0f877a858b49 Date: 2017-03-15 17:22 +0100 http://bitbucket.org/pypy/pypy/changeset/0f877a858b49/
Log: fix test, no debugging symbols could be found diff --git a/rpython/rlib/rvmprof/src/rvmprof.c b/rpython/rlib/rvmprof/src/rvmprof.c --- a/rpython/rlib/rvmprof/src/rvmprof.c +++ b/rpython/rlib/rvmprof/src/rvmprof.c @@ -8,6 +8,7 @@ # include "structdef.h" # include "src/threadlocal.h" # include "rvmprof.h" +# include "forwarddecl.h" #endif @@ -23,7 +24,6 @@ #ifdef RPYTHON_LL2CTYPES int IS_VMPROF_EVAL(void * ptr) { return 0; } #else -extern void * __vmprof_eval_vmprof; int IS_VMPROF_EVAL(void * ptr) { return ptr == __vmprof_eval_vmprof; diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c b/rpython/rlib/rvmprof/src/shared/vmp_stack.c --- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c +++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c @@ -25,6 +25,7 @@ static int (*unw_step)(unw_cursor_t*) = NULL; static int (*unw_init_local)(unw_cursor_t *, unw_context_t *) = NULL; static int (*unw_get_proc_info)(unw_cursor_t *, unw_proc_info_t *) = NULL; +static int (*unw_get_proc_name)(unw_cursor_t *, char *, size_t, unw_word_t*) = NULL; static int (*unw_is_signal_frame)(unw_cursor_t *) = NULL; static int (*unw_getcontext)(unw_context_t *) = NULL; @@ -226,7 +227,7 @@ // printf("func_addr is 0, now %p\n", rip); //} -#ifdef RPYTHON_VMPROF +#ifdef PYPY_JIT_CODEMAP long start_addr = 0; unw_word_t rip = 0; if (unw_get_reg(&cursor, UNW_REG_IP, &rip) < 0) { @@ -237,7 +238,7 @@ if (IS_VMPROF_EVAL((void*)pip.start_ip)) { // yes we found one stack entry of the python frames! return vmp_walk_and_record_python_stack_only(frame, result, max_depth, depth, pc); -#ifdef RPYTHON_VMPROF +#ifdef PYPY_JIT_CODEMAP } else if (pypy_find_codemap_at_addr(rip, &start_addr) != NULL) { depth = vmprof_write_header_for_jit_addr(result, depth, pc, max_depth); return vmp_walk_and_record_python_stack_only(frame, result, max_depth, depth, pc); @@ -468,6 +469,8 @@ #define UL_PREFIX "" #endif +extern void * __vmprof_eval_vmprof_addr; + int vmp_native_enable(void) { void * libhandle; vmp_native_traces_enabled = 1; @@ -482,6 +485,9 @@ if (!(unw_get_proc_info = dlsym(libhandle, UL_PREFIX PREFIX "_get_proc_info"))){ goto bail_out; } + if (!(unw_get_proc_name = dlsym(libhandle, UL_PREFIX PREFIX "_get_proc_name"))){ + goto bail_out; + } if (!(unw_init_local = dlsym(libhandle, UL_PREFIX PREFIX "_init_local"))) { goto bail_out; } diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py --- a/rpython/rlib/rvmprof/test/test_rvmprof.py +++ b/rpython/rlib/rvmprof/test/test_rvmprof.py @@ -151,18 +151,22 @@ os.unlink(tmpfilename) def test_native(): - eci = ExternalCompilationInfo(compile_extra=['-g','-O1'], + eci = ExternalCompilationInfo(compile_extra=['-g','-O0'], separate_module_sources=[""" - RPY_EXTERN int native_func(void) { + RPY_EXTERN int native_func(int d) { int j = 0; - for (int i = 0; i < 420000; i++) { - j += 1; + if (d > 0) { + return native_func(d-1); + } else { + for (int i = 0; i < 42000; i++) { + j += d; + } } return j; } """]) - native_func = rffi.llexternal("native_func", [], rffi.INT, + native_func = rffi.llexternal("native_func", [rffi.INT], rffi.INT, compilation_info=eci) class MyCode: @@ -180,7 +184,7 @@ if num > 0: return main(code, num-1) else: - return native_func() + return native_func(100) tmpfilename = str(udir.join('test_rvmprof')) @@ -195,8 +199,7 @@ period = 0.0001 rvmprof.enable(fd, period, native=1) for i in range(num): - res = main(code, 10) - #assert res == 499999500000 + res = main(code, 3) rvmprof.disable() os.close(fd) return 0 @@ -217,8 +220,7 @@ walk(child, symbols) symbols = [] walk(tree, symbols) - not_found = ['n:pypy_g_main', 'n:native_func', 'n:pypy_g_f', - 'n:pypy_g_main'] + not_found = ['n:native_func'] for sym in symbols: for i,name in enumerate(not_found): if sym.startswith(name): @@ -226,7 +228,7 @@ break assert not_found == [] - fn = compile(f, [], gcpolicy="minimark") + fn = compile(f, [], gcpolicy="incminimark", lldebug=True) assert fn() == 0 try: import vmprof _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit