Search in sources :

Example 1 with MessageParserException

use of com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException in project binnavi by google.

the class SingleStepParser method parseSuccess.

@Override
public SingleStepReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
    final long tid = parseThreadId();
    final RelocatedAddress address = new RelocatedAddress(parseAddress());
    try {
        final RegisterValues registerValues = RegisterValuesParser.parse(parseData());
        return new SingleStepReply(packetId, 0, tid, address, registerValues);
    } catch (final MessageParserException e) {
        return new SingleStepReply(packetId, PARSER_ERROR, tid, address, null);
    }
}
Also used : SingleStepReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply) MessageParserException(com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)

Example 2 with MessageParserException

use of com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException in project binnavi by google.

the class StepBreakpointHitParser method parseSuccess.

@Override
public StepBreakpointHitReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
    final long tid = parseThreadId();
    final byte[] data = parseData();
    try {
        final RegisterValues registerValues = RegisterValuesParser.parse(data);
        return new StepBreakpointHitReply(packetId, 0, tid, registerValues);
    } catch (final MessageParserException e) {
        return new StepBreakpointHitReply(packetId, PARSER_ERROR, tid, null);
    }
}
Also used : MessageParserException(com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException) StepBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)

Example 3 with MessageParserException

use of com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException in project binnavi by google.

the class CDebuggerSynchronizerTest method testRegisterValues_Malformed.

@Test
public void testRegisterValues_Malformed() {
    mockDebugger.getProcessManager().addThread(new TargetProcessThread(123, ThreadState.RUNNING));
    NaviLogger.setLevel(Level.OFF);
    try {
        debuggerSynchronizer.receivedEvent(new RegistersReply(0, 0, RegisterValuesParser.parse("Hannes".getBytes())));
        fail();
    } catch (final MessageParserException exception) {
        CUtilityFunctions.logException(exception);
    } finally {
        NaviLogger.setLevel(Level.SEVERE);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) MessageParserException(com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException) RegistersReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.RegistersReply) Test(org.junit.Test)

Aggregations

MessageParserException (com.google.security.zynamics.binnavi.debug.connection.packets.parsers.MessageParserException)3 RegisterValues (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)2 RegistersReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.RegistersReply)1 SingleStepReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply)1 StepBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply)1 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)1 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)1 Test (org.junit.Test)1