use of com.google.security.zynamics.binnavi.disassembly.types.Section in project binnavi by google.
the class PostgreSQLSectionFunctionsTests method testCreateSection6.
@Test
public void testCreateSection6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getKernel32Module();
final String sectionName = " SECTION NAME ";
final BigInteger startAddress = new BigInteger("10000", 16);
final BigInteger endAddress = new BigInteger("20000", 16);
final int sectionId = getProvider().createSection(module.getConfiguration().getId(), sectionName, null, startAddress, endAddress, SectionPermission.READ_WRITE_EXECUTE, new byte[] {});
module.close();
module.load();
final Section section = module.getContent().getSections().getSection(sectionId);
Assert.assertEquals(section.getName(), sectionName);
Assert.assertEquals(section.getStartAddress().toBigInteger(), startAddress);
Assert.assertEquals(section.getEndAddress().toBigInteger(), endAddress);
Assert.assertEquals(section.getSectionPermission(), SectionPermission.READ_WRITE_EXECUTE);
module.close();
}
use of com.google.security.zynamics.binnavi.disassembly.types.Section in project binnavi by google.
the class PostgreSQLTypeInstanceFunctionsTests method createTypeInstance6.
@Test
public void createTypeInstance6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final String typeInstanceName = " TYPE INSTANCE NAME ";
module.load();
final Section section = module.getContent().getSections().getSections().get(0);
final BaseType type = module.getTypeManager().getTypes().get(0);
final int typeInstanceId = provider.createTypeInstance(module.getConfiguration().getId(), typeInstanceName, null, type.getId(), section.getId(), 0);
module.close();
module.load();
final TypeInstance typeInstance = module.getContent().getTypeInstanceContainer().getTypeInstanceById(typeInstanceId);
Assert.assertEquals(typeInstanceId, typeInstance.getId());
Assert.assertEquals(typeInstanceName, typeInstance.getName());
Assert.assertEquals(module, typeInstance.getModule());
Assert.assertEquals(section.getId(), typeInstance.getSection().getId());
}
use of com.google.security.zynamics.binnavi.disassembly.types.Section in project binnavi by google.
the class PostgreSQLTypeInstancesNotificationParserTest method setUp.
@Before
public void setUp() throws NumberFormatException, CouldntSaveDataException, CouldntLoadDataException {
view = MockViewGenerator.generate(provider, module, function);
baseType = module.getTypeManager().getTypes().get(0);
final Section section = module.getContent().getSections().createSection("TEST_SECTION", new CAddress("01000000", 16), new CAddress("0100FFFF", 16), SectionPermission.READ_WRITE_EXECUTE, null);
final TypeInstanceContainer container = module.getContent().getTypeInstanceContainer();
instance = container.createInstance("TEST_INSTANCE", null, baseType, section, new Long("11143"));
final CCodeNode node = view.getBasicBlocks().get(0);
final INaviInstruction instruction = node.getInstructions().iterator().next();
final INaviOperandTreeNode operandNode = instruction.getOperands().get(0).getNodes().get(0);
reference = container.createReference(instruction.getAddress(), 0, operandNode, instance, view);
assertNotNull(reference);
}
use of com.google.security.zynamics.binnavi.disassembly.types.Section in project binnavi by google.
the class MockSqlProvider method setSectionName.
@Override
public void setSectionName(final int moduleId, final int sectionId, final String name) throws CouldntSaveDataException {
Section oldSection = null;
for (final Section section : sections.get(moduleId)) {
if (section.getId() == sectionId) {
oldSection = section;
break;
}
}
if (oldSection != null) {
final Section newSection = new Section(oldSection.getId(), name, CommentManager.get(this), oldSection.getModule(), oldSection.getStartAddress(), oldSection.getEndAddress(), oldSection.getSectionPermission(), oldSection.getData());
sections.remove(moduleId, oldSection);
sections.put(moduleId, newSection);
}
}
use of com.google.security.zynamics.binnavi.disassembly.types.Section in project binnavi by google.
the class MockSqlProvider method deleteSection.
@Override
public void deleteSection(final Section section) {
final Section currentSection = Iterables.find(sections.get(section.getModule().getConfiguration().getId()), new Predicate<Section>() {
@Override
public boolean apply(final Section currentSection) {
return section.getId() == currentSection.getId();
}
});
sections.remove(section.getModule().getConfiguration().getId(), currentSection);
}
Aggregations