use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CModuleConfiguration method updateDebugger.
/**
* Takes a debugger template and updates the debugger object of the module accordingly if
* possible.
*
* @param template The debugger template that provides the debugger information.
*/
private void updateDebugger(final DebuggerTemplate template) {
if ((m_debugger == null) || !m_debugger.isConnected()) {
if (template == null) {
m_debugger = null;
} else {
m_debugger = new TcpDebugger(template, new ModuleTargetSettings(m_module));
m_debugger.setAddressTranslator(m_module, m_fileBase, m_imageBase);
}
for (final IModuleListener listener : m_listeners) {
try {
listener.changedDebugger(m_module, m_debugger);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class TraceLoggerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, InvalidDatabaseVersionException {
final SQLProvider mockProvider = new MockSqlProvider();
// CDatabase("", "", "", "", "", false,
final IDatabase internalDatabase = new MockDatabase();
// false);
final Database database = new Database(internalDatabase);
database.load();
final MockProject mockProject = new MockProject();
final ITreeNode<CTag> nodeRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, mockProvider));
final Tree<CTag> nodeTagTree = new Tree<CTag>(nodeRootNode);
final TagManager nodeTagManager = new TagManager(new CTagManager(nodeTagTree, TagType.NODE_TAG, mockProvider));
final ITreeNode<CTag> viewRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, mockProvider));
final Tree<CTag> viewTagTree = new Tree<CTag>(viewRootNode);
final TagManager viewTagManager = new TagManager(new CTagManager(viewTagTree, TagType.VIEW_TAG, mockProvider));
final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
final Project project = new Project(database, mockProject, nodeTagManager, viewTagManager);
m_mockModule = new Module(database, mockModule, viewTagManager, nodeTagManager);
m_debugSettings = new ModuleTargetSettings(m_mockModule.getNative());
m_mockDebugger = new MockDebugger(m_debugSettings);
m_mockDebugger.setAddressTranslator(mockModule, new CAddress(0), new CAddress(0x1000));
final Debugger debugger = new Debugger(m_mockDebugger);
m_logger = new TraceLogger(debugger, module);
m_projectLogger = new TraceLogger(debugger, project);
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class InstructionNode method toString.
@Override
public String toString() {
final ZyGraphViewSettings settings = new ZyGraphViewSettings(new GraphSettingsConfigItem());
final DebuggerProvider provider = new DebuggerProvider(new ModuleTargetSettings(instruction.getModule()));
return ZyInstructionBuilder.buildInstructionLine(instruction, settings, new CDefaultModifier(settings, provider)).first();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemorySectionPanelSynchronizerTest method testChangingAddress.
@Test
public void testChangingAddress() throws DebugExceptionWrapper {
// Makes sure to update the combo box when the active address changes
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
m_model.setActiveDebugger(debugger);
final MemorySection section1 = new MemorySection(new CAddress(0x1000), new CAddress(0x1FF0));
final MemorySection section2 = new MemorySection(new CAddress(0x3000), new CAddress(0x3FF0));
final MemoryMap memoryMap = new MemoryMap(Lists.newArrayList(section1, section2));
debugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, memoryMap));
assertEquals(2, m_sectionBox.getItemCount());
assertEquals(section1, m_sectionBox.getItemAt(0).getObject());
assertEquals(section2, m_sectionBox.getItemAt(1).getObject());
assertEquals(section1, m_sectionBox.getSelectedItem().getObject());
m_model.setActiveMemoryAddress(new CAddress(0x3000), false);
assertEquals(section2, m_sectionBox.getSelectedItem().getObject());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemorySectionPanelSynchronizerTest method testReceiveTargetInformation.
@Test
public void testReceiveTargetInformation() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.SUSPENDED);
debugger.getProcessManager().addThread(thread);
debugger.getProcessManager().setActiveThread(thread);
final MemorySection section1 = new MemorySection(new CAddress(0x100), new CAddress(0x1FF));
final MemorySection section2 = new MemorySection(new CAddress(0x300), new CAddress(0x3FF));
final MemoryMap memoryMap = new MemoryMap(Lists.newArrayList(section1, section2));
debugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, memoryMap));
debugger.connect();
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setTargetInformation(new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, true, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false)));
assertTrue(m_sectionBox.isEnabled());
debugger.getProcessManager().setTargetInformation(new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false)));
assertFalse(m_sectionBox.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
Aggregations