use of com.google.security.zynamics.zylib.general.Pair in project binnavi by google.
the class EchoBreakpointSetParser method parseSuccess.
@Override
public EchoBreakpointSetReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final int counter = parseInteger();
final List<Pair<RelocatedAddress, Integer>> addresses = new ArrayList<>();
for (int i = 0; i < counter; i++) {
final RelocatedAddress address = new RelocatedAddress(parseAddress());
final int error = parseInteger();
addresses.add(new Pair<RelocatedAddress, Integer>(address, error));
}
return new EchoBreakpointSetReply(packetId, 0, addresses);
}
use of com.google.security.zynamics.zylib.general.Pair in project binnavi by google.
the class EchoBreakpointRemovedParser method parseSuccess.
@Override
public EchoBreakpointsRemovedReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final int counter = parseInteger();
final List<Pair<RelocatedAddress, Integer>> addresses = new ArrayList<>();
for (int i = 0; i < counter; i++) {
final RelocatedAddress address = new RelocatedAddress(parseAddress());
final int error = parseInteger();
addresses.add(new Pair<RelocatedAddress, Integer>(address, error));
}
return new EchoBreakpointsRemovedReply(packetId, 0, addresses);
}
use of com.google.security.zynamics.zylib.general.Pair in project binnavi by google.
the class StepBreakpointSetParser method parseSuccess.
@Override
public StepBreakpointSetReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final List<Pair<RelocatedAddress, Integer>> addresses = new ArrayList<>();
final int numberOfAddresses = parseInteger();
for (int i = 0; i < numberOfAddresses; i++) {
final RelocatedAddress address = new RelocatedAddress(parseAddress());
addresses.add(new Pair<RelocatedAddress, Integer>(address, parseInteger()));
}
return new StepBreakpointSetReply(packetId, 0, addresses);
}
use of com.google.security.zynamics.zylib.general.Pair in project binnavi by google.
the class MemoryRangeCalculator method calculateRequestRange.
/**
* Calculates the range of memory to request from the debug client. For performance reasons this
* range is different from the range specified by the user.
*
* @param offset The start offset of the range according to the user.
* @param size The number of bytes to request according to the user.
* @param sectionStart Beginning of the section the offset belongs to.
* @param sectionEnd End of the section the offset belongs to.
*
* @return A pair that contains the real start offset and the real size information of the
* request.
*/
public static Pair<IAddress, Integer> calculateRequestRange(final BigInteger offset, final int size, final IAddress sectionStart, final IAddress sectionEnd) {
// To smoothen scrolling we try to load a range that is at max
// +- 3 requested ranges.
final BigInteger availableBefore = offset.subtract(sectionStart.toBigInteger());
final BigInteger availableAfter = sectionEnd.toBigInteger().subtract(offset).add(BigInteger.ONE);
final BigInteger loadBefore = availableBefore.compareTo(BigInteger.valueOf(3L * size)) == -1 ? availableBefore : BigInteger.valueOf(3L * size);
final BigInteger loadAfter = availableAfter.compareTo(BigInteger.valueOf(3L * size)) == -1 ? availableAfter : BigInteger.valueOf(3L * size);
final BigInteger realOffset = offset.subtract(loadBefore);
final int realSize = (int) (loadBefore.add(loadAfter)).longValue();
return new Pair<IAddress, Integer>(new CAddress(realOffset), realSize);
}
use of com.google.security.zynamics.zylib.general.Pair in project binnavi by google.
the class MemoryRangeCalculator method calculateRequestRange.
/**
* Calculates the range of memory to request from the debug client. For performance reasons this
* range is different than the range specified by the user.
*
* @param debugger The debugger from which the memory is loaded.
* @param offset The start offset of the range according to the user.
* @param size The number of bytes to request according to the user.
*
* @return A pair that contains the real start offset and the real size information of the
* request.
*/
public static Pair<IAddress, Integer> calculateRequestRange(final IDebugger debugger, final BigInteger offset, final int size) {
final MemoryMap mmap = debugger.getProcessManager().getMemoryMap();
final MemorySection section = mmap.findOffset(offset);
if (section == null) {
return new Pair<IAddress, Integer>(new CAddress(offset), size);
} else {
return calculateRequestRange(offset, size, section.getStart(), section.getEnd());
}
}
Aggregations