#13881: Enhanced debugging: cygdb and better backtraces
--------------------------------+-------------------------------------------
       Reporter:  vbraun        |         Owner:  GeorgSWeber 
           Type:  enhancement   |        Status:  needs_review
       Priority:  major         |     Milestone:  sage-5.6    
      Component:  build         |    Resolution:              
       Keywords:                |   Work issues:              
Report Upstream:  N/A           |     Reviewers:              
        Authors:  Volker Braun  |     Merged in:              
   Dependencies:  #13669        |      Stopgaps:              
--------------------------------+-------------------------------------------
Description changed by SimonKing:

Old description:

> The purpose of these patches is to make cython emit debugging output
> (unless `SAGE_DEBUG=no` since it only costs some disk space) and run
> cygdb instead of gdb for `sage --gdb` (unless `SAGE_DEBUG=no`, in which
> case you get the plain gdb). cydbg can be a bit slow to start up, but
> gives cython source-level debugging. For example:
> {{{
> [vbraun@volker-desktop sage-5.6.beta1]$ SAGE_DEBUG=yes ./sage -gdb
> ----------------------------------------------------------------------
> | Sage Version 5.6.beta1, Release Date: 2012-12-27                   |
> | Type "notebook()" for the browser-based notebook interface.        |
> | Type "help()" for help.                                            |
> ----------------------------------------------------------------------
> **********************************************************************
> *                                                                    *
> * Warning: this is a prerelease version, and it may be unstable.     *
> *                                                                    *
> **********************************************************************
> GNU gdb (GDB) 7.5.1
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from
> /home/vbraun/opt/sage-5.6.beta1/local/bin/python...done.
> Python was not compiled with debug symbols (or it was stripped). Some
> functionality may not work (properly).
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
>
> sage: from sage.tests.interrupt import unguarded_dereference_null_pointer
> sage: unguarded_dereference_null_pointer()
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007fffc1f9d04a in
> __pyx_f_4sage_5tests_9interrupt_dereference_null_pointer ()
>     at sage/tests/interrupt.c:894
> 894       (__pyx_v_ptr[__pyx_t_1]) = ((__pyx_v_ptr[__pyx_t_1]) + 1);
> (gdb) cy list
>     59    # Dereference a NULL pointer on purpose. This signals a SIGSEGV
> on most
>     60    # systems, but on older Mac OS X and possibly other systems,
> this
>     61    # signals a SIGBUS instead. In any case, this should give some
> signal.
>     62    cdef void dereference_null_pointer():
>     63        cdef long* ptr = <long*>(0)
> >   64        ptr[0] += 1
>     65
>     66
>     67
> ########################################################################
>     68    # Python helper functions
> #
> }}}
>
> Apply
>   * [attachment:trac_13881_cython_debug_symbols.patch] to the Sage
> library
>   * [attachment:trac_13881_launch_cygdb.patch] to the Sage root
> repository

New description:

 The purpose of these patches is to make cython emit debugging output
 (unless `SAGE_DEBUG=no` since it only costs some disk space) and run cygdb
 instead of gdb for `sage --gdb` (unless `SAGE_DEBUG=no`, in which case you
 get the plain gdb). cydbg can be a bit slow to start up, but gives cython
 source-level debugging. For example:
 {{{
 [vbraun@volker-desktop sage-5.6.beta1]$ SAGE_DEBUG=yes ./sage -gdb
 ----------------------------------------------------------------------
 | Sage Version 5.6.beta1, Release Date: 2012-12-27                   |
 | Type "notebook()" for the browser-based notebook interface.        |
 | Type "help()" for help.                                            |
 ----------------------------------------------------------------------
 **********************************************************************
 *                                                                    *
 * Warning: this is a prerelease version, and it may be unstable.     *
 *                                                                    *
 **********************************************************************
 GNU gdb (GDB) 7.5.1
 Copyright (C) 2012 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "x86_64-unknown-linux-gnu".
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>...
 Reading symbols from
 /home/vbraun/opt/sage-5.6.beta1/local/bin/python...done.
 Python was not compiled with debug symbols (or it was stripped). Some
 functionality may not work (properly).
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib64/libthread_db.so.1".

 sage: from sage.tests.interrupt import unguarded_dereference_null_pointer
 sage: unguarded_dereference_null_pointer()

 Program received signal SIGSEGV, Segmentation fault.
 0x00007fffc1f9d04a in
 __pyx_f_4sage_5tests_9interrupt_dereference_null_pointer ()
     at sage/tests/interrupt.c:894
 894       (__pyx_v_ptr[__pyx_t_1]) = ((__pyx_v_ptr[__pyx_t_1]) + 1);
 (gdb) cy list
     59    # Dereference a NULL pointer on purpose. This signals a SIGSEGV
 on most
     60    # systems, but on older Mac OS X and possibly other systems,
 this
     61    # signals a SIGBUS instead. In any case, this should give some
 signal.
     62    cdef void dereference_null_pointer():
     63        cdef long* ptr = <long*>(0)
 >   64        ptr[0] += 1
     65
     66
     67
 ########################################################################
     68    # Python helper functions
 #
 }}}

 Apply
   * [attachment:trac_13881_cython_debug_symbols.patch] to the Sage library
   * [attachment:trac_13881_launch_cygdb.patch] to the Sage root repository

 and then rebuild the sage libarary.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13881#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to