I've fixed problem with "breakpoints management" in Classic Debugger.

Try to (in RDT):

0) 20.times do
     a = 1
     b = 2
     c = 3
   end

1) Set breakpoint on 2nd and 3rd line
2) Run debugger session
3) Debug e.g. few cycles, then remove breakpoint on *2nd* line

Debugger still stops there. This is due to the problem:

http://rubyforge.org/tracker/index.php?func=detail&aid=9548&group_id=3085&atid=11903

I've fixed it in the classic-debug.rb (see attachment). It works in the
frontends. But be sure you checked the change (Markus?). Since I have
some problems in NetBeans when running multiple debugger-sessions since
I shared all breakpoints with their indexes ("no") for all sessions
which does not work well with the patch - but was bug in the frontend.

So rather double-check the patch before applying. I believe it will
work for you.

Regards,
  m.

Index: classic-debug.rb
===================================================================
--- classic-debug.rb    (revision 2240)
+++ classic-debug.rb    (working copy)
@@ -527,8 +527,6 @@
       previous_line = nil
       display_expressions(binding)
       
-      
-      
       case input
       when /^\s*tr(?:ace)?(?:\s+(on|off))?(?:\s+(all))?$/
         if defined?( $2 )
@@ -560,16 +558,17 @@
           pname = pos = pos.intern.id2name
         end
         # TODO: pname is not used
-        break_points.push Breakpoint.new(true, 0, file, pos)
-        @printer.printXml("<breakpointAdded no=\"%d\" location=\"%s:%s\"/>", 
break_points.size, file, pos)
+        id = DEBUGGER__.next_breakpoint_id
+        break_points[id] = Breakpoint.new(true, 0, file, pos)
+        @printer.printXml("<breakpointAdded no=\"%d\" location=\"%s:%s\"/>", 
id, file, pos)
         
       when /^\s*delete\s+(\d+)$/
-        pos = $1.to_i
-        if pos < 1 || pos > break_points.length
-          @printer.printXml("<error>Breakpoint number out of bounds: %d. There 
are currently %d breakpoints defined.</error>", pos, break_points.length )
+        breakpoint_id = $1.to_i
+        if break_points.delete(breakpoint_id)
+          @printer.printXml("<breakpointDeleted no=\"%d\"/>", breakpoint_id)
         else         
-          break_points.delete_at(pos-1)
-          @printer.printXml("<breakpointDeleted no=\"%d\"/>", pos)
+          @printer.printXml("<error>No breakpoint with id: %d. Currently 
following breakpoints defined: %s</error>",
+                            breakpoint_id, breakpoints.keys.join(', '))
         end
         
         #        when /^\s*wat(?:ch)?\s+(.+)$/
@@ -605,24 +604,6 @@
         #            stdout.print "\n"
         #          end
         
-        #        when /^\s*del(?:ete)?(?:\s+(\d+))?$/
-        #          pos = $1
-        #          unless pos
-        #            input = readline("Clear all breakpoints? (y/n) ", false)
-        #            if input == "y"
-        #              for b in break_points
-        #                b[0] = false
-        #              end
-        #            end
-        #          else
-        #            pos = pos.to_i
-        #            if break_points[pos-1]
-        #              break_points[pos-1][0] = false
-        #            else
-        #              stdout.printf "Breakpoint %d is not defined\n", pos
-        #            end
-        #          end
-        
         #        when /^\s*disp(?:lay)?\s+(.+)$/
         #          exp = $1
         #          display.push [true, exp]
@@ -724,12 +705,8 @@
         @printer.debug("Unknown input : %s", input)
       end
       
-      
-      
     end
     
-    
-    
     def display_expressions(binding)
       n = 1
       for d in display
@@ -794,7 +771,7 @@
       return false if break_points.empty?
       file = File.basename(file)
       n = 1
-      for b in break_points
+      break_points.each_value do |b|
         @printer.debug("file=%s, pos=%s; breakpoint=[valid=%s, type=%s, 
file=%s, pos=%s]\n ",
                        file, pos, b.valid, b.type, b.file, b.pos)
         if b.valid
@@ -897,8 +874,9 @@
   trap("INT") { DEBUGGER__.interrupt }
   @last_thread = Thread::main
   @max_thread = 1
+  @max_breakpoint_id = 0
   @thread_list = {Thread::main => 1}
-  @break_points = []
+  @break_points = {} # id => Breakpoint
   @display = []
   @waiting = []
   @stdout = STDOUT
@@ -1079,7 +1057,11 @@
         return context(th) 
       end     
     end
+
+    def next_breakpoint_id
+      @max_breakpoint_id += 1
   end
+  end
   
   @@socket = nil
   @@printer = nil
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rubyeclipse-development mailing list
Rubyeclipse-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development

Reply via email to