Broken tracing for Kernel.load
------------------------------

                 Key: JRUBY-2456
                 URL: http://jira.codehaus.org/browse/JRUBY-2456
             Project: JRuby
          Issue Type: Bug
          Components: Interpreter
    Affects Versions: JRuby 1.1.2
            Reporter: Martin Krauskopf
         Attachments: ThreadContext.patch

Try the below simple sample.

Firstly, where one should get 'nil' for method name, JRuby is passing name of 
loaded file.

The attached fix seems to fix it. I can provide mini-test, but 
test/test_trace_func.rb is disabled and moreover seems to be broken completely 
even in interpreted mode.

Secondly {{Kernel.load}} calls missing at all.

Thirdly the path is absolute. JRuby seems to prepend 
{{System.getProperty("user.dir")}} somehwere.

{{code}}
$ cat tester.rb 
lineNum = 0
Kernel.set_trace_func(lambda do |event, file, line, id, binding, clazz|
  printf "%4d. | %8s | %#{$0.length}s:%-4d | %12s | %8s\n", lineNum+=1, event, 
file, line, (id||'<nil>'), clazz
end)
load 'a.rb'
{{code}}

{{code}}
$ cat a.rb 
a=5
{{code}}

{{code}}
$ ruby tester.rb 
   1. |     line | tester.rb:5    |        <nil> |    false
   2. |   c-call | tester.rb:5    |         load |   Kernel
   3. |     line |    ./a.rb:1    |        <nil> |    false
   4. | c-return | tester.rb:5    |         load |   Kernel
{{code}}

{{code}}
$ jruby -J-Djruby.reflection=true -J-Djruby.compile.mode=OFF tester.rb 
   1. |     line | tester.rb:5    |        <nil> |    false
   2. |     line | /home/emdot/ruby/tester/lib/stf/./a.rb:1    | 
/home/emdot/ruby/tester/lib/stf/./a.rb |    false
{{code}}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to