Search in sources :

Example 1 with FieldBreakpointInfo

use of com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo in project graal by oracle.

the class VMEventListenerImpl method writeSharedFieldInformation.

private PacketStream writeSharedFieldInformation(FieldBreakpointEvent event, Object currentThread, CallFrame callFrame, byte eventType) {
    PacketStream stream = new PacketStream().commandPacket().commandSet(64).command(100);
    FieldBreakpointInfo info = event.getInfo();
    stream.writeByte(info.getSuspendPolicy());
    // # events in reply
    stream.writeInt(1);
    stream.writeByte(eventType);
    stream.writeInt(info.getRequestId());
    long threadId = ids.getIdAsLong(currentThread);
    stream.writeLong(threadId);
    // location
    stream.writeByte(callFrame.getTypeTag());
    stream.writeLong(callFrame.getClassId());
    stream.writeLong(callFrame.getMethodId());
    stream.writeLong(callFrame.getCodeIndex());
    // tagged refType
    KlassRef klass = info.getKlass();
    stream.writeByte(TypeTag.getKind(klass));
    stream.writeLong(context.getIds().getIdAsLong(klass));
    // fieldID
    stream.writeLong(context.getIds().getIdAsLong(info.getField()));
    // tagged object ID for field being accessed
    stream.writeByte(TagConstants.OBJECT);
    if (Modifier.isStatic(info.getField().getModifiers())) {
        stream.writeLong(0);
    } else {
        stream.writeLong(context.getIds().getIdAsLong(event.getReceiver()));
    }
    return stream;
}
Also used : PacketStream(com.oracle.truffle.espresso.jdwp.impl.PacketStream) FieldBreakpointInfo(com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo)

Example 2 with FieldBreakpointInfo

use of com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo in project graal by oracle.

the class VMEventListenerImpl method onFieldModification.

@Override
@TruffleBoundary
public boolean onFieldModification(FieldRef field, Object receiver, Object value) {
    boolean active = false;
    for (FieldBreakpoint info : field.getFieldBreakpointInfos()) {
        if (info.isModificationBreakpoint()) {
            // OK, tell the Debug API to suspend the thread now
            debuggerController.prepareFieldBreakpoint(new FieldBreakpointEvent((FieldBreakpointInfo) info, receiver, value));
            debuggerController.suspend(context.asGuestThread(Thread.currentThread()));
            active = true;
        }
    }
    return active;
}
Also used : FieldBreakpointEvent(com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointEvent) FieldBreakpointInfo(com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 3 with FieldBreakpointInfo

use of com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo in project graal by oracle.

the class VMEventListenerImpl method onFieldAccess.

@Override
@TruffleBoundary
public boolean onFieldAccess(FieldRef field, Object receiver) {
    boolean active = false;
    for (FieldBreakpoint info : field.getFieldBreakpointInfos()) {
        if (info.isAccessBreakpoint()) {
            // OK, tell the Debug API to suspend the thread now
            debuggerController.prepareFieldBreakpoint(new FieldBreakpointEvent((FieldBreakpointInfo) info, receiver));
            debuggerController.suspend(context.asGuestThread(Thread.currentThread()));
            active = true;
        }
    }
    return active;
}
Also used : FieldBreakpointEvent(com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointEvent) FieldBreakpointInfo(com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

FieldBreakpointInfo (com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointInfo)3 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)2 FieldBreakpointEvent (com.oracle.truffle.espresso.jdwp.impl.FieldBreakpointEvent)2 PacketStream (com.oracle.truffle.espresso.jdwp.impl.PacketStream)1