This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 143957 - Breakpoints on "end" or "def" keyword in Ruby
Summary: Breakpoints on "end" or "def" keyword in Ruby
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-14 17:50 UTC by closer
Modified: 2011-01-28 20:12 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Breakpoint on end } in VS 2008 (51.34 KB, image/png)
2008-08-15 15:01 UTC, closer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description closer 2008-08-14 17:50:20 UTC
Hello All

Now I can install breakpoints on "end" or "def" keyword in Ruby editor, but debugger pass these breakpoints. Can you
extend debugger functionality and stop debugger on that keywords. 

I think that it feature will be a very helpful for Ruby and Rails developers.

Thanks
Comment 1 Martin Krauskopf 2008-08-15 10:56:07 UTC
The debugger stops at the 'def' definitions. But it stops there just first time when the class/module itself is
interpreted, e.g.:

  class A
    def hey # breakpoint here
      puts 'hey'
    end
  end

  A.new.hey

When you put breakpoint on 'def hey' line and start to debug the application, debugger stops there.

Or do you mean the "Function Breakpoint". I.e. each time method is called the debugger would stop there? Would behave as
if you put the breakpoint on the "puts 'hey'" line?
Comment 2 Martin Krauskopf 2008-08-15 10:56:59 UTC
> "end"

And by 'end' you mean to stop each time, method is being left?
Comment 3 closer 2008-08-15 14:55:15 UTC
Sorry, I was wrong about "def" keyword.

>And by 'end' you mean to stop each time, method is being left?
Yes, you are right. For example I has following method:

  def index
    @messages = Message.page(params[:page])
  end

And I want to see @messages at "Watch" window. At this case I can't do that because when I toggle break point on "end"
keyword the debugger pass it. Now I do following "hack":

  def index
    @messages = Message.page(params[:page])
    i = 0
  end

and toggle breakpoint on "i = 0" string. And all my code in "debug time" has "i = 0" string, I think that it is not
right and debugger should stop on "end" keyword.

That do you think about that idea?

Thanks
Comment 4 closer 2008-08-15 15:01:10 UTC
Created attachment 67543 [details]
Breakpoint on end } in VS 2008
Comment 5 closer 2008-08-15 15:03:28 UTC
For example Visual Studio IDE can stop debugger on end '}' (see picture in attach)
Comment 6 Martin Krauskopf 2008-08-15 15:22:28 UTC
Your example is clear, thansk. However this depends rather on the debugger backend, and might be on interpreter itself.
I know that MRI ruby-debug-base offer this possibility, jruby-debug-base not yet. Will have to check this there firstly.
(setting TM -> FUTURE, we are after feature freeze for 6.5)