[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-debug-dev] Weird stepping problem
|
Hi,
consider the following method:
public void testBuffer() {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 60; i++) {
buf.append("foobar");
}
int x = 1;
}
I am tyring to programmatically step through this program, so I have
set a MethodEntry breakpoint at testBuffer and a LineBreakpoint at "int
x = 1;". Then, I registered a IJavaBreakpointListener with the
JDIDebugModel. This listener installs a IDebugEventSetListener upon
reaching the first breakpoint and removes the IDebugEventSetListener
upon reaching the second breakpoint.
The IDebugEventSetListener does the following (pseudo code):
for all debug events:
get IJavaThread from event.getSource
if thread is suspended (step.end) {
if thread canStepOver {
thread.stepOver();
} else {
thread.resume();
} else {
thread.resume();
}
So basically, I perform a step-over all lines in the code, right?
The problem is, that the above code works perfectly under Windows XP
using Eclipse 2.1 and Sun Java SDK 1.4.1_02.
However, if I run the code _twice_ under Linux (Debian) with Eclipse
2.1 and Sun Java SDK 1.4.1_02, it stops somewhere between two steps.
Note that I can run this code as often as I like under Windows, but
Linux does not complete the second run.
Another note: If I do not use a StringBuffer in the "testBuffer"
method, it works well (so far, StringBuffer is the only class which
showed this strange behaviour).
Now, did _I_ miss anything (as I have not been developing with/for
exclipse for too long, I am not sure if I picked the right approach) or
could this indicate a bug in Eclipse or the JDK?
Am I allowed to use thread.{stepInto/stepOver/resume/terminate...}
commands in the IDebugSetEventListener, or does that produce thread
problems?
Thanks for your time and any suggestions,
Philipp Bouillon