Per Bothner wrote: >> Chas Emerick schrieb: >> [...] >>> The scope of the current discussion/bug report is not visibility of >>> code within the same project to support interleaving dependencies. >>> This is a much simpler issue about recognizing any classfiles >>> generated by any source other than javac in other, free-standing >>> projects. .. > Both of these problems can be helped by emitting the JSR-45 > SourceDebugExtension attribute. For example:
I'd love to see better support for multilanguage projects and debugging in NetBeans, to be sure. Currently most debugging options for other languages depend on their either fitting into the Java model of source/class mapping (as Groovy does) or having their own debugging libraries (as is the case in JRuby). But integrating the two approaches has not happened yet. In JRuby, we emit correct source line numbers, filenames, and all that...we also emit the SDE attr, but it turns out not to be particularly useful. The problem that we run into is that current debuggers expect more than just file + line numbers...they expect that locating source content works just like it does for Java. For example, Ruby has the idea of a "load path", similar to a classpath. In the load path, there may be many entries of the same name. So if you're looking "foo" out of foo.rb from somewhere in the load path we have two options: 1. record the source file name as a relative location in the load path, as Ruby treats it. This obviously doesn't work for debugging because the absolute location of the file is lost. 2. record the absolute path of the file name. This also doesn't help debugging, since at least in the case of JDB and NetBeans debuggers you must have pre-configured source locations in which to find all source files. Ultimately the biggest barrier (perhaps the only barrier) to having normal Java debugging work in JRuby is locating the files. Related to that is accepting that an "eval" of code that doesn't provide filename and line number information will be undebuggable. Then I support the final puzzle piece is allowing Java-level debugging against alternative languages using the mechanisms those languages use to locate source files. If we ignore this limitation, Java-level debugging works just peachy in JRuby: $ cat foo.rb a = 1 b = 2 c = a + b puts c $ jrubyc foo.rb Compiling foo.rb to class foo jdb -classpath lib/jruby.jar:. foo Initializing jdb ... > use . > stop at foo:1 Deferring breakpoint foo:1. It will be set after the class is loaded. > run run foo Set uncaught java.lang.Throwable Set deferred uncaught java.lang.Throwable > VM Started: Set deferred breakpoint foo:1 Breakpoint hit: "thread=main", foo.__file__(), line=1 bci=25 1 a = 1 main[1] list 1 => a = 1 2 b = 2 3 c = a + b 4 puts c main[1] next > Step completed: "thread=main", foo.__file__(), line=2 bci=39 2 b = 2 main[1] next > Step completed: "thread=main", foo.__file__(), line=3 bci=53 3 c = a + b main[1] next > Step completed: "thread=main", foo.__file__(), line=4 bci=76 4 puts c main[1] next > 3 Step completed: "thread=main", foo.__file__(), line=-1 bci=19 main[1] cont > The application exited - Charlie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---