[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-debug-dev] JDIDebugTarget
|
Hi,
I've been developing a Java Virtual Machine, and have been using eclipse
a lot for testing, uptil now it pretty much runs all java code I've been
testing in both the SunVM and my own, this week I've build a JDWP
compliant transport debugger interface, and am now able to use Eclipse
as a debugger which is pretty cool.
The JDWP specification from SUN states that after I send the
'JDWP-Handshake' message, I have to send:
'JDWP.EventKind.VM_START' to notify the debugger of VM Initialisation.
The documentation states the following:
http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#J
DWP_Event_Composite
'Notification of initialization of a target VM. This event is received
before the main thread is started and before any application code has
been executed. Before this event occurs a significant amount of system
code has executed and a number of system classes have been loaded. This
event is always generated by the target VM, even if not explicitly
requested.'
Now the problem I have is, that this event may not occur directly after
my "javaw.exe" is started by Eclipse, this is largly based on the fact
that I use my VM as a scripting engine for our game, and it may not be
until after the game starts that the VM is active and initialized.
Eclipse seems to ignore this message and starts sending messages right
away to set breakpoints, request for class information, thread
information and so on.
I have moved a few lines of code in "JDIDebugTarget.java" that solves a
part of the problem:
>From 'protected synchronized void initialize() {'
I moved the following three lines:
initializeRequests();
initializeState();
initializeBreakpoints();
To 'public void handleVMStart(VMStartEvent event) {'
The SUN JRE 1.5.0_04 does not seem to have a problem with it, but since
I'm not the original author of this code I'm unaware of the real
consequences, which is why I'm posting here.
Furthermore it is still sending a lot of messages that 'should' not be
send until after the VM Start event, or I am misinterpreting the
specifications. The following list are the messages still send by
Eclipse before the VM Start event, in this specific order.
1.7, (11 bytes) request: IDSizes
15.1, (17 bytes) request: Set
1.1, (11 bytes) request: Version
1.17, (11 bytes) request: CapabilitiesNew
15.1, (37 bytes) request: Set (Include Pattern: java.lang.Error)
15.1, (39 bytes) request: Set (Include Pattern: java.lang.Error$*)
1.2, (32 bytes) request: ClassesBySignature (Ljava/lang/Error;)
15.1, (28 bytes) request: Set
2.1, (19 bytes) request: Signature
15.1, (41 bytes) request: Set (Include Pattern: java.lang.Throwable)
15.1, (43 bytes) request: Set (Include Pattern: java.lang.Throwable$*)
1.2, (36 bytes) request: ClassesBySignature (Ljava/lang/Throwable;)
15.1, (28 bytes) request: Set
2.1, (19 bytes) request: Signature
Especially the 1.2, 2.1 and 15.1 messages are very related to the VM and
since that one has not been initialized yet, it cannot reply with valid
data. The other messages are oke to send, since they are related to
static information about the JRE.
Tom van Dijck
Playlogic Game Factory BV.
The Netherlands.