ruby-debug-base 0.9-mswin32 → 0.9.1-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +8 -0
 - data/ext/ruby_debug.c +45 -20
 - data/lib/ruby_debug.so +0 -0
 - metadata +2 -2
 
    
        data/CHANGES
    CHANGED
    
    | 
         @@ -1,3 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            0.9.1
         
     | 
| 
      
 2 
     | 
    
         
            +
            - Fixed incorrent stack calculation.
         
     | 
| 
      
 3 
     | 
    
         
            +
            - Context#stop_next= method aliased as Context#step.
         
     | 
| 
      
 4 
     | 
    
         
            +
            - Added the 'force' parameter to Context#step_over.
         
     | 
| 
      
 5 
     | 
    
         
            +
            - Added the 'force' parameter to Context#step.
         
     | 
| 
      
 6 
     | 
    
         
            +
            - 'next+/step+' commands forces to move to another line
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Added a new 'forcestep' setting.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       1 
9 
     | 
    
         
             
            0.9
         
     | 
| 
       2 
10 
     | 
    
         
             
            - Kernel#debugger method will start the debugger if it's not running.
         
     | 
| 
       3 
11 
     | 
    
         
             
            - Added Context#stop_reason method.
         
     | 
    
        data/ext/ruby_debug.c
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            #include <rubysig.h>
         
     | 
| 
       5 
5 
     | 
    
         
             
            #include <st.h>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            #define DEBUG_VERSION "0.9"
         
     | 
| 
      
 7 
     | 
    
         
            +
            #define DEBUG_VERSION "0.9.1"
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            #ifdef _WIN32
         
     | 
| 
       10 
10 
     | 
    
         
             
            struct FRAME {
         
     | 
| 
         @@ -50,15 +50,12 @@ RUBY_EXTERN struct RVarmap *ruby_dyna_vars; 
     | 
|
| 
       50 
50 
     | 
    
         
             
            #define CTX_FL_WAS_RUNNING  (1<<6)
         
     | 
| 
       51 
51 
     | 
    
         
             
            #define CTX_FL_MOVED        (1<<7)
         
     | 
| 
       52 
52 
     | 
    
         
             
            #define CTX_FL_STEPPED      (1<<8)
         
     | 
| 
      
 53 
     | 
    
         
            +
            #define CTX_FL_FORCE_MOVE   (1<<9)
         
     | 
| 
       53 
54 
     | 
    
         | 
| 
       54 
55 
     | 
    
         
             
            #define CTX_FL_TEST(c,f)  ((c)->flags & (f))
         
     | 
| 
       55 
56 
     | 
    
         
             
            #define CTX_FL_SET(c,f)   do { (c)->flags |= (f); } while (0)
         
     | 
| 
       56 
57 
     | 
    
         
             
            #define CTX_FL_UNSET(c,f) do { (c)->flags &= ~(f); } while (0)
         
     | 
| 
       57 
58 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
            #define DID_MOVED   (debug_context->last_line != line || \
         
     | 
| 
       59 
     | 
    
         
            -
                                      debug_context->last_file == NULL || \
         
     | 
| 
       60 
     | 
    
         
            -
                                      strcmp(debug_context->last_file, file) != 0)
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
59 
     | 
    
         
             
            #define IS_STARTED  (threads_tbl != Qnil)
         
     | 
| 
       63 
60 
     | 
    
         
             
            #define FRAME_N(n)  (&debug_context->frames[debug_context->stack_size-(n)-1])
         
     | 
| 
       64 
61 
     | 
    
         
             
            #define GET_FRAME   (FRAME_N(check_frame_number(debug_context, frame)))
         
     | 
| 
         @@ -768,6 +765,7 @@ save_current_position(debug_context_t *debug_context) 
     | 
|
| 
       768 
765 
     | 
    
         
             
                debug_context->last_line = debug_frame->line;
         
     | 
| 
       769 
766 
     | 
    
         
             
                CTX_FL_UNSET(debug_context, CTX_FL_MOVED);
         
     | 
| 
       770 
767 
     | 
    
         
             
                CTX_FL_UNSET(debug_context, CTX_FL_STEPPED);
         
     | 
| 
      
 768 
     | 
    
         
            +
                CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
         
     | 
| 
       771 
769 
     | 
    
         
             
            }
         
     | 
| 
       772 
770 
     | 
    
         | 
| 
       773 
771 
     | 
    
         
             
            inline static char *
         
     | 
| 
         @@ -811,7 +809,7 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass) 
     | 
|
| 
       811 
809 
     | 
    
         
             
                VALUE breakpoint = Qnil, binding = Qnil;
         
     | 
| 
       812 
810 
     | 
    
         
             
                debug_context_t *debug_context;
         
     | 
| 
       813 
811 
     | 
    
         
             
                char *file = NULL;
         
     | 
| 
       814 
     | 
    
         
            -
                int line = 0;
         
     | 
| 
      
 812 
     | 
    
         
            +
                int line = 0, moved = 0;
         
     | 
| 
       815 
813 
     | 
    
         | 
| 
       816 
814 
     | 
    
         
             
                hook_count++;
         
     | 
| 
       817 
815 
     | 
    
         | 
| 
         @@ -862,15 +860,24 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass) 
     | 
|
| 
       862 
860 
     | 
    
         
             
                  if(debug == Qtrue)
         
     | 
| 
       863 
861 
     | 
    
         
             
                      fprintf(stderr, "%s:%d [%s] %s\n", file, line, get_event_name(event), rb_id2name(mid));
         
     | 
| 
       864 
862 
     | 
    
         | 
| 
       865 
     | 
    
         
            -
                  if( 
     | 
| 
      
 863 
     | 
    
         
            +
                  if(debug_context->last_line != line || debug_context->last_file == NULL ||
         
     | 
| 
      
 864 
     | 
    
         
            +
                      strcmp(debug_context->last_file, file) != 0)
         
     | 
| 
      
 865 
     | 
    
         
            +
                  {
         
     | 
| 
       866 
866 
     | 
    
         
             
                      CTX_FL_SET(debug_context, CTX_FL_MOVED);
         
     | 
| 
      
 867 
     | 
    
         
            +
                      moved = 1;
         
     | 
| 
      
 868 
     | 
    
         
            +
                  }
         
     | 
| 
       867 
869 
     | 
    
         
             
                }
         
     | 
| 
       868 
870 
     | 
    
         
             
                else if(event != RUBY_EVENT_RETURN && event != RUBY_EVENT_C_RETURN)
         
     | 
| 
       869 
871 
     | 
    
         
             
                {
         
     | 
| 
       870 
872 
     | 
    
         
             
                    if(debug == Qtrue)
         
     | 
| 
       871 
     | 
    
         
            -
                        fprintf(stderr, " 
     | 
| 
      
 873 
     | 
    
         
            +
                        fprintf(stderr, "nodeless [%s] %s\n", get_event_name(event), rb_id2name(mid));
         
     | 
| 
       872 
874 
     | 
    
         
             
                    goto cleanup;
         
     | 
| 
       873 
875 
     | 
    
         
             
                }
         
     | 
| 
      
 876 
     | 
    
         
            +
                else
         
     | 
| 
      
 877 
     | 
    
         
            +
                {
         
     | 
| 
      
 878 
     | 
    
         
            +
                    if(debug == Qtrue)
         
     | 
| 
      
 879 
     | 
    
         
            +
                        fprintf(stderr, "nodeless [%s] %s\n", get_event_name(event), rb_id2name(mid));
         
     | 
| 
      
 880 
     | 
    
         
            +
                }
         
     | 
| 
       874 
881 
     | 
    
         | 
| 
       875 
882 
     | 
    
         
             
                if(event != RUBY_EVENT_LINE)
         
     | 
| 
       876 
883 
     | 
    
         
             
                    CTX_FL_SET(debug_context, CTX_FL_STEPPED);
         
     | 
| 
         @@ -895,10 +902,12 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass) 
     | 
|
| 
       895 
902 
     | 
    
         
             
                    if(debug_context->dest_frame == -1 ||
         
     | 
| 
       896 
903 
     | 
    
         
             
                        debug_context->stack_size == debug_context->dest_frame)
         
     | 
| 
       897 
904 
     | 
    
         
             
                    {
         
     | 
| 
       898 
     | 
    
         
            -
                        debug_context 
     | 
| 
      
 905 
     | 
    
         
            +
                        if(moved || !CTX_FL_TEST(debug_context, CTX_FL_FORCE_MOVE))
         
     | 
| 
      
 906 
     | 
    
         
            +
                            debug_context->stop_next--;
         
     | 
| 
       899 
907 
     | 
    
         
             
                        if(debug_context->stop_next < 0)
         
     | 
| 
       900 
908 
     | 
    
         
             
                            debug_context->stop_next = -1;
         
     | 
| 
       901 
     | 
    
         
            -
                        if(CTX_FL_TEST(debug_context, CTX_FL_STEPPED)  
     | 
| 
      
 909 
     | 
    
         
            +
                        if(moved || (CTX_FL_TEST(debug_context, CTX_FL_STEPPED) && 
         
     | 
| 
      
 910 
     | 
    
         
            +
                                    !CTX_FL_TEST(debug_context, CTX_FL_FORCE_MOVE)))
         
     | 
| 
       902 
911 
     | 
    
         
             
                        {
         
     | 
| 
       903 
912 
     | 
    
         
             
                            debug_context->stop_line--;
         
     | 
| 
       904 
913 
     | 
    
         
             
                            CTX_FL_UNSET(debug_context, CTX_FL_STEPPED);
         
     | 
| 
         @@ -978,7 +987,7 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass) 
     | 
|
| 
       978 
987 
     | 
    
         
             
                case RUBY_EVENT_C_RETURN:
         
     | 
| 
       979 
988 
     | 
    
         
             
                {
         
     | 
| 
       980 
989 
     | 
    
         
             
                    /* note if a block is given we fall through! */
         
     | 
| 
       981 
     | 
    
         
            -
                    if(!c_call_new_frame_p(klass, mid))
         
     | 
| 
      
 990 
     | 
    
         
            +
                    if(!node || !c_call_new_frame_p(klass, mid))
         
     | 
| 
       982 
991 
     | 
    
         
             
                        break;
         
     | 
| 
       983 
992 
     | 
    
         
             
                }
         
     | 
| 
       984 
993 
     | 
    
         
             
                case RUBY_EVENT_RETURN:
         
     | 
| 
         @@ -1662,34 +1671,45 @@ debug_at_exit(VALUE self) 
     | 
|
| 
       1662 
1671 
     | 
    
         | 
| 
       1663 
1672 
     | 
    
         
             
            /*
         
     | 
| 
       1664 
1673 
     | 
    
         
             
             *   call-seq:
         
     | 
| 
       1665 
     | 
    
         
            -
             *      context. 
     | 
| 
      
 1674 
     | 
    
         
            +
             *      context.step(steps, force = false)
         
     | 
| 
       1666 
1675 
     | 
    
         
             
             *
         
     | 
| 
       1667 
     | 
    
         
            -
             *   Stops the current context after a number +steps+ are made.
         
     | 
| 
      
 1676 
     | 
    
         
            +
             *   Stops the current context after a number of +steps+ are made.
         
     | 
| 
      
 1677 
     | 
    
         
            +
             *   +force+ parameter (if true) ensures that the cursor moves from the current line.
         
     | 
| 
       1668 
1678 
     | 
    
         
             
             */
         
     | 
| 
       1669 
1679 
     | 
    
         
             
            static VALUE
         
     | 
| 
       1670 
     | 
    
         
            -
            context_stop_next(VALUE  
     | 
| 
      
 1680 
     | 
    
         
            +
            context_stop_next(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       1671 
1681 
     | 
    
         
             
            {
         
     | 
| 
      
 1682 
     | 
    
         
            +
                VALUE steps, force;
         
     | 
| 
       1672 
1683 
     | 
    
         
             
                debug_context_t *debug_context;
         
     | 
| 
       1673 
1684 
     | 
    
         | 
| 
       1674 
1685 
     | 
    
         
             
                debug_check_started();
         
     | 
| 
       1675 
     | 
    
         
            -
             
     | 
| 
      
 1686 
     | 
    
         
            +
             
     | 
| 
      
 1687 
     | 
    
         
            +
                rb_scan_args(argc, argv, "11", &steps, &force);
         
     | 
| 
       1676 
1688 
     | 
    
         
             
                if(FIX2INT(steps) < 0)
         
     | 
| 
       1677 
1689 
     | 
    
         
             
                    rb_raise(rb_eRuntimeError, "Steps argument can't be negative.");
         
     | 
| 
      
 1690 
     | 
    
         
            +
             
     | 
| 
      
 1691 
     | 
    
         
            +
                Data_Get_Struct(self, debug_context_t, debug_context);
         
     | 
| 
       1678 
1692 
     | 
    
         
             
                debug_context->stop_next = FIX2INT(steps);
         
     | 
| 
      
 1693 
     | 
    
         
            +
                if(RTEST(force))
         
     | 
| 
      
 1694 
     | 
    
         
            +
                    CTX_FL_SET(debug_context, CTX_FL_FORCE_MOVE);
         
     | 
| 
      
 1695 
     | 
    
         
            +
                else
         
     | 
| 
      
 1696 
     | 
    
         
            +
                    CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
         
     | 
| 
       1679 
1697 
     | 
    
         | 
| 
       1680 
1698 
     | 
    
         
             
                return steps;
         
     | 
| 
       1681 
1699 
     | 
    
         
             
            }
         
     | 
| 
       1682 
1700 
     | 
    
         | 
| 
       1683 
1701 
     | 
    
         
             
            /*
         
     | 
| 
       1684 
1702 
     | 
    
         
             
             *   call-seq:
         
     | 
| 
       1685 
     | 
    
         
            -
             *      context.step_over(steps)
         
     | 
| 
      
 1703 
     | 
    
         
            +
             *      context.step_over(steps, frame = nil, force = false)
         
     | 
| 
       1686 
1704 
     | 
    
         
             
             *
         
     | 
| 
       1687 
1705 
     | 
    
         
             
             *   Steps over a +steps+ number of times.
         
     | 
| 
      
 1706 
     | 
    
         
            +
             *   Make step over operation on +frame+, by default the current frame.
         
     | 
| 
      
 1707 
     | 
    
         
            +
             *   +force+ parameter (if true) ensures that the cursor moves from the current line.
         
     | 
| 
       1688 
1708 
     | 
    
         
             
             */
         
     | 
| 
       1689 
1709 
     | 
    
         
             
            static VALUE
         
     | 
| 
       1690 
1710 
     | 
    
         
             
            context_step_over(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       1691 
1711 
     | 
    
         
             
            {
         
     | 
| 
       1692 
     | 
    
         
            -
                VALUE lines, frame;
         
     | 
| 
      
 1712 
     | 
    
         
            +
                VALUE lines, frame, force;
         
     | 
| 
       1693 
1713 
     | 
    
         
             
                debug_context_t *debug_context;
         
     | 
| 
       1694 
1714 
     | 
    
         | 
| 
       1695 
1715 
     | 
    
         
             
                debug_check_started();
         
     | 
| 
         @@ -1697,10 +1717,10 @@ context_step_over(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       1697 
1717 
     | 
    
         
             
                if(debug_context->stack_size == 0)
         
     | 
| 
       1698 
1718 
     | 
    
         
             
                    rb_raise(rb_eRuntimeError, "No frames collected.");
         
     | 
| 
       1699 
1719 
     | 
    
         | 
| 
       1700 
     | 
    
         
            -
                rb_scan_args(argc, argv, " 
     | 
| 
      
 1720 
     | 
    
         
            +
                rb_scan_args(argc, argv, "12", &lines, &frame, &force);
         
     | 
| 
       1701 
1721 
     | 
    
         
             
                debug_context->stop_line = FIX2INT(lines);
         
     | 
| 
       1702 
1722 
     | 
    
         
             
                CTX_FL_UNSET(debug_context, CTX_FL_STEPPED);
         
     | 
| 
       1703 
     | 
    
         
            -
                if( 
     | 
| 
      
 1723 
     | 
    
         
            +
                if(frame == Qnil)
         
     | 
| 
       1704 
1724 
     | 
    
         
             
                {
         
     | 
| 
       1705 
1725 
     | 
    
         
             
                    debug_context->dest_frame = debug_context->stack_size;
         
     | 
| 
       1706 
1726 
     | 
    
         
             
                }
         
     | 
| 
         @@ -1710,6 +1730,10 @@ context_step_over(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       1710 
1730 
     | 
    
         
             
                        rb_raise(rb_eRuntimeError, "Destination frame is out of range.");
         
     | 
| 
       1711 
1731 
     | 
    
         
             
                    debug_context->dest_frame = debug_context->stack_size - FIX2INT(frame);
         
     | 
| 
       1712 
1732 
     | 
    
         
             
                }
         
     | 
| 
      
 1733 
     | 
    
         
            +
                if(RTEST(force))
         
     | 
| 
      
 1734 
     | 
    
         
            +
                    CTX_FL_SET(debug_context, CTX_FL_FORCE_MOVE);
         
     | 
| 
      
 1735 
     | 
    
         
            +
                else
         
     | 
| 
      
 1736 
     | 
    
         
            +
                    CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
         
     | 
| 
       1713 
1737 
     | 
    
         | 
| 
       1714 
1738 
     | 
    
         
             
                return Qnil;
         
     | 
| 
       1715 
1739 
     | 
    
         
             
            }
         
     | 
| 
         @@ -2281,7 +2305,8 @@ static void 
     | 
|
| 
       2281 
2305 
     | 
    
         
             
            Init_context()
         
     | 
| 
       2282 
2306 
     | 
    
         
             
            {
         
     | 
| 
       2283 
2307 
     | 
    
         
             
                cContext = rb_define_class_under(mDebugger, "Context", rb_cObject);
         
     | 
| 
       2284 
     | 
    
         
            -
                rb_define_method(cContext, "stop_next=", context_stop_next, 1);
         
     | 
| 
      
 2308 
     | 
    
         
            +
                rb_define_method(cContext, "stop_next=", context_stop_next, -1);
         
     | 
| 
      
 2309 
     | 
    
         
            +
                rb_define_method(cContext, "step", context_stop_next, -1);
         
     | 
| 
       2285 
2310 
     | 
    
         
             
                rb_define_method(cContext, "step_over", context_step_over, -1);
         
     | 
| 
       2286 
2311 
     | 
    
         
             
                rb_define_method(cContext, "stop_frame=", context_stop_frame, 1);
         
     | 
| 
       2287 
2312 
     | 
    
         
             
                rb_define_method(cContext, "thread", context_thread, 0);
         
     | 
    
        data/lib/ruby_debug.so
    CHANGED
    
    | 
         Binary file 
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -3,8 +3,8 @@ rubygems_version: 0.9.2 
     | 
|
| 
       3 
3 
     | 
    
         
             
            specification_version: 1
         
     | 
| 
       4 
4 
     | 
    
         
             
            name: ruby-debug-base
         
     | 
| 
       5 
5 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       6 
     | 
    
         
            -
              version:  
     | 
| 
       7 
     | 
    
         
            -
            date: 2007-04- 
     | 
| 
      
 6 
     | 
    
         
            +
              version: 0.9.1
         
     | 
| 
      
 7 
     | 
    
         
            +
            date: 2007-04-02 22:05:51 -04:00
         
     | 
| 
       8 
8 
     | 
    
         
             
            summary: Fast Ruby debugger
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_paths: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            - lib
         
     |