use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues 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);
}
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues 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);
}
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues in project binnavi by google.
the class RegisterValuesParser method parse.
/**
* Parses a byte array from the debug client into usable register information.
*
* @param data Byte array from the debug client.
*
* @return Usable register information.
*
* @throws IllegalArgumentException If the data argument is null.
* @throws MessageParserException If parsing the message failed.
*/
public static RegisterValues parse(final byte[] data) throws MessageParserException {
Preconditions.checkNotNull(data, "IE01299: Data argument can not be null");
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
final DocumentBuilder builder = factory.newDocumentBuilder();
final Document document = builder.parse(new ByteArrayInputStream(data, 0, data.length));
final NodeList nodes = document.getFirstChild().getChildNodes();
final List<ThreadRegisters> threads = new ArrayList<>();
for (int i = 0; i < nodes.getLength(); ++i) {
final Node node = nodes.item(i);
if (node.getNodeName().equals("Thread")) {
threads.add(parseThreadNode(node));
} else {
throw new MessageParserException(String.format("IE01040: Invalid node '%s' found during register values message parsing", node.getNodeName()));
}
}
return new RegisterValues(threads);
} catch (IOException | ParserConfigurationException | SAXException exception) {
CUtilityFunctions.logException(exception);
throw new MessageParserException(exception.getLocalizedMessage());
}
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues in project binnavi by google.
the class EchoBreakpointHitParser method parseSuccess.
@Override
public EchoBreakpointHitReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final long tid = parseThreadId();
final byte[] data = parseData();
// Try to convert the byte data into valid register values.
try {
final RegisterValues registerValues = RegisterValuesParser.parse(data);
return new EchoBreakpointHitReply(packetId, 0, tid, registerValues);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
return new EchoBreakpointHitReply(packetId, PARSER_ERROR, 0, null);
}
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues in project binnavi by google.
the class BreakpointHitParser method parseSuccess.
@Override
public BreakpointHitReply 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 BreakpointHitReply(packetId, 0, tid, registerValues);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
return new BreakpointHitReply(packetId, PARSER_ERROR, tid, null);
}
}
Aggregations