use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class CSearchWaiterTest method testDetach.
@Test
public void testDetach() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNull(waiter.getReply());
debugger.close();
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class CSearchWaiterTest method testSuccess.
@Test
public void testSuccess() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 0, new CAddress(0x300)));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNotNull(waiter.getReply());
assertTrue(waiter.getReply().success());
debugger.close();
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class CMemorySectionWrapperTest method testSimple.
@Test
public void testSimple() {
assertEquals("00000000 - 000003FE (1023 bytes)", new CMemorySectionWrapper(new MemorySection(new CAddress(0), new CAddress(1022))).toString());
assertEquals("00000000 - 000003FF (1.00 KB)", new CMemorySectionWrapper(new MemorySection(new CAddress(0), new CAddress(1023))).toString());
assertEquals("00000000 - 000005DC (1.47 KB)", new CMemorySectionWrapper(new MemorySection(new CAddress(0), new CAddress(1500))).toString());
assertEquals("00000000 - 00102710 (1.01 MB)", new CMemorySectionWrapper(new MemorySection(new CAddress(0), new CAddress((1024 * 1024) + 10000))).toString());
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class CStackMemoryProvider method hasData.
@Override
public boolean hasData(final long startAddress, final long numberOfBytes) {
if (m_debugger == null) {
return false;
}
if (m_debugger.getProcessManager().getTargetInformation().getDebuggerOptions().canMemmap()) {
return m_memoryProvider != null && m_memoryProvider.hasData(BigInteger.valueOf(startAddress), (int) numberOfBytes);
} else {
final CAddress stackStart = new CAddress(getStartAddress());
final int stackSize = getNumberOfEntries() * 4;
final CAddress stackEnd = new CAddress(getStartAddress() + stackSize);
final Pair<IAddress, Integer> realRange = MemoryRangeCalculator.calculateRequestRange(BigInteger.valueOf(startAddress), (int) numberOfBytes, stackStart, stackEnd);
final long realStart = realRange.first().toLong();
final long realSize = realRange.second();
return m_memoryProvider != null && m_memoryProvider.hasData(BigInteger.valueOf(startAddress), (int) numberOfBytes, BigInteger.valueOf(realStart), (int) realSize);
}
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class CGotoAddressField method zoomToAddress.
/**
* Zooms to the current address.
*/
private void zoomToAddress() {
if (!"".equals(getText())) {
add(getText());
final IAddress address = new CAddress(Long.parseLong(getText(), 16));
m_textField.setSuccessful(ZyZoomHelpers.zoomToAddress(m_graph, address, m_modules.get(0), true));
}
}
Aggregations