use of com.google.security.zynamics.binnavi.API.disassembly.View in project binnavi by google.
the class PathFinderTest method testPassingFunctionReturn.
@Test
public void testPassingFunctionReturn() throws CouldntLoadDataException, PartialLoadException {
// Tests pathfinding from one function to another function while passing one function
// and having a target block that is a RETURN block.
//
// What should happen here is that the pathfinding algorithm stops when it reaches
// the RETURN node. That is consecutive calls to the target function should not
// be part of the pathfinding result.
// 0x1004565 -> 0x1003C92 -> 0x100398D
final Function startFunction = findFunction(m_notepad, 0x1004565);
final BasicBlock startBlock = findBlock(startFunction, 0x1004629);
final Function endFunction = findFunction(m_notepad, 0x100398D);
final BasicBlock endBlock = findBlock(endFunction, 0x10039D9);
final View view = PathFinder.createPath(m_notepad, startBlock, endBlock, null, null);
assertEquals(14, view.getGraph().nodeCount());
assertEquals(19, view.getGraph().edgeCount());
}
use of com.google.security.zynamics.binnavi.API.disassembly.View in project binnavi by google.
the class PathFinderTest method testInsideFunction.
// @Test
// public void testFoo() throws CouldntLoadDataException, CouldntSaveDataException
// {
// // TODO: Bring this test back in msw3prt.idb
//
// final Function startFunction = findFunction(m_foo, 0x5FEF8426);
// final BasicBlock startBlock = findBlock(startFunction, 0x5FEF8426);
//
// final Function endFunction = findFunction(m_foo, 0x5FEFF06D);
// final BasicBlock endBlock = findBlock(endFunction, 0x5FEFF0DB);
//
// final View view = PathFinder.createPath(m_foo, startBlock, endBlock, null, null);
//
// assertEquals(46, view.getGraph().nodeCount());
// assertEquals(49, view.getGraph().edgeCount());
// }
@Test
public void testInsideFunction() throws CouldntLoadDataException, PartialLoadException {
// Tests path finding from the beginning to the end of a single function
final Function startFunction = findFunction(m_notepad, 0x01002B87);
final BasicBlock startBlock = findBlock(startFunction, 0x1002B87);
final BasicBlock endBlock = findBlock(startFunction, 0x100336A);
final View view = PathFinder.createPath(m_notepad, startBlock, endBlock, null, null);
assertEquals(96, view.getGraph().nodeCount());
assertEquals(150, view.getGraph().edgeCount());
}
use of com.google.security.zynamics.binnavi.API.disassembly.View in project binnavi by google.
the class PathFinderTest method testFirstBlock.
@Test
public void testFirstBlock() throws CouldntLoadDataException, PartialLoadException {
// Tests 100337E -> 1005179 -> 1007568 where all calls are in the first block
// of the respective functions.
// Tests path finding from the beginning to the end of a single function
final Function startFunction = findFunction(m_notepad, 0x100337E);
final BasicBlock startBlock = findBlock(startFunction, 0x10033C2);
final Function endFunction = findFunction(m_notepad, 0x1007568);
final BasicBlock endBlock = findBlock(endFunction, 0x1007568);
final View view = PathFinder.createPath(m_notepad, startBlock, endBlock, null, null);
assertEquals(3, view.getGraph().nodeCount());
assertEquals(2, view.getGraph().edgeCount());
}
use of com.google.security.zynamics.binnavi.API.disassembly.View in project binnavi by google.
the class PathFinderTest method testToImportedFunction.
@Test
public void testToImportedFunction() throws CouldntLoadDataException, PartialLoadException {
// Tests from the beginning of a function to an imported function
final Function startFunction = findFunction(m_notepad, 0x0100398D);
final BasicBlock startBlock = findBlock(startFunction, 0x100398D);
final Function endFunction = findFunction(m_notepad, 0x1001000);
endFunction.load();
final View view = PathFinder.createPath(m_notepad, startBlock, null, null, endFunction);
assertEquals(3, view.getGraph().nodeCount());
assertEquals(2, view.getGraph().edgeCount());
}
Aggregations