Thomas E Enebo wrote:
On Fri, Aug 29, 2008 at 5:31 AM, Martin Krauskopf
<[EMAIL PROTECTED]> wrote:
[...]
Sorry for bringing this too late, but I did not see any pre-announcement
about JRuby 1.1.4, so I could check it before the release. Might be I've
just missed it.
Sorry Martin, this was my fault. The patch I received was passing
event hook as an enum, but was also passing the line number adjusted
from the enum before calling the event method. The signature should
probably pass the unadjusted line number and the enum in.
Hi Tom,
I have to leave just now, so only quickly..... I caught also the change
in the line numbering (was 0-based, now is 1-based). I've already tweak
the debugger (not committed to debug-commons yet). I wanted to write
test there, but in the end came with one for JRuby (attaching), so we
catch possible future regression.
Also sorry about the interface, I guess I should have realized that
was used externally. Since I broke this for 1.1.4 maybe we re-break
for 1.1.5 and get this set up correctly. We can then lock-step
upgrade debugging with jruby?
I'm for type-safe enum, rather then bringing back the 'int' for clients.
Or might be both for backward compatibility. But just type-safe enum is
ok. I have to leave now, so we can talk later e.g. through IRC.
Cheers,
m.
package org.jruby.runtime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import junit.framework.TestCase;
import org.jruby.Ruby;
import org.jruby.RubyInstanceConfig;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.runtime.builtin.IRubyObject;
public final class EventHookTest extends TestCase {
public EventHookTest(final String testName) {
super(testName);
}
public void testLineNumbersForNativeTracer() {
RubyInstanceConfig config = new RubyInstanceConfig();
config.processArguments(new String[]{"--debug"});
Ruby rt = JavaEmbedUtils.initialize(Collections.emptyList(), config);
NativeTracer tracer = new NativeTracer();
rt.addEventHook(tracer);
RubyRuntimeAdapter evaler = JavaEmbedUtils.newRuntimeAdapter();
evaler.eval(rt, "sleep 0.01\nsleep 0.01\nsleep 0.01");
assertEquals("expected tracing", Arrays.asList(1,1,1,2,2,2,3,3,3), tracer.lines);
}
private final static class NativeTracer extends EventHook {
List<Integer> lines;
NativeTracer() {
this.lines = new ArrayList<Integer>();
}
@Override
public boolean isInterestedInEvent(RubyEvent event) {
return true;
}
@Override
public void eventHandler(ThreadContext context, String eventName,
String file, int line, String name, IRubyObject type) {
lines.add(line);
}
}
}
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email