Unable to step through cython code #1716

Open
lindsayad opened this Issue May 25, 2017 · 1 comment

Comments

Projects
None yet
1 participant
Contributor

lindsayad commented May 25, 2017

This example comes straight from here: https://stackoverflow.com/questions/21033553/cython-debugging-put-a-break-point. As shown by the cygdb session output below, breaking on a cython file line number drops me straight into the c file, as opposed to the pyx file. Ideas?

Ubuntu 16.04
Python version: 2.7.13
gdb version: 7.12

cygdb session:

(gdb) cy run python_file.py
499500


(gdb) cy break cython_file.big_sum
Breakpoint 1 at 0x7ffff69e87c0: file cython_file.c, line 798.
(gdb) cy run python_file.py                        
3    def big_sum():
(gdb) cy break :10
Breakpoint 2 at 0x7ffff69e873e: file cython_file.c, line 834.
(gdb) cy cont
851      for (__pyx_t_1 = 0; __pyx_t_1 < 0x3E8; __pyx_t_1+=1) {
(gdb) cy list
   846     *     my_sum = 0
   847     *     for i in range(1000):             # <<<<<<<<<<<<<<
   848     *         my_sum += a[i]
   849     *     return my_sum
   850     */
>  851      for (__pyx_t_1 = 0; __pyx_t_1 < 0x3E8; __pyx_t_1+=1) {
   852        __pyx_v_i = __pyx_t_1;
   853    
   854        /* "cython_file.pyx":12
   855     *     my_sum = 0
(gdb) 
Contributor

lindsayad commented May 25, 2017

Since I did create the issue with the name "unable to step through", here's examples with step (as well as next):

(gdb) cy run python_file.py
499500


(gdb) cy break cython_file.big_sum 
Breakpoint 1 at 0x7ffff69e87c0: file cython_file.c, line 798.
(gdb) cy run python_file.py                      
3    def big_sum():
(gdb) s
__pyx_pf_11cython_file_big_sum (__pyx_self=<optimized out>) at cython_file.c:805
805	static PyObject *__pyx_pf_11cython_file_big_sum(CYTHON_UNUSED PyObject *__pyx_self) {
(gdb) cy run python_file.py
3    def big_sum():
(gdb) n
__pyx_pf_11cython_file_big_sum (__pyx_self=<optimized out>) at cython_file.c:805
805	static PyObject *__pyx_pf_11cython_file_big_sum(CYTHON_UNUSED PyObject *__pyx_self) {
(gdb) cy break cython_file:7
Breakpoint 2 at 0x7ffff69e8718: file cython_file.c, line 824.
(gdb) cy run python_file.py                   
3    def big_sum():
(gdb) disable 1
(gdb) cy run python_file.py                   
832        (__pyx_v_a[__pyx_v_i]) = __pyx_v_i;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment