Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: JRuby 0.9.8
    • Fix Version/s: JRuby 0.9.9
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Try to run ('sophisticated' printf just for convenience):

      ====
      printf "%8s %20s:%-2d %10s %8s\n", 'event', 'file', 0, 'id', 'classname'
      $stdout.puts "-" * 80
      set_trace_func proc { |event, file, line, id, binding, classname|
      printf "%8s %20s:%-2d %10s %-8s\n", event, file, line, id ? id : 'nil', classname
      }

      class B
      end
      ====

      1) Number are wrong which causes obvious problem for debugging
      2) There is empty filename for 'end' event which causes a kind of special problem for debug-commons during its start-up

      1. JRUBY-591.patch
        3 kB
        Charles Oliver Nutter
      2. JRUBY-591.patch
        1 kB
        Charles Oliver Nutter

        Activity

        Hide
        Martin Krauskopf added a comment -

        Hi, is there any plan about fixing this issue? It is a blocker regarding JRuby debugging. There are more problems with line numbers but it might be the same culprit like the one in this issue.

        Show
        Martin Krauskopf added a comment - Hi, is there any plan about fixing this issue? It is a blocker regarding JRuby debugging. There are more problems with line numbers but it might be the same culprit like the one in this issue.
        Hide
        Martin Krauskopf added a comment -

        Bwt I tried to take a look where the culprit is. But after while I've ended up somewhere in the org.jruby.lexer.yacc package, ISourcePosition, maybe RubyYaccLexer and similar. So I've "postponed" my attempt for the uncertain future

        Show
        Martin Krauskopf added a comment - Bwt I tried to take a look where the culprit is. But after while I've ended up somewhere in the org.jruby.lexer.yacc package, ISourcePosition, maybe RubyYaccLexer and similar. So I've "postponed" my attempt for the uncertain future
        Hide
        Charles Oliver Nutter added a comment -

        With the patch from JRUBY-451, this is the output I'm getting:

        ~/NetBeansProjects/jruby $ jruby test.rb
           event                 file:0          id classname
        --------------------------------------------------------------------------------
            line              test.rb:5         nil false   
          c-call              test.rb:5   inherited Object  
        c-return              test.rb:5   inherited Object  
           class              test.rb:5         nil false   
             end                     :0         nil false   
        ~/NetBeansProjects/jruby $ ruby test.rb
           event                 file:0          id classname
        --------------------------------------------------------------------------------
            line              test.rb:5         nil false   
          c-call              test.rb:5   inherited Class   
        c-return              test.rb:5   inherited Class   
           class              test.rb:5         nil false   
             end              test.rb:5         nil false
        

        At this point it seems there's one remaining issue: the missing filename and position for end. I'll look into that now.

        Show
        Charles Oliver Nutter added a comment - With the patch from JRUBY-451 , this is the output I'm getting: ~/NetBeansProjects/jruby $ jruby test.rb event file:0 id classname -------------------------------------------------------------------------------- line test.rb:5 nil false c-call test.rb:5 inherited Object c-return test.rb:5 inherited Object class test.rb:5 nil false end :0 nil false ~/NetBeansProjects/jruby $ ruby test.rb event file:0 id classname -------------------------------------------------------------------------------- line test.rb:5 nil false c-call test.rb:5 inherited Class c-return test.rb:5 inherited Class class test.rb:5 nil false end test.rb:5 nil false At this point it seems there's one remaining issue: the missing filename and position for end. I'll look into that now.
        Hide
        Charles Oliver Nutter added a comment -

        Oh, also the Class vs Object thing...that's a little weird, but perhaps not as critical as the end bug. I will look into that too.

        Show
        Charles Oliver Nutter added a comment - Oh, also the Class vs Object thing...that's a little weird, but perhaps not as critical as the end bug. I will look into that too.
        Hide
        Charles Oliver Nutter added a comment -

        There's a one-line change that fixes the null file/position information included in this patch. Also included is the patch changes from JRUBY-451.

        The Object vs Class issue appears to be a problem with the current "self". Inherited should be called when creating a new class, but the caller should be an instance of Class. This doesn't appear to be propagating correctly. I will continue to investigate.

        Show
        Charles Oliver Nutter added a comment - There's a one-line change that fixes the null file/position information included in this patch. Also included is the patch changes from JRUBY-451 . The Object vs Class issue appears to be a problem with the current "self". Inherited should be called when creating a new class, but the caller should be an instance of Class. This doesn't appear to be propagating correctly. I will continue to investigate.
        Hide
        Charles Oliver Nutter added a comment -

        Ok, one more one-liner change and the outputs appear to match. It seems that "inherited" was being defined on Class's metaclass, rather than on Class itself. I'm not sure why that was the case, since it doesn't need to be called from outside class anywhere I can see. Moving the definition to Class itself allows the output to match. So then, the current output, with all fixes from JRUBY-451 and JRUBY-591:

        ~/NetBeansProjects/jruby $ ruby test.rb
           event                 file:0          id classname
        --------------------------------------------------------------------------------
            line              test.rb:5         nil false   
          c-call              test.rb:5   inherited Class   
        c-return              test.rb:5   inherited Class   
           class              test.rb:5         nil false   
             end              test.rb:5         nil false   
        ~/NetBeansProjects/jruby $ jruby test.rb
           event                 file:0          id classname
        --------------------------------------------------------------------------------
            line              test.rb:5         nil false   
          c-call              test.rb:5   inherited Class   
        c-return              test.rb:5   inherited Class   
           class              test.rb:5         nil false   
             end              test.rb:5         nil false  
        

        I'd like a few other eyes on the changes, but they don't break any unit tests and they seem to make sense.

        Show
        Charles Oliver Nutter added a comment - Ok, one more one-liner change and the outputs appear to match. It seems that "inherited" was being defined on Class's metaclass, rather than on Class itself. I'm not sure why that was the case, since it doesn't need to be called from outside class anywhere I can see. Moving the definition to Class itself allows the output to match. So then, the current output, with all fixes from JRUBY-451 and JRUBY-591 : ~/NetBeansProjects/jruby $ ruby test.rb event file:0 id classname -------------------------------------------------------------------------------- line test.rb:5 nil false c-call test.rb:5 inherited Class c-return test.rb:5 inherited Class class test.rb:5 nil false end test.rb:5 nil false ~/NetBeansProjects/jruby $ jruby test.rb event file:0 id classname -------------------------------------------------------------------------------- line test.rb:5 nil false c-call test.rb:5 inherited Class c-return test.rb:5 inherited Class class test.rb:5 nil false end test.rb:5 nil false I'd like a few other eyes on the changes, but they don't break any unit tests and they seem to make sense.
        Hide
        Martin Krauskopf added a comment -

        Thanks - I've tested the trunk + the patch with the NetBeans debugger and it works much better. There are some other issues which, I think, are not blocker for GUI debuggers. I will fill them later if this patch makes it to the trunk.

        Show
        Martin Krauskopf added a comment - Thanks - I've tested the trunk + the patch with the NetBeans debugger and it works much better. There are some other issues which, I think, are not blocker for GUI debuggers. I will fill them later if this patch makes it to the trunk.
        Hide
        Thomas E Enebo added a comment -

        Looks great too me. startLine + 1 seems right and swapping when the trace return happens is obviously a better place. I think there are a few special pos assignments that MRI does, but for all I know we are correct now anyways.

        Show
        Thomas E Enebo added a comment - Looks great too me. startLine + 1 seems right and swapping when the trace return happens is obviously a better place. I think there are a few special pos assignments that MRI does, but for all I know we are correct now anyways.
        Hide
        Charles Oliver Nutter added a comment -

        Fixed. Open new issues for anything additional. Thanks for the report!

        Show
        Charles Oliver Nutter added a comment - Fixed. Open new issues for anything additional. Thanks for the report!

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Martin Krauskopf
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: